diff --git a/.gitignore b/.gitignore
index 6bd68968c..e69bf71bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,4 +32,5 @@ res/binary_to_compressed_c.exe
res/docpdf/manual.html
res/docpdf/manual.pdf
res/docpdf/.venv
+res/docpdf/htmldoc/
res/furnace.appdata.xml
diff --git a/res/docpdf/make-doc-html.sh b/res/docpdf/make-doc-html.sh
index b16d7fd10..3af163f43 100755
--- a/res/docpdf/make-doc-html.sh
+++ b/res/docpdf/make-doc-html.sh
@@ -2,6 +2,10 @@
echo "compiling Furnace doc (HTML)..."
+if [ -e htmldoc ]; then
+ rm -r htmldoc
+fi
+
if [ ! -e .venv ]; then
python3 -m virtualenv .venv || exit 1
fi
@@ -14,3 +18,8 @@ if [ ! -e .venv/req_installed ]; then
fi
python3 make_htmldoc.py
+
+echo "copying assets..."
+for i in `find ../../doc -name "*.png"`; do
+ cp "$i" "htmldoc${i#../../doc}"
+done
diff --git a/res/docpdf/make_htmldoc.py b/res/docpdf/make_htmldoc.py
index 4b98baedf..5b1cf53e9 100644
--- a/res/docpdf/make_htmldoc.py
+++ b/res/docpdf/make_htmldoc.py
@@ -35,30 +35,23 @@ def fix_links(match):
if os.path.splitext(match.group(2))[-1] == '.png':
return '[%s](%s)' % (
match.group(1),
- os.path.join(os.path.split(my_file)[0], match.group(2))
+ match.group(2)
)
-
- # urls to other files
- BASE_URL = 'https://github.com/tildearrow/furnace/tree/master/'
- if match.group(2).startswith(BASE_URL):
- file_path = match.group(2).split(BASE_URL)[-1]
- if os.path.splitext(file_path)[-1] == '':
- file_path += '/README.md'
- return '[%s](#%s)' % (
- match.group(1),
- file_path.replace('/','__')
- )
-
+
# preserve external urls
elif match.group(2).startswith('http'):
return match.group(0)
+
+ elif match.group(2).endswith('README.md'):
+ return '[%s](%s)' % (
+ match.group(1),
+ match.group(2).replace('README.md','index.html')
+ )
# fix paths
- act_path = os.path.split(my_file)[0] + '/' + match.group(2)
- act_path = os.path.relpath(os.path.abspath(act_path))
- return '[%s](#%s)' % (
+ return '[%s](%s)' % (
match.group(1),
- act_path.replace(os.path.sep,'__')
+ match.group(2).replace('.md','.html')
)
def fix_headings(match):
@@ -92,6 +85,15 @@ if __name__ == "__main__":
LOGGER.info("processing file %s" % my_file)
data = md.read()
+ # retrieve path
+ pagePath = 'htmldoc' + os.path.sep + my_file[10:]
+ pagePathH = re.sub(r'\.md$','.html',pagePath).replace("README.html","index.html")
+ docDir = pagePath[:pagePath.rfind(os.path.sep)]
+ LOGGER.info("path: %s" % pagePathH)
+
+ if not os.path.exists(docDir):
+ os.makedirs(docDir)
+
# retrieve title
pageTitle = data.partition('\n')[0].replace("# ","")
@@ -100,245 +102,47 @@ if __name__ == "__main__":
data = re.sub(r'^\s*(#+)', fix_headings, data, flags=re.MULTILINE)
# convert
- html +='