Skip to content

Commit

Permalink
Add support for an editor ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewest committed Feb 13, 2015
1 parent 551c9c2 commit 9ec66e8
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bikeshed/MetadataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def looksEmailish(string):
return re.match(r".+@.+\..+", string)
data = {
'name' : pieces[0],
'id' : None,
'org' : None,
'orglink': None,
'link' : None,
Expand Down Expand Up @@ -392,6 +393,11 @@ def looksEmailish(string):
pieces = data['org'].split()
data['orglink'] = pieces[-1]
data['org'] = ' '.join(pieces[:-1])
# Check if the name ends with an ID.
if data['name'] and re.search(r"\s\d+$", data['name']):
pieces = data['name'].split()
data['id'] = pieces[-1]
data['name'] = ' '.join(pieces[:-1])
return data


Expand Down
2 changes: 2 additions & 0 deletions bikeshed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,8 @@ def addTOCSection(doc):
def addSpecMetadataSection(doc):
def printEditor(editor):
div = E.div({"class":"p-author h-card vcard"})
if editor['id']:
div.attrib['data-editor-id'] = editor['id']
if editor['link']:
appendChild(div, E.a({"class":"p-name fn u-url url", "href":editor['link']}, editor['name']))
elif editor['email']:
Expand Down
12 changes: 12 additions & 0 deletions tests/metadata013.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h1>Foo</h1>

<pre class=metadata>
Group: test
Shortname: foo
Level: 1
Status: ED
ED: http://example.com/foo
Abstract: Test editor ID.
Editor: Example Editor 12345, Megacorp, test@example.test
Date: 1970-01-01
</pre>
72 changes: 72 additions & 0 deletions tests/metadata013.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!doctype html>
<html lang="en">
<head>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">


<title>Foo</title>


<meta content="Bikeshed 1.0.0" name="generator">
</head>


<body class="h-entry">

<div class="head">

<p data-fill-with="logo"></p>

<h1 class="p-name no-ref" id="title">Foo</h1>

<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft,
<time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>

<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="http://example.com/foo">http://example.com/foo</a>
<dt class="editor">Editor:
<dd class="editor">
<div class="p-author h-card vcard" data-editor-id="12345"><a class="p-name fn u-email email" href="mailto:test@example.test">Example Editor</a> (<span class="p-org org">Megacorp</span>)</div>
</dl>
</div>

<div data-fill-with="warning"></div>

<p class="copyright" data-fill-with="copyright">COPYRIGHT GOES HERE
</p>

<hr title="Separator for header">
</div>


<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>

<div class="p-summary" data-fill-with="abstract">
<p>Test editor ID.</p>

</div>

<div data-fill-with="at-risk"></div>


<h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="content">Table of Contents</span></h2>

<div data-fill-with="table-of-contents" role="navigation">
<ul class="toc" role="directory">
<li><a href="#references"><span class="secno"></span> <span class="content">References</span></a>
</ul></div>

<main>




</main>



<h2 class="no-num heading settled" id="references"><span class="content">References</span></h2></body>
</html>

0 comments on commit 9ec66e8

Please sign in to comment.