]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
doc: Allow underscores (and markdown syntax) in parameter documentation
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 3 Oct 2015 06:07:23 +0000 (08:07 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 4 Oct 2015 07:07:15 +0000 (09:07 +0200)
rpp/blocks/scripts/doc_parse.py

index a51f5f9f4b27a0af9950713fa0e097d927e81776..1ccb38c57deac00181ab364d3516788aaaa257b2 100755 (executable)
@@ -44,14 +44,18 @@ args = parser.parse_args()
 
 mydir = os.path.dirname(os.path.realpath(__file__))
 
-def print_markdown_as(format, text):
+def markdown_as(format, text):
     sys.stdout.flush()
-    proc = subprocess.Popen(['pandoc', '-f', 'markdown', '-t', format], stdin = subprocess.PIPE)
+    proc = subprocess.Popen(['pandoc', '-f', 'markdown', '-t', format], stdin = subprocess.PIPE, stdout = subprocess.PIPE)
     proc.stdin.write(bytes(text, 'UTF-8'))
-    proc.communicate()
+    (stdout, stderr) = proc.communicate()
     proc.stdin.close()
     if proc.returncode:
         raise Exception("pandoc failed: %d" % proc.returncode)
+    return stdout.decode('utf-8').rstrip()
+
+def print_markdown_as(format, text):
+    print(markdown_as(format, text))
 
 def print_latex_desc(doc, filename):
     def iodef_str(iodef):
@@ -60,9 +64,9 @@ def print_latex_desc(doc, filename):
         for io in iodef:
             str += Template('\\item {\\bf $name} $type').substitute(io)
             if 'range' in io:
-                str += '  %s' % io['range']
+                str += '  %s' % markdown_as('latex', io['range'])
             if 'note' in io:
-                str += '  %s' % io['note']
+                str += '  %s' % markdown_as('latex', io['note'])
             str += '\n'
         return str +'\end{enumerate}'