diff options
author | David Rothstein <drothstein@gmail.com> | 2013-12-25 17:39:50 -0500 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2013-12-25 17:39:50 -0500 |
commit | 63312113a25ce9ad629c6771bef1fa0767955c12 (patch) | |
tree | 1433fe5d7d2c7c46dd2888ed9fc380b326ef7c35 /modules/rdf | |
parent | 94a26aac1c7e280d4fa5953f6c0622b07bbff3bc (diff) | |
download | brdo-63312113a25ce9ad629c6771bef1fa0767955c12.tar.gz brdo-63312113a25ce9ad629c6771bef1fa0767955c12.tar.bz2 |
Issue #2011918 by jesse.d, Liam Morland, scor: Titles are often double-escaped (including in the content attribute of the dc:title meta element for nodes).
Diffstat (limited to 'modules/rdf')
-rw-r--r-- | modules/rdf/rdf.module | 2 | ||||
-rw-r--r-- | modules/rdf/rdf.test | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module index e22d5a93f..877b598cd 100644 --- a/modules/rdf/rdf.module +++ b/modules/rdf/rdf.module @@ -484,7 +484,7 @@ function rdf_preprocess_node(&$variables) { $element = array( '#tag' => 'meta', '#attributes' => array( - 'content' => $variables['title'], + 'content' => $variables['node']->title, 'about' => $variables['node_url'], ), ); diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test index 4d73377f5..0d1b023a4 100644 --- a/modules/rdf/rdf.test +++ b/modules/rdf/rdf.test @@ -313,13 +313,18 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase { */ function testAttributesInMarkup2() { $type = $this->drupalCreateContentType(array('type' => 'test_bundle_hook_install')); - $node = $this->drupalCreateNode(array('type' => 'test_bundle_hook_install')); + // Create node with single quotation mark title to ensure it does not get + // escaped more than once. + $node = $this->drupalCreateNode(array( + 'type' => 'test_bundle_hook_install', + 'title' => $this->randomName(8) . "'", + )); $isoDate = date('c', $node->changed); $url = url('node/' . $node->nid); $this->drupalGet('node/' . $node->nid); // Ensure the mapping defined in rdf_module.test is used. - $test_bundle_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']"); + $test_bundle_title = $this->xpath('//meta[@property="dc:title" and @content="' . $node->title . '"]'); $test_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'foo:mapping_install1') and contains(@typeof, 'bar:mapping_install2')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']"); $this->assertTrue(!empty($test_bundle_title), 'Property dc:title is present in meta tag.'); $this->assertTrue(!empty($test_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.'); |