[gtk-doc/markdown-content] Expand markdown in content files



commit c2feecbf0424518a0a79cb302434c858fb54aa44
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 13 01:07:17 2019 -0500

    Expand markdown in content files
    
    Here is a quick proof-of-concept patch to recognize
    .md files in expand_content_files, and run ConvertMarkDown
    on them. It is not quite as useful as I had hoped, since
    gtk-doc's markdown support is so limited. And it insists
    on emitting <refsect2> elements. But its a start.
    
    I tested this by putting test.md in expand_content_files,
    and then have this in my main xml:
        <refentry>
          <refmeta><refentrytitle>Test</refentrytitle></refmeta>
          <refnamediv><refpurpose>markdown</refpurpose></refnamediv>
          <xi:include href="xml/test.md" />
        </refentry>

 gtkdoc/mkdb.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index 9404452..2ad2008 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -2381,7 +2381,10 @@ def OutputExtraFile(file):
     contents = open(file, 'r', encoding='utf-8').read()
 
     with open(new_db_file, 'w', encoding='utf-8') as out:
-        out.write(ExpandAbbreviations(basename + " file", contents))
+        if old_db_file.endswith(".md"):
+            out.write(ConvertMarkDown(basename + " file", contents))
+        else:
+           out.write(ExpandAbbreviations(basename + " file", contents))
 
     return common.UpdateFileIfChanged(old_db_file, new_db_file, 0)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]