summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-04-29 16:55:10 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-05-13 11:42:00 +0200
commit74d75a7a6f3ea4bef5b4489c65e8a876ae480c76 (patch)
tree8a98120dc04f5b45b8303b0e2a899f9f159f0aa0 /scripts
parent5660bef06a7cde2500657c2d3de4bad986ff1c6c (diff)
downloadmupdf-74d75a7a6f3ea4bef5b4489c65e8a876ae480c76.tar.xz
Update script that generates browsable hyperlinked html source.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/runtohtml.sh4
-rw-r--r--scripts/tohtml.py21
2 files changed, 14 insertions, 11 deletions
diff --git a/scripts/runtohtml.sh b/scripts/runtohtml.sh
index cd1fee90..918eb652 100644
--- a/scripts/runtohtml.sh
+++ b/scripts/runtohtml.sh
@@ -2,7 +2,7 @@
rm -rf docs/browse
-FILES=$(find include source platform -name '*.[ch]')
+FILES=$(find include source platform -name '*.[chm]')
echo running ctags to make xref
ctags -x $FILES > tags-xref
@@ -12,7 +12,7 @@ do
output=docs/browse/$input.html
mkdir -p $(dirname $output)
echo $input $output
- python scripts/tohtml.py < $input > $output
+ python scripts/tohtml.py $input < $input > $output
done
rm tags-xref
diff --git a/scripts/tohtml.py b/scripts/tohtml.py
index 3dd1c759..b6cb548e 100644
--- a/scripts/tohtml.py
+++ b/scripts/tohtml.py
@@ -1,19 +1,22 @@
import sys, os, re
-HEADER="""<head>
+HEADER="""<!DOCTYPE html>
+<html>
+<head>
<style>
-body { background-color:#fffff0; color:black; margin:16pt; }
+body { background-color:white; color:black; margin:16pt; }
a { text-decoration:none; color:darkblue; }
a.line { position:relative; padding-top:300px; }
.comment { color:green; font-style:italic; }
.comment a { color:darkgreen; }
</style>
</head>
-<body><pre><pre>"""
+<body>
+<pre>"""
FOOTER="""</pre></body>"""
-prefixes = [ 'fz_', 'pdf_', 'xps_', 'cbz_', 'pdfapp_' ]
+prefixes = [ 'fz_', 'pdf_', 'xps_', 'cbz_', 'html_', 'epub_', 'svg_', 'ui_', 'pdfapp_' ]
def is_public(s):
for prefix in prefixes:
@@ -21,19 +24,19 @@ def is_public(s):
return True
return False
-def load_tags():
+def load_tags(curfile):
tags = {}
for line in open("tags-xref").readlines():
ident, type, line, file, text = line.split(None, 4)
- if not is_public(ident):
+ if not is_public(ident) and file != curfile:
continue
- if type == 'function':
+ if type == 'function' or type == 'macro':
tags[ident] = '<a class="function" href="%s#%s">%s</a>' % ("/docs/browse/" + file, line, ident)
- if type == 'typedef' or type == 'struct':
+ if type == 'typedef':
tags[ident] = '<a class="typedef" href="%s#%s">%s</a>' % ("/docs/browse/" + file, line, ident)
return tags
-tags = load_tags()
+tags = load_tags(sys.argv[1])
def quote(s):
return s.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')