]> khamidou — GitHub mirrors - rfcspot.git/commitdiff
better
authorKarim Hamidou <khamidou@gmail.com>
Sat, 26 Mar 2016 23:27:35 +0000 (16:27 -0700)
committerKarim Hamidou <khamidou@gmail.com>
Sat, 26 Mar 2016 23:27:35 +0000 (16:27 -0700)
src/render_rfc.py
templates/index.html

index 21a2a87592825d36fdb1fe4f37443c2617872fbe..65a510ec30081a778fa093ad0833f73c9c52bf17 100644 (file)
@@ -115,6 +115,12 @@ def create_diagram_blocks(data, **kwargs):
     return data
 
 
+def handle_ebnf_rule(data, **kwargs):
+    ebnf_regexp = re.compile(r"^\s+([\w\-_\+]+)\s{3,}=(.+)$")
+    data = ebnf_regexp.sub(r'<b>\1:</b>&nbsp;\2', data)
+    return data
+
+
 def add_line_breaks_legends(data, **kwargs):
     # RFC diagrams also have legends, of the form:
     # (1) ...comment...\n
@@ -195,7 +201,7 @@ def render_html_rfc(filename, rfc_metadata):
     opts = dict(filename=filename, html_name=html_name, rfcs=rfc_metadata)
 
     for fn in [replace_rfc_by_link, remove_top_space, cleanup_author_header, remove_page_breaks,
-               anchor_titles, create_paragraphs, add_line_breaks_legends,
+               anchor_titles, handle_ebnf_rule, create_paragraphs, add_line_breaks_legends,
                cleanup_toc, create_diagram_blocks, render_communication_lines_correctly]:
         out = fn(out, **opts)
 
index e8c4417b768747103bc90dc36c5a006dc92b8ec3..5e49227b4ee892110ea740dcc4cdc9d8e98a25ca 100644 (file)
@@ -41,7 +41,7 @@
 
         <hr>
         <h5>Who is behind this?</h5>
-        <p>Hi, I'm <a href="http://khamidou.com">Karim</a>! I'm a backend engineer and have to spend a lot of time reading RFCs. Unfortunately, most of them are really ugly and hard to understand without proper context.</p>
+        <p>Hi, I'm <a href="http://khamidou.com">Karim</a>! I'm a backend engineer and have to spend a lot of time reading RFCs. Unfortunately, most of them are hard to understand without proper context.</p>
 
         <h5>Special thanks:</h5>