SRCS-yes += src/docs.c
I18N-C-DOCS = src/docs_inc.c
I18N-DOCS = $(wildcard docs/markdown/*.md)
+I18N-DOCS += $(wildcard docs/markdown/inc/*.md)
I18N-DOCS += $(wildcard docs/class/*.md)
I18N-DOCS += $(wildcard docs/property/*.md)
I18N-DOCS += $(wildcard docs/wizard/*.md)
MD-ROOT = $(patsubst docs/markdown/%.md,%,$(wildcard docs/markdown/*.md))
+MD-ROOT += $(patsubst docs/markdown/inc/%.md,inc/%,$(wildcard docs/markdown/inc/*.md))
MD-CLASS = $(patsubst docs/class/%.md,%,$(wildcard docs/class/*.md))
MD-PROP = $(patsubst docs/property/%.md,%,$(wildcard docs/property/*.md))
MD-WIZARD = $(patsubst docs/wizard/%.md,%,$(wildcard docs/wizard/*.md))
$(MD-TO-C) --in="docs/wizard/$${i}.md" \
--name="tvh_doc_wizard_$${i}" >> src/docs_inc.c || exit 1; \
done
- @printf "\n\nconst struct tvh_doc_page tvh_doc_markdown_pages[] = {\n" >> src/docs_inc.c
- @for i in $(MD-ROOT); do \
- echo " { \"$${i}\", tvh_doc_root_$${i} }," >> src/docs_inc.c || exit 1; \
- done
- @echo " { NULL, NULL }," >> src/docs_inc.c || exit 1
- @echo "};" >> src/docs_inc.c
+ @$(MD-TO-C) --pages="$(MD-ROOT)" >> src/docs_inc.c
@touch $@
src/docs_inc.c: $(BUILDDIR)/docs-timestamp
---
-###Menu Bar/Buttons
-
-The tab has the following buttons:
-
-Button | Function
------------------------|-------------------
-**Save** | Save any changes made to the grid/entries.
-**Undo** | Revert any changes made since the last save.
-**Add** | Display the *Add IP Blocking Record* dialog.
-**Delete** | Delete the selected entry/entries.
-**Edit** | Edit the selected entry.
-**View Level**| Change the interface view level to show/hide more advanced options.
-**Help** | Display this help page.
+<tvh_include>inc/buttons1</tvh_include>
---
-###Adding and Editing an Entry/Record
-
-To add an entry press the *[Add]* button from the menu bar.
-
-To edit an entry highlight the desired entry within the grid, and
-then press the *[Edit]* button from the menu bar.
+<tvh_include>inc/add1</tvh_include>
-
-
-Note that both the *[Add]* and *[Edit]* buttons display similar dialogs.
+
**Tip**: You can enter a comma-separated list of network prefixes, if you're
unsure as to what to enter in the *Network prefix* field take a look at
---
-### Deleting an Entry.
-
-To delete an entry highlight (select) the entry from the grid, then press
-the *[Delete]* button from the menu bar.
-
-**Tip**: Rather than deleting an entry, you can disable it instead by
-pressing the *[Edit]* button, and unticking the "Enabled" check box.
+<tvh_include>inc/del1</tvh_include>
---
--- /dev/null
+###Adding and Editing an Entry/Record
+
+To add an entry press the *[Add]* button from the menu bar.
+
+To edit an entry highlight the desired entry within the grid, and
+then press the *[Edit]* button from the menu bar.
+
+Note that both the *[Add]* and *[Edit]* buttons display similar dialogs.
--- /dev/null
+###Menu Bar/Buttons
+
+The tab has the following buttons:
+
+Button | Function
+-----------------------|-------------------
+**Save** | Save any changes made to the grid/entries.
+**Undo** | Revert any changes made since the last save.
+**Add** | Display the *Add entry* dialog.
+**Delete** | Delete the selected entry/entries.
+**Edit** | Edit the selected entry.
+**View Level** | Change the interface view level to show/hide more advanced options.
+**Help** | Display this help page.
--- /dev/null
+### Deleting an Entry.
+
+To delete an entry highlight (select) the entry from the grid, then press
+the *[Delete]* button from the menu bar.
+
+**Tip**: Rather than deleting an entry, you can disable it instead by
+pressing the *[Edit]* button, and unticking the "Enabled" check box.
#define LANGPREF "\xff\x01"
#define DOCINCPREF "\xff\x02"
#define ITEMSINCPREF "\xff\x03"
+#define MDINCLUDE "\xff\x04"
#define N_(s) s
#include "docs_inc.c"
#include "http.h"
#include "docs.h"
+static int md_doc(htsbuf_queue_t *hq, const char **doc, const char *lang, int nl);
static int md_class(htsbuf_queue_t *hq, const char *clazz, const char *lang,
int hdr, int docs, int props);
static void
md_render(htsbuf_queue_t *hq, const char *doc, const char *lang)
{
+ const struct tvh_doc_page *page;
if (doc[0] == '\xff') {
switch (doc[1]) {
case 1:
case 3:
md_class(hq, doc + 2, lang, 0, 0, 1);
break;
+ case 4:
+ for (page = tvh_doc_markdown_pages; page->name; page++)
+ if (!strcmp(page->name, doc + 2)) {
+ if (page->strings)
+ md_doc(hq, page->strings, lang, 0);
+ break;
+ }
+ break;
}
} else {
htsbuf_append_str(hq, doc);
if a: return a
a = self.extra_cmd(text, 'tvh_class_items', 'i')
if a: return a
+ a = self.extra_cmd(text, 'tvh_include', 'I')
+ if a: return a
fatal('Block HTML not allowed: ' + repr(text))
def inline_html(self, text):
if x: r += lang(x)
x = ''
n += t
- elif type == 'd' or type == 'i':
+ elif type in ['d', 'i', 'I']:
if n: r += nolang(n)
if x: r += lang(x)
n = ''
x = ''
if type == 'd':
r += 'DOCINCPREF "' + t + '",\n'
- else:
+ elif type == 'i':
r += 'ITEMSINCPREF "' + t + '",\n'
+ else:
+ r += 'MDINCLUDE "' + t + '",\n'
text = text[p+l+1:]
if x: r += lang(x)
x = ''
#
#
+def dopages(pages):
+ print("\n\nconst struct tvh_doc_page tvh_doc_markdown_pages[] = {")
+ for page in pages.split(' '):
+ if not page: continue
+ print(" { \"%s\", tvh_doc_root_%s }," % (page, page.replace('/', '_')))
+ print(" { NULL, NULL },")
+ print("};")
+
+#
+#
+#
+
def fatal(msg):
sys.stderr.write('FATAL: ' + msg + '\n')
sys.exit(1)
HUMAN=argv_get('human')
DEBUG=argv_get('debug')
+pages = argv_get('pages')
+if pages:
+ dopages(pages)
+ sys.exit(0)
input = argv_get('in')
if not input:
fatal('Specify input file.')
name = argv_get('name')
if not name:
fatal('Specify class name.')
+name = name.replace('/', '_')
fp = utf8open(input, 'r')
text = fp.read(1024*1024*2)