← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mbp/launchpad/888353-microformats-2 into lp:launchpad

 

Martin Pool has proposed merging lp:~mbp/launchpad/888353-microformats-2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~mbp/launchpad/888353-microformats-2/+merge/83856

This is basically the good uncontroversial bits of https://code.launchpad.net/~mbp/launchpad/798412-plusone/+merge/83449

 * add schema.org microformats on various things
 * add permalink on code review comments
 * add meta description on single codereview comment page, on blueprints, on bug commensts
 * better in-page title on bmps

-- 
https://code.launchpad.net/~mbp/launchpad/888353-microformats-2/+merge/83856
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mbp/launchpad/888353-microformats-2 into lp:launchpad.
=== modified file 'lib/lp/answers/stories/question-workflow.txt'
--- lib/lp/answers/stories/question-workflow.txt	2011-10-20 00:53:01 +0000
+++ lib/lp/answers/stories/question-workflow.txt	2011-11-29 21:28:26 +0000
@@ -291,7 +291,8 @@
     True
 
     >>> bestAnswer.first('div', 'boardCommentBody')
-    <div class="boardCommentBody"><p>New version of the firefox package
+    <div class="boardCommentBody" itemprop="commentText"><p>New version
+    of the firefox package
     are available with SVG support enabled. You can use apt-get or adept to
     upgrade.</p></div>
 
@@ -355,13 +356,17 @@
     >>> print extract_text(answerer)
     No Privileges Person (no-priv)
 
-    >>> message = bestAnswer.parent.parent.find(
+    >>> message = soup.find(
     ...     'div', 'boardCommentBody highlighted')
+    >>> print message
+    <div class="boardCommentBody highlighted"
+    itemprop="commentText"><p>New version of the firefox package are
+    available with SVG support enabled. You can use apt-get or adept to
+    upgrade.</p></div>
     >>> print extract_text(message)
     New version of the firefox package are available with SVG support
     enabled. You can use apt-get or adept to upgrade.
 
-
 History
 =======
 

=== modified file 'lib/lp/answers/templates/questionmessage-display.pt'
--- lib/lp/answers/templates/questionmessage-display.pt	2011-05-31 14:58:26 +0000
+++ lib/lp/answers/templates/questionmessage-display.pt	2011-11-29 21:28:26 +0000
@@ -3,10 +3,16 @@
   xmlns:metal="http://xml.zope.org/namespaces/metal";
   omit-tag="">
 <div
+  itemscope=""
+  itemtype="http://schema.org/UserComments";
   tal:define="css_classes view/getBoardCommentCSSClass"
   tal:attributes="class string:${css_classes};
                   id string:comment-${context/index}">
   <div class="boardCommentDetails">
+    <table>
+      <tbody>
+        <tr>
+    <td>
     <tal:bestanswer condition="view/isBestAnswer">
       <img src="/@@/favourite-yes" style="float:right;" alt="Best"
            title="Marked as best answer" />
@@ -15,16 +21,23 @@
       <tal:comment_owner replace="structure context/owner/fmt:link-display-name-id" />
     </tal:comment_has_owner>
     said
-    <span
-      tal:attributes="title context/datecreated/fmt:datetime"
+    <time
+      itemprop="commentTime"
+      tal:attributes="title context/datecreated/fmt:datetime;
+        datetime context/datecreated/fmt:isodate"
       tal:content="context/datecreated/fmt:displaydate">Thursday
-    13:21</span>:
-    <span style="float:right;"
-       tal:content="string: #${context/display_index}" />
+    13:21</time>:
+    </td>
+    <td class="bug-comment-index">
+      <a
+	tal:content="string: #${context/display_index}" />
+    </td>
+  </tr></tbody></table>
   </div>
 
   <div class="boardCommentBody"
     tal:attributes="class view/getBodyCSSClass"
+    itemprop="commentText"
     tal:content="structure
       context/text_contents/fmt:obfuscate-email/fmt:email-to-html">
     Message text.

=== modified file 'lib/lp/blueprints/browser/specification.py'
--- lib/lp/blueprints/browser/specification.py	2011-07-14 12:44:48 +0000
+++ lib/lp/blueprints/browser/specification.py	2011-11-29 21:28:26 +0000
@@ -562,6 +562,10 @@
     def page_title(self):
         return self.label
 
+    @property
+    def page_description(self):
+        return self.context.summary
+
     def initialize(self):
         # The review that the user requested on this spec, if any.
         self.notices = []

=== modified file 'lib/lp/bugs/browser/bugcomment.py'
--- lib/lp/bugs/browser/bugcomment.py	2011-11-16 23:46:01 +0000
+++ lib/lp/bugs/browser/bugcomment.py	2011-11-29 21:28:26 +0000
@@ -341,6 +341,10 @@
             self.comment.index, self.context.bug.id)
 
     @property
+    def page_description(self):
+        return self.comment.text_contents
+
+    @property
     def privacy_notice_classes(self):
         if not self.context.bug.private:
             return 'hidden'

=== modified file 'lib/lp/bugs/templates/bugcomment-box.pt'
--- lib/lp/bugs/templates/bugcomment-box.pt	2011-11-24 00:37:40 +0000
+++ lib/lp/bugs/templates/bugcomment-box.pt	2011-11-29 21:28:26 +0000
@@ -36,23 +36,28 @@
           <td tal:condition="comment/bugwatch">
             <img width="14" height="14" src="/@@/bug-remote" alt=""/>
             In
-            <a tal:attributes="href comment/bugwatch/url"
-               tal:content="comment/bugwatch/title" />,
+            <a itemprop="url"
+              tal:attributes="href comment/bugwatch/url"
+              tal:content="comment/bugwatch/title" />,
             <tal:comment_owner
                 replace="structure comment/owner/fmt:link-display-name-id" />
             wrote
-            <span tal:attributes="title comment/datecreated/fmt:datetime"
-                  tal:content="comment/datecreated/fmt:displaydate">
+            <time
+              itemprop="commentTime"
+              tal:attributes="title comment/datecreated/fmt:datetime;
+                datetime comment/datecreated/fmt:isodate"
+              tal:content="comment/datecreated/fmt:displaydate">
               7 minutes ago
-              </span>:
+              </time>:
               <a tal:attributes="href comment/fmt:url">
                 <strong tal:condition="comment/display_title"
                         tal:content="comment/title" />
               </a>
           </td>
+
           <td class="bug-comment-index">
-	  <a itemprop="url"
-	     tal:attributes="href comment/fmt:url"
+          <a itemprop="url"
+             tal:attributes="href comment/fmt:url"
              tal:content="string: #${comment/index}" />
           </td>
         </tr>
@@ -94,6 +99,7 @@
       <a tal:attributes="href comment/fmt:url">Read more...</a>
     </p>
   </div>
+
   <div class="boardCommentFooter" tal:condition="comment/show_footer">
     <a tal:attributes="id string:mark-spam-${context/index};"
        tal:condition="view/show_spam_controls"

=== modified file 'lib/lp/bugs/templates/bugcomment-index.pt'
--- lib/lp/bugs/templates/bugcomment-index.pt	2011-08-03 15:27:05 +0000
+++ lib/lp/bugs/templates/bugcomment-index.pt	2011-11-29 21:28:26 +0000
@@ -9,7 +9,7 @@
   <body>
     <metal:block fill-slot="head_epilogue">
     </metal:block>
-    <div metal:fill-slot="main" tal:define="comment view/comment">
+    <div metal:fill-slot="main" itemprop="mainContentOfPage" tal:define="comment view/comment">
       <h1 tal:content="view/page_title">Foo doesn't work</h1>
       <tal:comment replace="structure comment/@@+box-expanded-reply">
       </tal:comment>

=== modified file 'lib/lp/code/browser/branchmergeproposal.py'
--- lib/lp/code/browser/branchmergeproposal.py	2011-11-20 05:56:28 +0000
+++ lib/lp/code/browser/branchmergeproposal.py	2011-11-29 21:28:26 +0000
@@ -594,7 +594,6 @@
 
     implements(IBranchMergeProposalActionMenu)
 
-    label = "Proposal to merge branch"
     schema = ClaimButton
 
     def initialize(self):
@@ -677,6 +676,12 @@
         return result
 
     @property
+    def label(self):
+        return "Merge %s into %s" % (
+            self.context.source_branch.bzr_identity,
+            self.context.target_branch.bzr_identity)
+
+    @property
     def pending_diff(self):
         return (
             self.context.next_preview_diff_job is not None or

=== modified file 'lib/lp/code/browser/codereviewcomment.py'
--- lib/lp/code/browser/codereviewcomment.py	2011-11-22 22:21:46 +0000
+++ lib/lp/code/browser/codereviewcomment.py	2011-11-29 21:28:26 +0000
@@ -175,6 +175,10 @@
         """The decorated code review comment."""
         return CodeReviewDisplayComment(self.context)
 
+    @property
+    def page_description(self):
+        return self.context.message_body
+
     # Should the comment be shown in full?
     full_comment = True
     # Show comment expanders?

=== modified file 'lib/lp/code/browser/tests/test_codereviewcomment.py'
--- lib/lp/code/browser/tests/test_codereviewcomment.py	2011-08-12 11:37:08 +0000
+++ lib/lp/code/browser/tests/test_codereviewcomment.py	2011-11-29 21:28:26 +0000
@@ -5,6 +5,11 @@
 
 __metaclass__ = type
 
+from soupmatchers import (
+    HTMLContains,
+    Tag,
+    )
+
 from canonical.launchpad.webapp.interfaces import IPrimaryContext
 from canonical.launchpad.webapp.testing import verifyObject
 from canonical.testing.layers import DatabaseFunctionalLayer
@@ -13,6 +18,7 @@
     ICodeReviewDisplayComment,
     )
 from lp.testing import (
+    BrowserTestCase,
     person_logged_in,
     TestCaseWithFactory,
     )
@@ -44,3 +50,23 @@
         display_comment = CodeReviewDisplayComment(comment)
 
         verifyObject(ICodeReviewDisplayComment, display_comment)
+
+
+class TestCodeReviewCommentHtml(BrowserTestCase):
+
+    layer = DatabaseFunctionalLayer
+
+    def test_comment_page_has_meta_description(self):
+        # The CodeReviewDisplayComment class provides IComment.
+        with person_logged_in(self.factory.makePerson()):
+            comment = self.factory.makeCodeReviewComment()
+
+        display_comment = CodeReviewDisplayComment(comment)
+        browser = self.getViewBrowser(display_comment)
+        self.assertThat(
+            browser.contents,
+            HTMLContains(Tag(
+                'meta description', 'meta',
+                dict(
+                    name='description',
+                    content=comment.message_body))))

=== modified file 'lib/lp/code/stories/branches/xx-code-review-comments.txt'
--- lib/lp/code/stories/branches/xx-code-review-comments.txt	2011-10-20 00:53:01 +0000
+++ lib/lp/code/stories/branches/xx-code-review-comments.txt	2011-11-29 21:28:26 +0000
@@ -112,8 +112,8 @@
     source branch to land it. When this comment is replied to, it should
     wrap the line properly.
     >>> print_comments('boardCommentDetails', anon_browser, index=0)
-    Eric the Viking (eric) wrote ... ago
-    Posted in a previous version of this proposal
+    Eric the Viking (eric) wrote ... ago:
+    Posted in a previous version of this proposal #
     >>> details = find_tags_by_class(
     ...     anon_browser.contents, 'boardCommentDetails')[0]
     >>> links = details.findAll('a')
@@ -133,7 +133,7 @@
     >>> eric_browser.getControl('Save Comment').click()
 
     >>> print_comments('boardCommentDetails', eric_browser, index=2)
-    Eric the Viking ... a moment ago
+    Eric the Viking ... ago: #
     >>> print_comments('boardCommentFooter', eric_browser, index=0)
     review: Abstain (timeless)
     >>> print_comments('boardCommentBody', eric_browser, index=2)

=== modified file 'lib/lp/code/templates/codereviewcomment-body.pt'
--- lib/lp/code/templates/codereviewcomment-body.pt	2010-09-20 10:48:52 +0000
+++ lib/lp/code/templates/codereviewcomment-body.pt	2011-11-29 21:28:26 +0000
@@ -12,10 +12,12 @@
     </div>
   </tal:good-attachments>
 
-  <div class="replyLink">
-    <tal:reply tal:define="link context/menu:context/reply"
-               tal:condition="link/enabled"
-               tal:replace="structure link/render">
+  <div class="replyLink" itemprop="replyToUrl" 
+    tal:define="link context/menu:context/reply"
+    tal:condition="link/enabled"
+    tal:attributes="url link/fmt:url">
+    <tal:reply 
+      tal:replace="structure link/render">
       Reply
     </tal:reply>
   </div>

=== modified file 'lib/lp/code/templates/codereviewcomment-header.pt'
--- lib/lp/code/templates/codereviewcomment-header.pt	2011-05-31 15:15:47 +0000
+++ lib/lp/code/templates/codereviewcomment-header.pt	2011-11-29 21:28:26 +0000
@@ -3,12 +3,30 @@
    xmlns:metal="http://xml.zope.org/namespaces/metal";
    omit-tag="">
 
-  <tal:author replace="structure context/comment_author/fmt:link-display-name-id"/>
+<table><tbody><tr>
+  <td>
+  <span
+    itemprop="creator"
+    tal:content="structure context/comment_author/fmt:link-display-name-id"/>
   <tal:has-body condition="context/has_body">wrote</tal:has-body>
-  <tal:date replace="context/comment_date/fmt:displaydate" />
+  <time
+    itemprop="commentTime"
+    tal:attributes="title context/comment_date/fmt:datetime;
+                datetime context/comment_date/fmt:isodate"
+    tal:content="context/comment_date/fmt:displaydate">
+      7 minutes ago
+    </time>:
   <span tal:condition="context/from_superseded" class="sprite warning-icon"
         style="float: right">Posted in <a
           tal:attributes="href context/branch_merge_proposal/fmt:url">a
           previous version</a>
         of this proposal</span>
+    </td>
+
+    <td class="bug-comment-index">
+      <a itemprop="url"
+        tal:attributes="href context/fmt:url">#</a>
+    </td>
+
+</tr></tbody></table>
 </tal:root>

=== modified file 'lib/lp/registry/templates/distribution-index.pt'
--- lib/lp/registry/templates/distribution-index.pt	2011-06-16 13:50:58 +0000
+++ lib/lp/registry/templates/distribution-index.pt	2011-11-29 21:28:26 +0000
@@ -24,7 +24,7 @@
 
   <body>
     <tal:heading metal:fill-slot="heading">
-      <h1 tal:content="context/title">project title</h1>
+      <h1 itemprop="name" tal:content="context/title">project title</h1>
     </tal:heading>
 
     <tal:registering metal:fill-slot="registering">
@@ -57,7 +57,7 @@
       </div>
 
       <div class="yui-g">
-        <div class="yui-u first">
+        <div itemprop="description" class="yui-u first">
            <tal:distro-information content="structure context/@@+details" />
         </div>
 

=== modified file 'lib/lp/services/comments/templates/comment.pt'
--- lib/lp/services/comments/templates/comment.pt	2010-02-19 19:16:32 +0000
+++ lib/lp/services/comments/templates/comment.pt	2011-11-29 21:28:26 +0000
@@ -3,12 +3,16 @@
    xmlns:metal="http://xml.zope.org/namespaces/metal";
    omit-tag="">
 
-  <div tal:attributes="class string:boardComment ${context/extra_css_class|nothing}">
+   <div
+    itemscope=""
+    itemtype="http://schema.org/UserComments";
+    tal:attributes="class string:boardComment ${context/extra_css_class|nothing}">
     <div class="boardCommentDetails"
          tal:content="structure context/@@+comment-header">
       Details - everyone has details.
     </div>
     <div class="boardCommentBody"
+      itemprop="commentText"
          tal:condition="context/has_body"
          tal:content="structure context/@@+comment-body">
       The comment body

=== modified file 'lib/lp/soyuz/templates/archive-index.pt'
--- lib/lp/soyuz/templates/archive-index.pt	2011-11-26 03:55:57 +0000
+++ lib/lp/soyuz/templates/archive-index.pt	2011-11-29 21:28:26 +0000
@@ -8,6 +8,8 @@
   >
 <body>
   <tal:heading metal:fill-slot="heading">
+    <meta itemprop="name"
+      tal:attributes="content context/displayname">
     <h1 tal:condition="context/enabled"
         tal:replace="structure view/displayname_edit_widget">
       PPA for user


Follow ups