[html5] r8157 - [e] (0) Example of microdata to JSON conversion, by request Affected topics: HTM [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Aug 29 15:01:26 PDT 2013


Author: ianh
Date: 2013-08-29 15:01:24 -0700 (Thu, 29 Aug 2013)
New Revision: 8157

Modified:
   complete.html
   index
   source
Log:
[e] (0) Example of microdata to JSON conversion, by request
Affected topics: HTML, Microdata

Modified: complete.html
===================================================================
--- complete.html	2013-08-29 20:43:22 UTC (rev 8156)
+++ complete.html	2013-08-29 22:01:24 UTC (rev 8157)
@@ -64569,11 +64569,100 @@
 
    <li><p>Return <var title="">result</var>.</li>
 
-  </ol></div>
+  </ol><div class=example>
 
+   <p>For example, take this markup:</p>
 
+   <pre><!DOCTYPE HTML>
+<title>My Blog</title>
+<article itemscope itemtype="http://schema.org/BlogPosting">
+ <header>
+  <h1 itemprop="headline">Progress report</h1>
+  <p><time itemprop="datePublished" datetime="2013-08-29">today</time></p>
+  <link itemprop="url" href="?comments=0">
+ </header>
+ <p>All in all, he's doing well with his swim lessons. The biggest thing was he had trouble
+ putting his head in, but we got it down.</p>
+ <section>
+  <h1>Comments</h1>
+  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
+   <link itemprop="url" href="#c1">
+   <footer>
+    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
+     <span itemprop="name">Greg</span>
+    </span></p>
+    <p><time itemprop="commentTime" datetime="2013-08-29">15 minutes ago</time></p>
+   </footer>
+   <p>Ha!</p>
+  </article>
+  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
+   <link itemprop="url" href="#c2">
+   <footer>
+    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
+     <span itemprop="name">Charlotte</span>
+    </span></p>
+    <p><time itemprop="commentTime" datetime="2013-08-29">5 minutes ago</time></p>
+   </footer>
+   <p>When you say "we got it down"...</p>
+  </article>
+ </section>
+</article></pre>
 
+   <p>It would be turned into the following JSON by the algorithm above (supposing that the page's
+   URL was <code>http://blog.example.com/progress-report</code>):</p>
 
+   <pre>{
+  "items": [
+    {
+      "type": [ "http://schema.org/BlogPosting" ],
+      "properties": {
+        "headline": [ "Progress report" ],
+        "datePublished": [ "2013-08-29" ],
+        "url": [ "http://blog.example.com/progress-report?comments=0" ],
+        "comment": [
+          {
+            "type": [ "http://schema.org/UserComments" ],
+            "properties": {
+              "url": [ "http://blog.example.com/progress-report#c1" ],
+              "creator": [
+                {
+                  "type": [ "http://schema.org/Person" ],
+                  "properties": {
+                    "name": [ "Greg" ]
+                  }
+                }
+              ],
+              "commentTime": [ "2013-08-29" ]
+            }
+          },
+          {
+            "type": [ "http://schema.org/UserComments" ],
+            "properties": {
+              "url": [ "http://blog.example.com/progress-report#c2" ],
+              "creator": [
+                {
+                  "type": [ "http://schema.org/Person" ],
+                  "properties": {
+                    "name": [ "Charlotte" ]
+                  }
+                }
+              ],
+              "commentTime": [ "2013-08-29" ]
+            }
+          }
+        ]
+      }
+    }
+  ]
+}</pre>
+
+  </div>
+
+  </div>
+
+
+
+
 <!--TOPIC:HTML-->
 
   <h2 id=browsers><span class=secno>6 </span>Loading Web pages</h2>
@@ -103523,6 +103612,7 @@
   Justin Novosad,
   Justin Schuh,
   Justin Sinclair,
+  Ka-Sing Chou,
   Kai Hendry,
   &#x5442;&#x5eb7;&#x8c6a; (KangHao Lu)<!-- Kenny, kennyluck-->,
   Kartikaya Gupta,

Modified: index
===================================================================
--- index	2013-08-29 20:43:22 UTC (rev 8156)
+++ index	2013-08-29 22:01:24 UTC (rev 8157)
@@ -64569,11 +64569,100 @@
 
    <li><p>Return <var title="">result</var>.</li>
 
-  </ol></div>
+  </ol><div class=example>
 
+   <p>For example, take this markup:</p>
 
+   <pre><!DOCTYPE HTML>
+<title>My Blog</title>
+<article itemscope itemtype="http://schema.org/BlogPosting">
+ <header>
+  <h1 itemprop="headline">Progress report</h1>
+  <p><time itemprop="datePublished" datetime="2013-08-29">today</time></p>
+  <link itemprop="url" href="?comments=0">
+ </header>
+ <p>All in all, he's doing well with his swim lessons. The biggest thing was he had trouble
+ putting his head in, but we got it down.</p>
+ <section>
+  <h1>Comments</h1>
+  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
+   <link itemprop="url" href="#c1">
+   <footer>
+    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
+     <span itemprop="name">Greg</span>
+    </span></p>
+    <p><time itemprop="commentTime" datetime="2013-08-29">15 minutes ago</time></p>
+   </footer>
+   <p>Ha!</p>
+  </article>
+  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
+   <link itemprop="url" href="#c2">
+   <footer>
+    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
+     <span itemprop="name">Charlotte</span>
+    </span></p>
+    <p><time itemprop="commentTime" datetime="2013-08-29">5 minutes ago</time></p>
+   </footer>
+   <p>When you say "we got it down"...</p>
+  </article>
+ </section>
+</article></pre>
 
+   <p>It would be turned into the following JSON by the algorithm above (supposing that the page's
+   URL was <code>http://blog.example.com/progress-report</code>):</p>
 
+   <pre>{
+  "items": [
+    {
+      "type": [ "http://schema.org/BlogPosting" ],
+      "properties": {
+        "headline": [ "Progress report" ],
+        "datePublished": [ "2013-08-29" ],
+        "url": [ "http://blog.example.com/progress-report?comments=0" ],
+        "comment": [
+          {
+            "type": [ "http://schema.org/UserComments" ],
+            "properties": {
+              "url": [ "http://blog.example.com/progress-report#c1" ],
+              "creator": [
+                {
+                  "type": [ "http://schema.org/Person" ],
+                  "properties": {
+                    "name": [ "Greg" ]
+                  }
+                }
+              ],
+              "commentTime": [ "2013-08-29" ]
+            }
+          },
+          {
+            "type": [ "http://schema.org/UserComments" ],
+            "properties": {
+              "url": [ "http://blog.example.com/progress-report#c2" ],
+              "creator": [
+                {
+                  "type": [ "http://schema.org/Person" ],
+                  "properties": {
+                    "name": [ "Charlotte" ]
+                  }
+                }
+              ],
+              "commentTime": [ "2013-08-29" ]
+            }
+          }
+        ]
+      }
+    }
+  ]
+}</pre>
+
+  </div>
+
+  </div>
+
+
+
+
 <!--TOPIC:HTML-->
 
   <h2 id=browsers><span class=secno>6 </span>Loading Web pages</h2>
@@ -103523,6 +103612,7 @@
   Justin Novosad,
   Justin Schuh,
   Justin Sinclair,
+  Ka-Sing Chou,
   Kai Hendry,
   &#x5442;&#x5eb7;&#x8c6a; (KangHao Lu)<!-- Kenny, kennyluck-->,
   Kartikaya Gupta,

Modified: source
===================================================================
--- source	2013-08-29 20:43:22 UTC (rev 8156)
+++ source	2013-08-29 22:01:24 UTC (rev 8157)
@@ -71988,11 +71988,100 @@
 
   </ol>
 
+  <div class="example">
+
+   <p>For example, take this markup:</p>
+
+   <pre><!DOCTYPE HTML>
+<title>My Blog</title>
+<article itemscope itemtype="http://schema.org/BlogPosting">
+ <header>
+  <h1 itemprop="headline">Progress report</h1>
+  <p><time itemprop="datePublished" datetime="2013-08-29">today</time></p>
+  <link itemprop="url" href="?comments=0">
+ </header>
+ <p>All in all, he's doing well with his swim lessons. The biggest thing was he had trouble
+ putting his head in, but we got it down.</p>
+ <section>
+  <h1>Comments</h1>
+  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
+   <link itemprop="url" href="#c1">
+   <footer>
+    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
+     <span itemprop="name">Greg</span>
+    </span></p>
+    <p><time itemprop="commentTime" datetime="2013-08-29">15 minutes ago</time></p>
+   </footer>
+   <p>Ha!</p>
+  </article>
+  <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
+   <link itemprop="url" href="#c2">
+   <footer>
+    <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
+     <span itemprop="name">Charlotte</span>
+    </span></p>
+    <p><time itemprop="commentTime" datetime="2013-08-29">5 minutes ago</time></p>
+   </footer>
+   <p>When you say "we got it down"...</p>
+  </article>
+ </section>
+</article></pre>
+
+   <p>It would be turned into the following JSON by the algorithm above (supposing that the page's
+   URL was <code>http://blog.example.com/progress-report</code>):</p>
+
+   <pre>{
+  "items": [
+    {
+      "type": [ "http://schema.org/BlogPosting" ],
+      "properties": {
+        "headline": [ "Progress report" ],
+        "datePublished": [ "2013-08-29" ],
+        "url": [ "http://blog.example.com/progress-report?comments=0" ],
+        "comment": [
+          {
+            "type": [ "http://schema.org/UserComments" ],
+            "properties": {
+              "url": [ "http://blog.example.com/progress-report#c1" ],
+              "creator": [
+                {
+                  "type": [ "http://schema.org/Person" ],
+                  "properties": {
+                    "name": [ "Greg" ]
+                  }
+                }
+              ],
+              "commentTime": [ "2013-08-29" ]
+            }
+          },
+          {
+            "type": [ "http://schema.org/UserComments" ],
+            "properties": {
+              "url": [ "http://blog.example.com/progress-report#c2" ],
+              "creator": [
+                {
+                  "type": [ "http://schema.org/Person" ],
+                  "properties": {
+                    "name": [ "Charlotte" ]
+                  }
+                }
+              ],
+              "commentTime": [ "2013-08-29" ]
+            }
+          }
+        ]
+      }
+    }
+  ]
+}</pre>
+
   </div>
 
+  </div>
 
 
 
+
 <!--TOPIC:HTML-->
 
   <h2 id="browsers">Loading Web pages</h2>
@@ -116010,6 +116099,7 @@
   Justin Novosad,
   Justin Schuh,
   Justin Sinclair,
+  Ka-Sing Chou,
   Kai Hendry,
   &#x5442;&#x5eb7;&#x8c6a; (KangHao Lu)<!-- Kenny, kennyluck-->,
   Kartikaya Gupta,




More information about the Commit-Watchers mailing list