From 8ab41efadd6adb95806a8c6106a8fe7b4f0a30a8 Mon Sep 17 00:00:00 2001 From: Karim Hamidou Date: Sat, 26 Mar 2016 16:27:35 -0700 Subject: [PATCH] better --- src/render_rfc.py | 8 +++++++- templates/index.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/render_rfc.py b/src/render_rfc.py index 21a2a875..65a510ec 100644 --- a/src/render_rfc.py +++ b/src/render_rfc.py @@ -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'\1: \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) diff --git a/templates/index.html b/templates/index.html index e8c4417b..5e49227b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -41,7 +41,7 @@
Who is behind this?
-

Hi, I'm Karim! 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.

+

Hi, I'm Karim! 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.

Special thanks:
-- 2.43.0