scdoc/src/main.c -rw-r--r-- 17.3 KiB
Escape ' at the beginning of lines
Cast ctype.h inputs to unsigned char

Fuckings to glibc, jesus christ that code was a nightmare

Read glibc's ctype.h and then compare it to musl's src/ctype/isalpha.c
Suppress sentence spacing after end-of-sentence characters.

This should fix the inconsistent spacing issue mentioned in [1]. I also
fixed a spacing in issue in the man page.

[1]: https://lists.sr.ht/~sircmpwn/public-inbox/%3CC4VKFSIFINOA.X6VCIU2AV88M%40szk%3E
0917856a — Damien Tardy-Panis 1 year, 3 months ago
Fix parsing of line breaks followed by underlined text
da7d5e6c — Damien Tardy-Panis 1 year, 3 months ago
Fix parsing of line breaks without newline
baaebab7 — Damien Tardy-Panis 1 year, 6 months ago
Allow subsection in preamble

Subsections are useful in case on name conflicts within a section.
Typically man pages in distributions are using the 'p' subsection.
They are also needed for the man pages of wrapper commands for example.
656484e0 — Damien Tardy-Panis 1 year, 6 months ago
Section needs to be explicitly defined

The absence of value between the section parentheses resulted in the
section being 0 (header files), which is unlikely to be the one wanted
Expand preamble written to man page output
Replace str_t with struct str
tables: add expand options
5c782cda — Zandr Martin 2 years ago 1.9.7
fix bug preventing indented literal blocks

This commit fixes a bug in parsing indented literal blocks. For example:


	This is a block

Prior to this commit, this would fail, but with an unexpected error
message: "Error at 4:3: Cannot deindent in literal block". The
indentation was being parsed at every character, so the parser saw the
`T`, then parsed indentation again. The indentation was 0 (since there
were no tab characters between the `T` and the `h`), but the block
started with an indentation level of 1. 0 < 1, so this would be
considered a dedent, which is not allowed.

This commit introduces a new local variable, `check_indent`, which
controls whether the parser tries to parse indentation or not; now
indentation is only parsed when the last character was a newline. From
my testing this seems to fix the issue - indented literal blocks are now
053c7705 — Zandr Martin 2 years ago
remove unnecessary `closed` variable in parse_list

This local variable was initialized to `false` and never set to true
anywhere in the function.
Fix regression with manual name check
0c26abe0 — Zandr Martin 2 years ago
enforce 1-step indentation

Allow multi-step indentation in literal blocks, and allow multi-step
Revert "fix enforcement of 1-step indentation"

This reverts commit 8c537aa2956a55fe341e1d48110ae6985ada7e5f.
8c537aa2 — Zandr Martin 2 years ago
fix enforcement of 1-step indentation
f7fb0700 — Zandr Martin 2 years ago
disallow invalid name characters

This commit makes using invalid characters in the name a fatal error.
Before this patch, "foo | bar(1)" would parse as "foobar(1)". Now it is
a fatal error and parsing stops.
parse_text: return if next is UTF8_INVALID

In the underscore case, the next character is retrieved to check
whether the underscore is at a word break. However, if this character
is UTF8_INVALID, the call to parser_pushch will be a noop. This
results in the loop continuing on further than it should. This just
adds a check to see if next is UTF8_INVALID and returns if it is.

Signed-off-by: Brian Ashworth <bosrsf04@gmail.com>
f1db2e16 — Carlo Abelli 2 years ago
fix underscores in underlined words

Currently, the first underscore encountered while underlining ends
underlining. As a result, underscores in underlined words are not
ignored e.g. _hello_world_ does not parse correctly.

This checks the next character to see if it is still in a word before
ending underlining.
Replace localtime with gmtime

The localtime() function gives the time relative to the users time.
This makes the generated manpage non reproducible. gmtime() gives
the time as UTC.