diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-08 17:40:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-08 17:40:26 +0000 |
commit | e8cfe921116e5e1c6e2a7e5081079bb052d7af63 (patch) | |
tree | 39d657d74e240e989ccf3d8f79d6bbda44a2c765 /modules | |
parent | d5ce7f5281373044b8e1df6d95287270c0b33145 (diff) | |
download | brdo-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')
-rw-r--r-- | modules/rdf/rdf.module | 6 | ||||
-rw-r--r-- | modules/rdf/rdf.test | 30 |
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() { |