diff options
author | Norbert Preining <norbert@preining.info> | 2020-09-20 03:03:26 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-09-20 03:03:26 +0000 |
commit | 1f457376b478257b88d4a857f5ec1b6155442dd7 (patch) | |
tree | 2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/htmlbook.ctr | |
parent | ac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff) |
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/htmlbook.ctr')
-rw-r--r-- | support/dktools/htmlbook.ctr | 127 |
1 files changed, 117 insertions, 10 deletions
diff --git a/support/dktools/htmlbook.ctr b/support/dktools/htmlbook.ctr index fd679bcad8..3482de7cd7 100644 --- a/support/dktools/htmlbook.ctr +++ b/support/dktools/htmlbook.ctr @@ -2,7 +2,7 @@ copyright owner = Dirk Krause copyright year = 2013-xxxx -license = bsd +SPDX-License-Identifier: BSD-3-Clause @@ -14,6 +14,23 @@ license = bsd +/** HTML standard to use. +*/ +enum { + HTML_DOCTYPE_UNSPECIFIED = -1 , /**< No information about doctype. */ + HTML_DOCTYPE_NONE , /**< No HTML doctype. */ + HTML_DOCTYPE_5 , /**< HTML 5. */ + HTML_DOCTYPE_401_STRICT , /**< HTML 4.01 strict. */ + HTML_DOCTYPE_401_TRANSITIONAL , /**< HTML 4.01 transitional. */ + HTML_DOCTYPE_401_FRAMESET , /**< HTML 4.01 with framesets. */ + HTML_DOCTYPE_X10_STRICT , /**< XHTML 1.0 strict. */ + HTML_DOCTYPE_X10_TRANSITIONAL , /**< XHTML 1.0 transitional. */ + HTML_DOCTYPE_X10_FRAMESET , /**< XHTML 1.0 frameset. */ + HTML_DOCTYPE_X11 /**< XHTML 1.1. */ +}; + + + /** Image dimension cache entry. */ typedef struct { @@ -29,10 +46,19 @@ typedef struct { typedef struct { dkChar *url; /**< Link URL. */ unsigned long lno; /**< Link number within current page. */ + int flags; /**< Flags for link. */ } hb_link_t; +/** Flags for link, used for the flags field in the hb_link_t type. +*/ +enum { + /** Script fle needs async flag. + */ + LINK_FLAG_SCRIPT_ASYNC = 0x0001 +}; + /** One contents line. */ typedef struct { @@ -70,7 +96,7 @@ struct hb__node_t { dkChar *fulltitle; /**< Full title (browser title bar). */ dkChar *filename; /**< Text file name (optional). */ dkChar *suffix; /**< Output file name suffix (opt). */ - dkChar *template; /**< Template file name (optional). */ + dkChar *templatefi; /**< Template file name (optional). */ dkChar *stylefile; /**< Style file. */ dkChar *author; /**< Name of author. */ dkChar *location; /**< Location (city) of author. */ @@ -98,6 +124,7 @@ struct hb__node_t { int tocstate; /**< State when creating TOC. */ int inenc; /**< Text file input encoding. */ int havenavimenu; /**< Flag: Already have navi menu. */ + int htdt; /**< HTML doctype. */ }; /** One node in the document tree. @@ -126,6 +153,7 @@ typedef struct { The tree structure is below the rootnode element. */ typedef struct { + char elmbuf[8*sizeof(dk3_um_t)]; /**< Buffer. */ dk3_tm_t starttime; /**< Start time. */ dk3_app_t *app; /**< Application structure. */ dkChar const * const *msg; /**< Localized messages. */ @@ -146,6 +174,7 @@ typedef struct { hb_node_t *rootnode; /**< Root node. */ hb_node_t *currentnode; /**< Current node to modify. */ hb_node_t *impressumnode; /**< Impressum node. */ + hb_node_t *privacynode; /**< Privacy statement node. */ hb_node_t *firstnode; /**< First pnode. */ hb_node_t *lastnode; /**< Last pnode. */ dkChar const *infilename; /**< Input file name (project). */ @@ -154,7 +183,10 @@ typedef struct { dkChar const *url; /**< URL to publish the results. */ dkChar const *indexfile; /**< Typically index html. */ dkChar const *impressumlink; /**< Link to impressum. */ + dkChar const *privacylink; /**< Link to privacy statement. */ dkChar const *chmlang; /**< Language setting for CHM. */ + dkChar const *htmllang; /**< Language setting for HTML. */ + dkChar const *ptocjsfile; /**< Page TOC JS file (allocated). */ dkChar *shipbuffer; /**< Shipout buffer. */ dkChar *iltemplate; /**< Input line from template. */ dkChar *ilfile; /**< Input line from file. */ @@ -164,6 +196,7 @@ typedef struct { unsigned long lineno; /**< Line number. */ unsigned long nextobj; /**< Next object number. */ unsigned long npobjs; /**< Number of printable objects. */ + unsigned long elmchr; /**< External link marker. */ size_t bs; /**< Buffer size. */ size_t spused; /**< Number elements used in special. */ size_t shipused; /**< Shipout buffer used. */ @@ -179,6 +212,11 @@ typedef struct { int headlevels; /**< Maximum depth to print header. */ int coli; /**< Current code line number. */ int cols; /**< Code line state. */ + int markel; /**< Flag: Mark external links. */ + int tabsum; /**< Flag: Create table summaries. */ + int svgwhdef; /**< Flag: Default svgwh value. */ + int htdt; /**< HTML doctype. */ + int ptocjsused; /**< Flag: ptoc js file used. */ } hb_job_t; @@ -222,6 +260,10 @@ typedef struct { */ #define HB_NODE_OPT_STOP_JS_INHERITANCE 0x0020U +/** Indicate the privacy node. +*/ +#define HB_NODE_OPT_PRIVACY 0x0040U + /**@}*/ @@ -269,6 +311,10 @@ typedef struct { */ #define HB_JOB_OPT_CODE_LINE_NUMBERS 0x0200U +/** Fold and unfold page table of contents. +*/ +#define HB_JOB_OPT_FOLD_PTOC 0x0400U + /**@}*/ @@ -387,6 +433,8 @@ typedef struct { Options: */ +#include "dk3unused.h" + $!trace-include @@ -577,6 +625,11 @@ The options section contains ``key=value'' lines for the following keys: impressum page Name of text file for impressum (you can use either impressum link or impressum page). + privacy link URL to privacy statement. + + privacy page Name of text file for privacy statement (you + can use either privacy link or privacy page). + chm Flag: Create HTML to produce a CHM file later. chm language Language setting for CHM project @@ -1343,6 +1396,36 @@ Syntax error, value required! Overwriting previous setting for ``meta description''! Overwriting previous setting for ``meta keywords''! Overwriting previous setting for ``location''! +# +# 100 101 +# +Syntax error, not a hexadecimal number! +Mathematical overflow, maximum number is FFFFFF! +# +# 102 +# +Syntax error, illegal doctype! +# +# 103 +# +Overwriting doctype. +# +# 104 Node name for privacy statement +# +Privacy +# +# 105 Link title for privacy statement +# +Privacy statement +# +# 106 Text "Page content" +# +Page content: +# +# 107, 108 +# +[show] +[hide] $!end }; @@ -1392,6 +1475,7 @@ hb_job_init( ) { $? "+ hb_job_init" + job->elmbuf[0] = '\0'; job->app = app; job->msg = msg; job->kwnl = kwnl; @@ -1411,6 +1495,7 @@ hb_job_init( job->rootnode = NULL; job->currentnode = NULL; job->impressumnode = NULL; + job->privacynode = NULL; job->firstnode = NULL; job->lastnode = NULL; job->infilename = NULL; @@ -1419,7 +1504,10 @@ hb_job_init( job->url = NULL; job->indexfile = NULL; job->impressumlink = NULL; + job->privacylink = NULL; job->chmlang = NULL; + job->htmllang = NULL; + job->ptocjsfile = NULL; job->shipbuffer = NULL; job->iltemplate = NULL; job->ilfile = NULL; @@ -1429,6 +1517,7 @@ hb_job_init( job->lineno = 0UL; job->nextobj = 0UL; job->npobjs = 0UL; + job->elmchr = 0x01F310UL; job->spused = 0; job->shipused = 0; job->options = HB_JOB_OPT_CREATE_TOC; @@ -1456,6 +1545,12 @@ hb_job_init( #else job->headlevels = 32767; #endif + job->markel = 1; + job->tabsum = 0; + job->svgwhdef = 1; + job->htdt = HTML_DOCTYPE_UNSPECIFIED; + job->ptocjsused = 0; + hbconf_write_external_marker_character(job); $? "- hb_job_init" } @@ -1561,7 +1656,10 @@ hb_job_end(hb_job_t *job) dk3_release(job->outputscript); dk3_release(job->url); dk3_release(job->impressumlink); + dk3_release(job->privacylink); dk3_release(job->chmlang); + dk3_release(job->htmllang); + dk3_release(job->ptocjsfile); dk3_release(job->indexfile); dk3_release(job->shipbuffer); dk3_release(job->iltemplate); @@ -1570,6 +1668,7 @@ hb_job_end(hb_job_t *job) dk3_release(job->buffer32); job->impressumnode = NULL; + job->privacynode = NULL; $? "- hb_job_end" } @@ -1717,10 +1816,11 @@ hb_help_version_license(hb_job_t *job) */ static int -hb_file_name_compare(void const *l, void const *r, int cr) +hb_file_name_compare(void const *l, void const *r, int DK3_ARG_UNUSED(cr) ) { int back = 0; $? "+ hb_file_name_compare PTR=%d PTR=%d", TR_IPTR(l), TR_IPTR(r) + DK3_UNUSED_ARG(cr) if(l) { if(r) { back = dk3str_fncmp((dkChar const *)l, (dkChar const *)r); @@ -1747,10 +1847,11 @@ hb_file_name_compare(void const *l, void const *r, int cr) */ static int -hb_compare_strings(void const *l, void const *r, int cr) +hb_compare_strings(void const *l, void const *r, int DK3_ARG_UNUSED(cr) ) { int back = 0; $? "+ hb_compare_strings PTR=%d PTR=%d", TR_IPTR(l), TR_IPTR(r) + DK3_UNUSED_ARG(cr) if(l) { if(r) { back = dk3str_cmp((dkChar const *)l, (dkChar const *)r); @@ -2150,7 +2251,7 @@ hb_read_variables(hb_job_t *job) if(p2) { dk3str_chomp(p1, NULL); dk3str_chomp(p2, NULL); - kvp = dk3sto_it_find_like( + kvp = (dk3_key_value_t *)dk3sto_it_find_like( (job->rootnode)->i_variables, p1, 1 ); if(kvp) { @@ -2173,7 +2274,7 @@ hb_read_variables(hb_job_t *job) } } } else { - kvp = dk3sto_it_find_like( + kvp = (dk3_key_value_t *)dk3sto_it_find_like( (job->rootnode)->i_variables, p1, 1 ); if(kvp) { @@ -2253,9 +2354,9 @@ hb_write_html_files(hb_job_t *job) $? "+ hb_write_html_files" p = c = n = NULL; dk3sto_it_reset(job->i_pnodes); - c = dk3sto_it_next(job->i_pnodes); + c = (hb_node_t *)dk3sto_it_next(job->i_pnodes); while(c) { - n = dk3sto_it_next(job->i_pnodes); + n = (hb_node_t *)dk3sto_it_next(job->i_pnodes); if(0UL != c->objno) { hbhtml_write_file(job, c, p, n); } @@ -2508,9 +2609,15 @@ hb_write_script(hb_job_t *job) */ hb_write_script_copy_file(job, fn); } + /* JS file to fold and unfold page toc. + */ + if ((NULL != job->ptocjsfile) && (0 != job->ptocjsused)) { + hb_write_script_copy_file(job, job->ptocjsfile); + } /* For CHM projects copy index.hhp, index.hhc and index.hhk */ if ((job->options) & HB_JOB_OPT_CHM) { + $? ". in chm mode" hb_write_script_copy_file(job, hb_kwnl[36]); hb_write_script_copy_file(job, hb_kwnl[26]); hb_write_script_copy_file(job, hb_kwnl[28]); @@ -2714,7 +2821,7 @@ hb_check_data(hb_job_t *job) job->lastnode = nptr; nptr->pobjno = job->npobjs; job->npobjs += 1UL; - if(!hbconf_node_template(job, nptr)) { + if(!hbconf_node_template(nptr)) { back = 0; /* ERROR: No template for node! */ dk3app_set_source_line(job->app, nptr->lineno); @@ -2831,7 +2938,7 @@ DK3_MAIN dk3_time_t timer; /* Current time */ int exv = 1; /* Exit status code */ - $!trace-init htmlbook.deb + $!trace-init /tmp/htmlbook.deb $? "+ main" #if DK3_HAVE_TZSET tzset(); |