2b945828e88657fbd71e6ecd13e89897877a31c9 — Страхиња Радић 6 days ago 0ff23c0
Added id attributes in headings

Signed-off-by: Страхиња Радић <contact@strahinja.org>
4 files changed, 20 insertions(+), 12 deletions(-)

M index.html
M slweb.1.in
M slweb.c
M TODO => TODO +2 -0
@@ 20,6 20,8 @@

        [x] Add horizontal rule support

        [ ] Investigate multiline links


M index.html => index.html +8 -8
@@ 28,12 28,12 @@
<h1 id="heading-1">slweb</h1>

<p><strong>Slweb</strong> is a static website generator which aims at being simplistic. It
transforms custom Markdown-like syntax into HTML.</p>

<h2 id="heading-2">Prerequisites</h2>

<p>Aside from the obvious (a C compiler, by default <strong>GNU C</strong>), slweb requires GNU
<a href="https://www.gnu.org/software/libunistring/">libunistring</a>, <strong>realpath</strong>(1) to determine paths in local links

@@ 42,7 42,7 @@ and <strong>groff</strong>(1) and <strong>gzip</strong>(1) to create and compres
<code>{git-log}</code>. <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext>KaTeX</mtext></mrow><annotation encoding="application/x-tex">\KaTeX</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.89883em;vertical-align:-0.2155em;"></span><span class="mord text"><span class="mord textrm">K</span><span class="mspace" style="margin-right:-0.17em;"></span><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.68333em;"><span style="top:-2.904999em;"><span class="pstrut" style="height:2.7em;"></span><span class="mord"><span class="mord textrm mtight sizing reset-size6 size3">A</span></span></span></span></span></span><span class="mspace" style="margin-right:-0.15em;"></span><span class="mord text"><span class="mord textrm">T</span><span class="mspace" style="margin-right:-0.1667em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.46782999999999997em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord textrm">E</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.125em;"></span><span class="mord textrm">X</span></span></span></span></span></span> (<a href="https://katex.org">https://katex.org</a>) is optionally used for math

<h2 id="heading-3">Install</h2>

$ git clone https://git.sr.ht/~strahinja/slweb

@@ 73,7 73,7 @@ $ SLWEB_CC=tcc redo -j10
<p>In the case of <strong>tcc</strong>, the tradeoff is that the debug information is limited
compared to <strong>gcc</strong>, but the compilation time is significantly shorter.</p>

<h2 id="heading-4">Examples</h2>

<p>See the <a href="https://git.sr.ht/~strahinja/slweb/tree/master/item/examples"><code>examples/</code></a> directory in this repository.</p>

@@ 123,18 123,18 @@ $ slweb index.slw > index.html

<h2>TODO (checklist)</h2>
<h2 id="heading-5">TODO (checklist)</h2>

<p>See the file <a href="https://git.sr.ht/~strahinja/slweb/tree/master/item/TODO"><code>TODO</code></a> for more information.</p>

<h2>Bugs and limitations</h2>
<h2 id="heading-6">Bugs and limitations</h2>

<p>Bugs can be reported using the <a href="https://sr.ht/~strahinja/slweb/trackers">ticket tracker</a>. See the manpage (<code>man
slweb</code>) after installing <strong>slweb</strong> for more information.</p>

<h2 id="heading-7">License</h2>

<p>slweb - Simple static website generator.<br /> 
Copyright (C) 2020, 2021 Страхиња Радић</p>

@@ 153,7 153,7 @@ this program. If not, see &lt;<a href="https://www.gnu.org/licenses">https://www

<div id="git-log">
Previous commit:
index.slw d15fcda 2021-03-29 09:52:46 +0200 (Страхиња Радић)  (HEAD -> master)
index.slw 0ff23c0 2021-04-07 15:32:22 +0200 (Страхиња Радић)  (HEAD -> master, origin/master, origin/HEAD)

M slweb.1.in => slweb.1.in +3 -1
@@ 206,7 206,9 @@ encounters both footnote types in the same document, a warning will be issued to
.BR Headings .
A line starting with \fC#\fP followed by space will be put inside
\fC<h?></h?>\fP, where \fC?\fP stands for 1-4, depending on the number of
hash signs.
hash signs. Tags will have \fCid\fP attributes set to \fCh\f[CI]?\fR, with
\f[CI]?\fP set to the number representing its position within the list of all
.IP \[bu]
.BR "Horizontal rules" .

M slweb.c => slweb.c +7 -3
@@ 483,9 483,10 @@ print_meta_var(FILE* output, uint8_t** csv_header, uint8_t** csv_register)

process_heading_start(FILE* output, UBYTE heading_level)
process_heading_start(FILE* output, UBYTE heading_level, ULONG* heading_count)
    print_output(output, "<h%d>", heading_level);
    print_output(output, "<h%d id=\"heading-%lu\">", heading_level, *heading_count);
    output_firstcol = FALSE;
    return 0;

@@ 2190,6 2191,7 @@ slweb_parse(uint8_t* buffer, FILE* output, BOOL body_only,
    size_t link_size                   = 0;
    uint8_t* link_macro                = NULL;
    UBYTE heading_level                = 0;
    ULONG heading_count                = 0;
    BOOL end_tag                       = FALSE;
    BOOL first_line_in_doc             = TRUE;
    BOOL skip_change_first_line_in_doc = FALSE;

@@ 2235,6 2237,7 @@ slweb_parse(uint8_t* buffer, FILE* output, BOOL body_only,
    plinks = links;
    pfootnotes = footnotes;
    lineno = 0;
    heading_count = 0;

    if (!read_yaml_macros_and_links && !body_only)

@@ 2793,7 2796,8 @@ slweb_parse(uint8_t* buffer, FILE* output, BOOL body_only,
                if ((state & ST_HEADING) && !(state & ST_HEADING_TEXT))
                    if (!read_yaml_macros_and_links)
                        process_heading_start(output, heading_level);
                        process_heading_start(output, heading_level,
                    state |= ST_HEADING_TEXT;