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.
This test depends on a nonportable option for date(1). I am not sure
that there is a good portable way to do this, so I just directly
included the seconds since epoch that it would have computed. We're
testing scdoc, not testing the local system's date command.
This commit fixes a bug in parsing indented literal blocks. For example:
test(8)
```
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
allowed.
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.
The environment variable SOURCE_DATE_EPOCH [0] is standardized and can
be used to produce reproducible output. Distributions like Debian will
set this variable before the build and scdoc should use it (instead of
the current date) for any timestamps within the man pages.
[0]: https://reproducible-builds.org/docs/source-date-epoch/
The groff .TH title/section macro additionally supports extra arguments:
.TH title section [extra1 [extra2 [extra3]]]
Extra2 and Extra3 allow changing the left footer and central header
respectively.
Here we allow the user to specify these fields through an optional
extension to the preamble:
test(8) "LeftFooter"
test(8) "LeftFooter" "CenterHeader"
test(8) "" "CenterHeader"