Roundup Tracker - Issues

Message6316

Author mschieder
Recipients ThomasAH, ber, mschieder, ncoghlan, rouilj
Date 2019-01-10.18:45:55
Message-id <1547145956.07.0.476198900875.issue2550856@roundup.psfhosted.org>
In-reply-to
I wrote it as an extension (local_markdown).

For the translation from markdown to HTML I use the commonmark library.

A way to include 'local_markdown' in Roundup is to call it from
'local_replace'.
The call must come after the replacement of 'local_replace' because
'local_markdown' could disturb the regular expressions.
It should also be noted that the strings to be replaced by
'local_replace' can now start and end with '*' or '_' to highlight them
with Markdown.


diff -r 1025affaa63a local_replace.py
--- a/local_replace.py  Thu Jan 10 17:01:30 2019 +0100
+++ b/local_replace.py  Thu Jan 10 17:02:30 2019 +0100
@@ -1,4 +1,5 @@
 import re
+import local_markdown
 
 hg_url_base = r'http://sourceforge.net/p/roundup/code/ci/'
 
@@ -35,6 +36,8 @@
 def local_replace(message):
     for cre, replacement in substitutions:
         message = cre.sub(replacement, message)
+
+    message = local_markdown.local_markdown(message)
     return message
 
 def init(instance):


The final implementation should check if 'local_markdown' can be
imported or not to start Roundup without 'local_markdown'.

The advantage of this is that the templates do not have to be edited.
The disadvantage is that 'local_replace' must be edited and it only
works with 'local_replace'.


The other possibility is to call 'local_markdown' in the templates, like
'local_replace').
But for this all templates have to be edited and I haven't found a good
way to implement the call there yet.


Whether 'local_markdown' is technically safe (executable code) still has
to be checked.
History
Date User Action Args
2019-01-10 18:45:56mschiedersetmessageid: <1547145956.07.0.476198900875.issue2550856@roundup.psfhosted.org>
2019-01-10 18:45:56mschiedersetrecipients: + mschieder, ber, rouilj, ThomasAH, ncoghlan
2019-01-10 18:45:56mschiederlinkissue2550856 messages
2019-01-10 18:45:55mschiedercreate