diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-02-27 21:43:44 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-02-27 21:43:44 +0000 |
commit | 38c044546783fd645a03d19bfa871035df45507c (patch) | |
tree | 153d42981182dc8252980295ba81ef8d724a8fb4 /roff.h | |
parent | 13c3ceece1e58741fca2635fed585eab72c2c298 (diff) | |
download | mandoc-38c044546783fd645a03d19bfa871035df45507c.tar.gz |
Fully support explicit tagging of .Sh and .Ss.
This fixes the offset of two lines in terminal output
and this improves HTML output by putting the id= attribute
and <a> element into the respective <h1> or <h2> element rather
than writing an additional <mark> element.
To that end, introduce node flags NODE_ID (to make the node a link
target, for example by writing an HTML id= attribute or by calling
tag_put()) and NODE_HREF (to make the node a link source, used only
in HTML output, used only to write an <a class="permalink"> element).
In particular:
* In the validator, generalize the concept of the "next node"
such that it also works before .Sh and .Ss.
* If the first argument of .Tg is empty, don't forget to complain
if there are additional arguments, which will be ignored.
* In the terminal formatter, support writing of explicit tags
for all kinds of nodes, not just for .Tg.
* In deroff(), allow nodes to have an explicit string representation
even when they aren't text nodes. Use this for explicitly tagged
section headers. Suprisingly, this is sufficient to make HTML
output work, without explicit code changes in the HTML formatter.
* In syntax tree output, display NODE_ID and NODE_HREF.
Diffstat (limited to 'roff.h')
-rw-r--r-- | roff.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -522,6 +522,8 @@ struct roff_node { #define NODE_NOFILL (1 << 8) /* Fill mode switched off. */ #define NODE_NOSRC (1 << 9) /* Generated node, not in input file. */ #define NODE_NOPRT (1 << 10) /* Shall not print anything. */ +#define NODE_ID (1 << 11) /* Target for deep linking. */ +#define NODE_HREF (1 << 12) /* Link to another place in this page. */ int prev_font; /* Before entering this node. */ int aux; /* Decoded node data, type-dependent. */ enum roff_tok tok; /* Request or macro ID. */ |