build single-page version of documentation

This commit is contained in:
arvidn 2017-01-26 20:58:45 -05:00 committed by Arvid Norberg
parent cca5ab8368
commit 8ed3a95fa8
6 changed files with 41 additions and 8 deletions

View File

@ -102,7 +102,8 @@ DOCS_PAGES = \
docs/reference-Settings.html \
docs/reference-Storage.html \
docs/reference-Utility.html \
docs/reference.html
docs/reference.html \
docs/single-page-ref.html
ED25519_SOURCE = \
ed25519/readme.md \

View File

@ -987,6 +987,8 @@ reference documentation
''')
out.write('`single-page version`__\n\n__ single-page-ref.html\n\n')
for i in range(4):
out.write('.. container:: main-toc\n\n')

25
docs/join_rst.py Normal file
View File

@ -0,0 +1,25 @@
#!/bin/python
import sys
# no processing of the first file
sys.stdout.write(open(sys.argv[1], 'r').read())
sys.stderr.write('joining %s\n' % sys.argv[1])
for name in sys.argv[2:]:
sys.stdout.write('\n')
sys.stderr.write('joining %s\n' % name)
f = open(name, 'r')
for l in f:
# strip out the table of contents from subsequent files
if '.. contents::' in l:
in_directive = True
continue
if ':Author:' in l: continue
if ':Version:' in l: continue
if l[0] in ' \t' and in_directive:
continue
in_directive = False
sys.stdout.write(l)

View File

@ -1,14 +1,16 @@
# this makefile assumes that you have docutils and rst2pdf installed
# (python-docutils) as well as aafigure (python-aafigure)
ifneq ($(STAGE),)
WEB_PATH = ~/Documents/rasterbar/web/products/libtorrent
endif
ifndef RST2HTML
RST2HTML:=rst2html-3.4.py
RST2HTML:=rst2html
endif
REFERENCE_TARGETS = \
manual-ref \
reference \
reference-Core \
reference-Plugins \
@ -22,8 +24,7 @@ REFERENCE_TARGETS = \
reference-Filter \
reference-Settings \
reference-Bdecoding \
reference-ed25519 \
manual-ref
reference-ed25519
TARGETS = index \
udp_tracker_protocol \
@ -45,6 +46,7 @@ TARGETS = index \
hacking \
streaming \
tutorial \
single-page-ref \
$(REFERENCE_TARGETS)
FIGURES = \
@ -66,6 +68,9 @@ epub: $(TARGETS:=.epub) $(FIGURES:=.png)
all: html pdf
single-page-ref.rst: $(REFERENCE_TARGETS:=.rst)
python join_rst.py $(filter-out reference.rst, $(REFERENCE_TARGETS:=.rst)) >single-page-ref.rst
settings.rst: ../include/libtorrent/settings_pack.hpp
python gen_settings_doc.py

View File

@ -21,10 +21,10 @@
</style>
%(body_prefix)s
<div id="container">
<table id="header">
<a href="index.html"><table id="header">
<tr><td id="orange"></td>
<td id="logo">libtorrent</td></tr>
</table>
</table></a>
<div id="main">
%(body_pre_docinfo)s
%(docinfo)s

View File

@ -21,10 +21,10 @@
</style>
%(body_prefix)s
<div id="container">
<table id="header">
<a href="index.html"><table id="header">
<tr><td id="orange"></td>
<td id="logo">libtorrent</td></tr>
</table>
</table></a>
<div id="main">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" type="text/javascript"></script>