summaryrefslogtreecommitdiff
path: root/modules/rdf
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-04-08 17:40:26 +0000
committerDries Buytaert <dries@buytaert.net>2010-04-08 17:40:26 +0000
commite8cfe921116e5e1c6e2a7e5081079bb052d7af63 (patch)
tree39d657d74e240e989ccf3d8f79d6bbda44a2c765 /modules/rdf
parentd5ce7f5281373044b8e1df6d95287270c0b33145 (diff)
downloadbrdo-e8cfe921116e5e1c6e2a7e5081079bb052d7af63.tar.gz
brdo-e8cfe921116e5e1c6e2a7e5081079bb052d7af63.tar.bz2
- Patch #694994 by Stefan Freudenberg: fixed the RDFa markup for number of comments on teasers.
Diffstat (limited to 'modules/rdf')
-rw-r--r--modules/rdf/rdf.module6
-rw-r--r--modules/rdf/rdf.test30
2 files changed, 36 insertions, 0 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module
index 105a9680c..78dfb6e34 100644
--- a/modules/rdf/rdf.module
+++ b/modules/rdf/rdf.module
@@ -483,6 +483,12 @@ function rdf_preprocess_node(&$variables) {
$comment_count_attributes['property'] = $variables['node']->rdf_mapping['comment_count']['predicates'];
$comment_count_attributes['content'] = $variables['node']->comment_count;
$comment_count_attributes['datatype'] = $variables['node']->rdf_mapping['comment_count']['datatype'];
+ // According to RDFa parsing rule number 4, a new subject URI is created
+ // from the href attribute if no rel/rev attribute is present. To get
+ // the original node URL from the about attribute of the parent container
+ // we set an empty rel attribute which triggers rule number 5. See
+ // http://www.w3.org/TR/rdfa-syntax/#sec_5.5.
+ $comment_count_attributes['rel'] = '';
$variables['content']['links']['comment']['#links']['comment_comments']['attributes'] += $comment_count_attributes;
}
// In full node view, the number of comments is not displayed by
diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test
index 18545a186..6182717f8 100644
--- a/modules/rdf/rdf.test
+++ b/modules/rdf/rdf.test
@@ -371,6 +371,36 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
}
}
+class RdfCommentAttributesTestCase extends DrupalWebTestCase {
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'RDF comment mapping',
+ 'description' => 'Tests the RDFa markup of comments.',
+ 'group' => 'RDF',
+ );
+ }
+
+ public function setUp() {
+ parent::setUp('rdf', 'rdf_test', 'comment');
+ // Enable anonymous posting of content.
+ user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
+ 'create article content' => TRUE,
+ 'access comments' => TRUE,
+ 'post comments' => TRUE,
+ 'post comments without approval' => TRUE,
+ ));
+ }
+
+ public function testAttributesInTeaser() {
+ $node = $this->drupalCreateNode(array('type' => 'article', 'uid' => 1, 'promote' => 1));
+ CommentHelperCase::postComment($node, $this->randomName(), $this->randomName());
+ $this->drupalGet('');
+ $comment_count_link = $this->xpath('//div[@about=:url]//a[contains(@property, "sioc:num_replies") and @rel=""]', array(':url' => url("node/$node->nid")));
+ $this->assertTrue(!empty($comment_count_link), t('Empty rel attribute found in comment count link.'));
+ }
+
+}
class RdfTrackerAttributesTestCase extends DrupalWebTestCase {
public static function getInfo() {