]> khamidou — GitHub mirrors - rfcspot.git/commitdiff
handle C: S: lines correctly.
authorKarim Hamidou <khamidou@gmail.com>
Sat, 26 Mar 2016 22:52:51 +0000 (15:52 -0700)
committerKarim Hamidou <khamidou@gmail.com>
Sat, 26 Mar 2016 22:52:51 +0000 (15:52 -0700)
src/render_rfc.py

index d644a60ac22d691e6f6b67bdf76c2613c0dafddc..3cc07ee3bc74e362f5922e4c2b31bd744479bf7c 100644 (file)
@@ -161,8 +161,8 @@ def render_communication_lines_correctly(data, **kwargs):
     #            S: a001 OK CAPABILITY completed
     #            C: a002 STARTTLS
     # so we need to insert line breaks between those.
-    client_rx = re.compile(r"^(.+)\s+([CS]\:)(.+)$", re.MULTILINE)
-    data = client_rx.sub(r"\1 \2 \3<br>", data)
+    client_rx = re.compile(r"""([^"']([CS]\:)[^"'](.+))""", re.MULTILINE)
+    data = client_rx.sub(r"<pre>\1</pre>", data)
 
     args_rx = re.compile(r"^   ((Arguments|Responses|Result):)(.+?\n\s*\n)", re.MULTILINE | re.DOTALL)
     data = args_rx.sub(r"<b>\1</b> <div style='white-space: pre'>\3</div>", data)