diff options
| author | Cary Coutant <ccoutant@gmail.com> | 2024-11-26 13:03:32 -0800 | 
|---|---|---|
| committer | Cary Coutant <ccoutant@gmail.com> | 2024-12-09 11:07:09 -0800 | 
| commit | d90ddffca64dece622dc0b29289868729876b008 (patch) | |
| tree | 4a479fd90cbea1c8e400444fe8836a2dd29d16c7 /tools | |
| parent | Count deferred issues as closed. (diff) | |
Make markdown sources available for issues.
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/md-wrapper.py | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/md-wrapper.py b/tools/md-wrapper.py index ecaff4a..fda2c48 100755 --- a/tools/md-wrapper.py +++ b/tools/md-wrapper.py  | |||
| @@ -97,6 +97,14 @@ if "format" in vars and vars["format"] != "markdown": | |||
| 97 | vars["content"] = '<pre class=\"proposal\">\n' + html.escape(text) + "</pre>\n" | 97 | vars["content"] = '<pre class=\"proposal\">\n' + html.escape(text) + "</pre>\n" | 
| 98 | else: | 98 | else: | 
| 99 | vars["content"] = markdown.markdown(text, extensions = ['tables']) | 99 | vars["content"] = markdown.markdown(text, extensions = ['tables']) | 
| 100 | if dest_file.endswith(".html"): | ||
| 101 | md_file = dest_file.replace(".html", ".txt") | ||
| 102 | with open(md_file, 'w', encoding="utf-8") as f: | ||
| 103 | if "title" in tmpl_vars: | ||
| 104 | f.write("# " + tmpl_vars["title"] + "\n\n") | ||
| 105 | f.write(text) | ||
| 106 | md_link = os.path.relpath(md_file, dest_dir) | ||
| 107 | vars["mdsource"] = f'<div class="mdsource"><a href="{md_link}" >View Markdown Source</a></div>' | ||
| 100 | 108 | ||
| 101 | # Substitution function for replacing template variables. | 109 | # Substitution function for replacing template variables. | 
| 102 | # Treats "{{@filename}}" as an include. | 110 | # Treats "{{@filename}}" as an include. | 
