| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The struct roff_man used to be a bad mixture of internal parser
state and public parsing results. Move the public results to the
parsing result struct roff_meta, which is already public. Move the
rest of struct roff_man to the parser-internal header roff_int.h.
Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.
This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.
|
|
|
|
|
|
|
|
| |
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because these work slightly differently on different systems,
they are becoming a maintenance burden in the portable version,
so delete them.
Besides, one of the chief design goals of the mandoc toolbox is to
make sure that nothing related to documentation requires C++.
Consequently, linking mandoc against any kind of C++ program would
defeat the purpose and is not supported.
I don't understand why kristaps@ added them in the first place.
|
|
|
|
|
|
|
|
| |
level, validation must be separated from parsing and rewinding.
This first big step moves calling of the mdoc(7) post_*() functions
out of the parser loop into their own mdoc_validate() pass, while
using a new mdoc_state() module to make syntax tree state handling
available to both the parser loop and the validation pass.
|
|
|
|
|
|
|
|
| |
No functional change except that for mdoc(7), it now skips leading
escape sequences just like it already did for man(7).
Escape sequences rarely occur in mdoc(7) code and if they do,
skipping them is an improvement in this context.
Minus 30 lines of code.
|
|
|
|
|
|
| |
man_node() from the mandoc(3) semi-public interface and the internal
wrapper functions print_mdoc() and print_man() from the HTML formatters.
Minus 60 lines of code, no functional change.
|
|
|
|
|
| |
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.
|
|
|
|
|
| |
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.
|
|
|
|
|
|
|
|
|
| |
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.
|
|
|
|
|
|
| |
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
it, make_pending(), which was the most difficult function of the
whole mdoc(7) parser. After almost five years of maintaining this
hellhole, i just noticed the pointer isn't needed after all.
Blocks are always rewound in the reverse order they were opened;
that even holds for broken blocks. Consequently, it is sufficient
to just mark broken blogs with the flag MDOC_BROKEN and breaking
blocks with the flag MDOC_ENDED. When rewinding, instead of iterating
the pending pointers, just iterate from each broken block to its
parents, rewinding all that are MDOC_ENDED and stopping after
processing the first ancestor that it not MDOC_BROKEN. For ENDBODY
markers, use the mdoc_node.body pointer in place of the former
mdoc_node.pending.
This also fixes an assertion failure found by jsg@ with afl,
test case #467 (Bo Bl It Bd Bc It), where (surprise surprise)
the pending pointer got corrupted.
Improved functionality, minus one function, minus one struct field,
minus 50 lines of code.
|
|
|
|
| |
Minus one struct member, minus 17 lines of code, no functional change.
|
|
|
|
|
|
| |
font stack. The latter fail after the stack is grown with realloc().
Fixing an assertion failure found by jsg@ with afl some time ago
(test case number 51).
|
|
|
|
|
|
|
| |
already closed. In this respect, also consider lists closed
that have broken another block, their closure pending until the
end of the broken block. This avoids syntax tree corruption
leading to a NULL pointer access found by jsg@ with afl.
|
| |
|
|
|
|
|
|
|
|
|
| |
In groff, .Bd -centered operates in fill mode, which is relatively
hard to implement, while this implementation operates in non-fill
mode so far. As long as you pay attention that your lines do not
overflow, it works. To make sure that rendering is the same for
mandoc and groff, it is recommended to insert .br between lines
for now. This implementation will need improvement later.
|
|
|
|
|
| |
since this is hardly more complicated than explicitly ignoring them
as we did in the past. Of course, do not use them!
|
|
|
|
|
| |
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change
|
|
|
|
|
| |
OpenBSD manuals. It describes which contexts you can call functions in.
from dlg@, ok jmc@ deraadt@
|
|
|
|
|
| |
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.
|
|
|
|
| |
instead use the .Nd content recursively.
|
|
|
|
|
|
|
|
| |
we have to compare the line where the first one *ends* (not where it begins)
to the line where the second one starts.
This fixes the bug that .Bk allowed output line breaks right after block
macros spanning more than one input line, even when the next macro follows
on the same line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The basic idea is to already pop the font at the end marker
instead of allowing it to linger until the final end of the block.
This requires a few preliminaries:
* For each block, save a pointer to the previous font
to be used in case the block breaks another and gets extended.
* That requires making node information writable during rendering.
* Now fonts may get popped in the wrong order; hence, after the stack
has already been rewound further by some block that began earlier,
ignore popping a font that was put on the stack later.
* To be able to exploit all this for font blocks, tie processing
to their body, not their block, which is more logical anyway.
Triggered by florian@ reporting vaguely similar issues with list blocks.
|
|
|
|
|
|
|
|
|
|
| |
* fix -Tman .Bl -bullet .It
* adjust the -Tascii .Bl -bullet -dash -hyphen .It
default and minimum width to new groff standards,
it changed from 4n (in groff 1.15) to 2n (in groff 1.21)
* same for -Tascii -enum, it changed from 5n to 2n
* use -hang formatting for -Tascii -enum -width 2n
* for -Tascii -enum, the default is -width 3n
|
|
|
|
|
|
|
|
|
| |
error where (1) -man pages were punctuating delimiters (e.g., `.B a ;')
and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its
own line) would also be punctuated. This introduces a small amount of
complexity of mdoc_{html,term}.c must manage their own spacing with
running print_word() or print_text(). The check for delimiting now
happens in mdoc_macro.c's dword().
|
| |
|
|
|
|
|
|
|
|
|
|
| |
stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now
used by read.c. The motivation behind this is to tighten the
relationship between the underlying compilers while keeping parse data
hidden from general callers (e.g., main.c).
While here, also move register values from mandoc.h into libmandoc.h as
noted by schwarze@. See above for explanation.
|
|
|
|
|
|
|
|
|
| |
libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the
time being in libmandoc.h. This requires struct mparse to be passed
into the allocation routines instead of mandocmsg and a void pointer.
Then, move some of the functionality of the old mmsg() into read.c's
mparse_mmsg() (check against wlevel and setting of file_status) and use
main.c's mmsg() as simply a printing tool.
|
|
|
|
|
|
|
|
|
|
|
|
| |
as a first step to get rid of the frequent petty warnings in this area:
- always store dates as strings, not as seconds since the Epoch
- for input, try the three most common formats everywhere
- for unrecognized format, just pass the date though verbatim
- when there is no date at all, still use the current date
Originally triggered by a one-line patch from Tim van der Molen,
<tbvdm at xs4all dot nl>, which is included here.
Feedback and OK on manual parts from jmc@.
"please check this in" kristaps@
|
|
|
|
| |
the adding itself is implemented; equation data is not yet shown.
|
|
|
|
|
| |
directives. For now this will just ignore them (except for -Ttree,
which just notes that an EQN's been accepted).
|
| |
|
|
|
|
|
|
| |
external-facing function mdoc_addspan(), then various bits to prohibit
printing and scanning (this requires some if's to be converted into
switch's).
|
| |
|
| |
|
|
|
|
|
| |
instead of underlined. This only happens in -Tascii, as -T[x]html both
underlines and italicises.
|
|
|
|
|
|
|
|
| |
favour of a simpler shim for normalised data in the node allocation and
free routines. This removes the need to bump and copy references within
validator handlers, removes a pointer redirect, and also kills the
refcount structure itself. Data is assumed to "live" either in a
MDOC_BLOCK or MDOC_ELEM and is copied accordingly.
|
|
|
|
|
|
|
| |
simplifies clean-up and allows for more types without extra hassle.
Also made in-line literal types in -T[x]html use CODE instead of SPAN to
match how literal blocks use PRE.
|
|
|
|
|
| |
the first step to having a simpler ref-counted system for "data"
associated with a node.
|
|
|
|
|
|
|
| |
Remove `Pp' or `Lp' if it is the FIRST or LAST child of an `Sh' or `Sh' body.
Make "skipping paragraph" be an error, not a warning, as information (an
invoked macro) is ignored.
|
|
|
|
|
| |
OL, and UL. Issue raised by Will Backman, solution proposed by
schwarze@.
|
|
|
|
| |
While I'm add it, properly document all structures in these files.
|
|
|
|
|
| |
slow process of logically splitting formatting frontend and parser backend
without pollution.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.
|
| |
|
|
|
|
| |
ok kristaps@
|
|
|
|
| |
the loops here and there to track down the MDOC_Column arguments.
|
|
|
|
| |
pointer like the other data members, as there's no need to copy it around.
|
| |
|
| |
|