NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 574 - Not particularly great bibtex serialisation. If anyone knows of improvements that could be made here, please let me know.
Not particularly great bibtex serialisation. If anyone knows of improvements ...
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: General
HEAD
All All
: P2 normal
Assigned To: Henri Sivonen
http://svn.whatwg.org/webapps/source?...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-27 14:38 CEST by Henri Sivonen
Modified: 2009-05-27 14:53 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henri Sivonen 2009-05-27 14:38:06 CEST
Index: source
===================================================================
--- source	(revision 3111)
+++ source	(revision 3112)
@@ -48888,13 +48888,21 @@
 
    <dd>
 
-    <p>Gives the name of an author of the work cited by the
+    <p>Gives the name of the authors of the work cited by the
     bibliographic entry.</p>
 
     <p>The <span title="concept-property-value">value</span> must be
     text.</p>
 
-    <p>Any number of properties with the name <code
+    <!-- which should be a list of names, separated by "and", with the
+    weird BibTeX names form:
+      First last-prefix Last
+      last-prefix Last, First
+      last-prefix Last, last-suffix, First
+      http://artis.inrialpes.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#names
+    ...and with "others" as the last name if there's more than listed. -->
+
+    <p>A single property with the name <code
     title="md-bibtex-author">author</code> may be present within each
     <span title="concept-item">item</span> with the type <code
     title="md-bibtex">bibtex</code>. When such an <span
@@ -48908,14 +48916,13 @@
     <code
     title="md-bibtex-entrytype-mastersthesis">mastersthesis</code>,
     <code title="md-bibtex-entrytype-phdthesis">phdthesis</code>,
-    <code title="md-bibtex-entrytype-techreport">techreport</code>,
-    or <code
-    title="md-bibtex-entrytype-unpublished">unpublished</code>, or
-    when such an <span title="concept-item">item</span> has an <code
-    title="md-bibtex-entrytype">entrytype</code> property whose value
-    is one of <code title="md-bibtex-entrytype-book">book</code> or
-    <code title="md-bibtex-entrytype-inbook">inbook</code> and has no
-    property with the name <code
+    <code title="md-bibtex-entrytype-techreport">techreport</code>, or
+    <code title="md-bibtex-entrytype-unpublished">unpublished</code>,
+    or when such an <span title="concept-item">item</span> has an
+    <code title="md-bibtex-entrytype">entrytype</code> property whose
+    value is one of <code title="md-bibtex-entrytype-book">book</code>
+    or <code title="md-bibtex-entrytype-inbook">inbook</code> and has
+    no property with the name <code
     title="md-bibtex-editor">editor</code>, at least one property with
     the name <code title="md-bibtex-author">author</code> must be
     present within the <span title="concept-item">item</span>.</p>
@@ -49000,13 +49007,15 @@
 
    <dd>
 
-    <p>Gives the name of an editor of the work cited by the
+    <p>Gives the name of the editors of the work cited by the
     bibliographic entry.</p>
 
     <p>The <span title="concept-property-value">value</span> must be
     text.</p>
 
-    <p>Any number of properties with the name <code
+    <!-- see note at "author" -->
+
+    <p>A single property with the name <code
     title="md-bibtex-editor">editor</code> may be present within each
     <span title="concept-item">item</span> with the type <code
     title="md-bibtex">bibtex</code>. When such an <span
@@ -51106,7 +51115,129 @@
 
   <h4>BibTeX</h4>
 
-  <p class="XXX">...</p>
+  <p>Given a node <var title="">node</var> in a <code>Document</code>,
+  a user agent must run the following algorithm to extract any <code
+  title="md-bibtex">bibtex</code> data represented by that node into a
+  form that vaguely resembles the format used by BibTeX
+  processors:</p>
+
+  <ol>
+
+   <li>
+
+    <p>If <var title="">node</var> is not an element that is an <span
+    title="concept-item">item</span> with the type <code
+    title="md-bibtex">bibtex</code>, then run these substeps:</p>
+
+    <ol>
+
+     <li><p>If <var title="">node</var> has no parent, then there is
+     no event to output. Abort the algorithm, returning
+     nothing.</p></li>
+
+     <li><p>Let <var title="">node</var> be <var title="">node</var>'s
+     parent.</p></li>
+
+     <li><p>Restart the entire algorithm with the new value of <var
+     title="">node</var>.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li><p>Let <var title="">output</var> be an empty string.</p></li>
+
+   <li><p>Append a U+0040 COMMERCIAL AT character (@) to <var
+   title="">output</var>.</p></li>
+
+   <li><p>Append the <span title="concept-property-value">value</span>
+   of the first property named <code
+   title="mb-bibtex-entrytype">entrytype</code> whose <span
+   title="concept-item-corresponding">corresponding item</span> is
+   <var title="">node</var> if that <span
+   title="concept-property-value">value</span> is not itself an <span
+   title="concept-item">item</span>.</p></li>
+
+   <li><p>Append a U+007B LEFT CURLY BRACKET character ({) to <var
+   title="">output</var>.</p></li>
+
+   <li><p>Append the <span title="concept-property-value">value</span>
+   of the first property named <code
+   title="mb-bibtex-bibtex-id">bibtex-id</code> whose <span
+   title="concept-item-corresponding">corresponding item</span> is
+   <var title="">node</var> if that <span
+   title="concept-property-value">value</span> is not itself an <span
+   title="concept-item">item</span>.</p></li>
+
+   <li><p>Append a U+002C COMMA character (,) and a U+000A LINE FEED
+   (LF) character to <var title="">output</var>.</p></li>
+
+   <li>
+
+    <p>For each element <var title="">element</var> that has one or
+    more <span>property names</span> and whose <span
+    title="concept-item-corresponding">corresponding item</span> is
+    <var title="">node</var>: for each name <var title="">name</var>
+    in <var title="">element</var>'s <span>property names</span>, run
+    the appropriate set of substeps from the following list:</p>
+
+    <ol>
+
+     <li><p>If <var title="">name</var> is equal to the string "<code
+     title="md-about">about</code>", "<code
+     title="md-bibtex-entrytype">entrytype</code>", or "<code
+     title="md-bibtex-bibtex-id">bibtex-id</code>", skip this
+     name.</p></li>
+
+     <li><p>If <var title="">name</var> contains either a U+003A COLON
+     character (:) or a U+002E FULL STOP character (.), skip this
+     name.</p></li>
+
+     <li><p>If the <span title="concept-property-value">value</span>
+     of the property is itself an <span
+     title="concept-item">item</span>, then skip this
+     property.</p></li>
+
+     <li><p>Append two U+0020 SPACE characters to <var
+     title="">output</var>.</p></li>
+
+     <li><p>Append <var title="">name</var></p> to var
+     title="">output</var>.</li>
+
+     <li><p>Append a U+0020 SPACE character, a U+003D EQUALS SIGN
+     character (=), and another U+0020 SPACE character to <var
+     title="">output</var>.</p></li>
+
+     <li><p>Let <var title="">value</var> be the <span
+     title="concept-property-value">value</span> of the
+     property.</p></li>
+
+     <li><p>Replace all occurrences of the U+0022 QUOTATION MARK
+     character (") in <var title="">value</var> with the
+     three-character sequence "<code title="">{"}</code>" (U+007B LEFT
+     CURLY BRACKET, U+0022 QUOTATION MARK, U+007D RIGHT CURLY
+     BRACKET).</p></li>
+
+     <li><p>Append a U+0022 QUOTATION MARK character (") to <var
+     title="">output</var>.</p></li>
+
+     <li><p>Append <var title="">value</var> to <var
+     title="">output</var>.</p></li>
+
+     <li><p>Append a U+0022 QUOTATION MARK character (") to <var
+     title="">output</var>.</p></li>
+
+     <li><p>Append a U+002C COMMA character (,) and a U+000A LINE FEED
+     (LF) character to <var title="">output</var>.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li><p>Append aU+007D RIGHT CURLY BRACKET character (}) to <var
+   title="">output</var>.</p></li>
+
+  </ol>