| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
they were already supported in the past
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function has always been among the most complicated parts of
mandoc, and it repeatedly needed substantial functional enhancements.
The present rewrite is required to prepare for the implementation
of simultaneous filling and centering of output lines.
The previous implementation looked at each word in turn and printed
it to the output stream as soon as it was found to still fit on the
current output line. Obviously, that approach neither allows
centering nor adjustment to the right margin.
The new implementation first decides which part of the paragraph
to put onto the current output line, also measuring the display
width of that part, even if that part consists of multiple words
including intervening whitespace. This will allow moving the whole
output line to the right as desired before printing it, for example
to center it or to adjust it to the right margin.
The function is split into three parts, each much shorter, solving a
better defined task, much easier to understand and better commented:
1. the steering function term_flushln() looping over output lines;
2. the calculation function term_fill() looping over input characters;
3. and the output function term_field() looping over printed characters.
No functional change yet.
|
|
|
|
|
|
| |
feature improvement suggested by kn@.
While here, also make "-O value" work from standard input.
OK kn@
|
|
|
|
|
|
| |
that children and later siblings get correct NODE_NOFILL assignments.
This doesn't change rendering yet but prepares for future rendering
improvements.
|
| |
|
|
|
|
|
|
|
| |
rather than in the man(7) parser and formatters, document them in the
roff(7) manual, where they belong, rather than in the man(7) manual.
Mention that they imply an output line break, and mention which macros
imply these requests.
|
| |
|
|
|
|
|
| |
Delete the complicated mechanism keeping fill mode state locally in
the man(7) HTML formatter. Instead, use the state stored in the nodes.
|
|
|
|
|
|
|
|
|
|
| |
Stop trying to keep fill mode state locally in the mdoc HTML formatter,
rely on the state stored in the nodes instead.
Note that the .Bd -literal code is buggy. Nested literal displays
result in nested <pre> elements, which violates HTML syntax.
But i'm not yet fixing bugs in this commit, i'm merely deleting
code which has no effect.
|
|
|
|
|
|
| |
Since the man(7) and roff(7) validators no longer use the parser
state flag ROFF_NOFILL, we can finally get rid of the function
man_state(), resulting in a better separation of parsing and validation.
|
| |
|
|
|
|
| |
related to man_validate.c rev. 1.145
|
|
|
|
|
|
| |
simpler and always more robust. In particular, move the nesting
warnings for .EX and .EE from man_state(), where they were misplaced,
to the man(7) validator.
|
|
|
|
|
|
| |
like it is already done with NODE_SYNPRETTY, such that the fill
mode becomes more directly available to the formatters.
Not used yet, but will be used by upcoming commits.
|
|
|
|
|
|
| |
macro parsing function, in the same way as the roff parser already
does it for the .nf and .fi requests. This is a preparation for
getting rid of the ugly function man_state() later on.
|
|
|
|
|
|
| |
Use the new parser flag ROFF_NOFILL in the mdoc(7) parser, too,
instead of the old MDOC_LITERAL, which was an alias for the
former MAN_LITERAL.
|
|
|
|
|
|
| |
parser to the roff(7) parser. As a side effect, .nf and .fi are
now also parsed in mdoc(7) input, though the mdoc(7) formatters
still ignore most of their effect.
|
|
|
|
|
|
|
|
|
| |
Simplify the way the man(7) and mdoc(7) validators are called.
Reset the parser state with a common function before calling them.
There is no need to again reset the parser state afterwards,
the parsers are no longer used after validation.
This allows getting rid of man_node_validate() and mdoc_node_validate()
as separate functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
since these may not be commonly known utilities;
idea from and joint work with tedu@
CV: ----------------------------------------------------------------------
|
|
|
|
| |
for .Bl -bullet -compact -offset indent
|
|
|
|
| |
from tedu@
|
|
|
|
|
|
| |
since these are clearly commands in a domain-specific language. As
a nice side effect, the resulting list allows including the synopsis
for each macro in the item head, reducing some repetitive verbiage.
|
|
|
|
|
|
| |
The macros .Ql, .Dl, and .Bd -literal leave no room for any
valid use case for .Li whatsoever.
General direction discussed with jmc@.
|
|
|
|
|
| |
Simplicity matters, and fewer macros is simpler.
OK jmc@
|
|
|
|
| |
Simplified version of a bugfix patch from rapha@.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
struct as an argument such that after copy-in, it can call roff_expand()
once again, which used to be called roff_res() before this. This
fixes a subtle low-level roff(7) parsing bug reported by Fabio
Scotoni <fabio at esse dot ch> in the 4.4BSD-Lite2 mdoc.samples(7)
manual page, because that page used an escaped escape sequence in
a macro argument.
To expand escaped escape sequences in quoted mdoc(7) arguments, too,
stop bypassing the call to roff_getarg() in mdoc_argv.c, function args()
for this case. This does not solve the case of escaped escape sequences
in quoted .Bl -column phrases yet.
Because roff_expand() can make the string longer, roff_getarg() can no
longer operate in-place but needs to malloc(3) the returned string.
In the high-level parsers, free(3) that string after processing it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mparse_open() to the caller. That is better because only the caller
knows its preferred reporting method and format and only the caller
has access to all the data that should be included - like the column
number in .so processing or the current manpath in makewhatis(8).
Moving the mandoc_msg() call out is possible because the caller can
call strerror(3) just as easily as mparse_open() can.
Move mandoc_msg_setinfilename() closer to the parsing of the file
contents, to avoid problems *with* the file (like non-existence,
lack of permissions, etc.) getting misreported as problems *in*
the file.
Fix the column number reported for .so failure:
let it point to the beginning of the filename.
Taken together, this prevents makewhatis(8) from spewing confusing
messages about .so failures to stderr, a bug reported by
Raf Czlonka <rczlonka at gmail dot com> on ports@.
It also prevents mandoc(1) from issuing *two* messages for every
single .so failure.
|
|
|
|
|
|
| |
rather than merely specifying the message syntax.
Gap in documentation found while looking at a bug
report from Raf Czlonka <rczlonka at gmail dot com>.
|
|
|
|
|
|
|
| |
When after a \\, \t, or \a, another \t or \a had to be resolved
in copy mode within the same argument, the argument got corrupted.
Found while working on a loosely related bug report
from Fabio Scotoni <fabio at esse dot ch>.
|
|
|
|
|
|
|
|
|
| |
move the function mandoc_getarg() from mandoc.c to roff.c. It was
misplaced in mandoc.c in the first place; that file is intended for
utilities needed both by parsers and by formatters, while reading
macro arguments in copy mode is purely a task of the roff(7) parser.
Needed as a preliminary for an upcoming bugfix.
No code change.
|
|
|
|
|
|
| |
because it serves no real purpose and works poorly with HTML.
While here, describe the section argument of .TH,
clarify the syntax display of .TP, and polish some wordings.
|
|
|
|
| |
and also adding some cross references for important escape sequences
|
| |
|
|
|
|
|
|
|
|
|
| |
Unify handling of \f and .ft.
Support \f4 (bold+italic).
Support ".ft BI" and ".ft CW" for terminal output.
Support the .ft request in HTML output.
Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP.
In regress.pl, only strip leading whitespace in math mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add the missing special character \_ (underscore).
* Partial implementations of \a (leader character)
and \E (uninterpreted escape character).
* Parse and ignore \r (reverse line feed).
* Add a WARNING message about undefined escape sequences.
* Add an UNSUPP message about unsupported escape sequences.
* Mark \! and \? (transparent throughput)
and \O (suppress output) as unsupported.
* Treat the various variants of zero-width spaces as one-byte escape
sequences rather than as special characters, to avoid defining bogus
forms with square brackets.
* For special characters with one-byte names, do not define bogus
forms with square brackets, except for \[-], which is valid.
* In the form with square brackets, undefined special characters do not
fall back to printing the name verbatim, not even for one-byte names.
* Starting a special character name with a blank is an error.
* Undefined escape sequences never abort formatting of the input
string, not even in HTML output mode.
* Document the newly handled escapes, and a few that were missing.
* Regression tests for most of the above.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Now that message handling is properly encapsulated,
remove struct mparse pointers from four structs (roff, roff_man,
tbl_node, eqn_node) and from the argument lists of five functions
(roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc).
Except for being passed to the main program as an opaque object,
it now only occurs in read.c, as it should, and not across 15 files
like in the past.
|
|
|
|
|
|
|
|
| |
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version: There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.
|
|
|
|
|
|
|
|
|
|
| |
considerably more readable. This is possible now that i finally
deleted mparse_readmem() from mandoc portable - an unused function
that never existed in OpenBSD.
This cleanup already made me find a minor bug: after a recursive
parse, restoring the line number of the parent file was forgotten.
This is fixed now.
|
|
|
|
|
|
| |
decade but regularly makes maintenance harder. Mandoc is not a
general-purpose library, and being as pluggable as possible is not
among the goals of the project.
|
|
|
|
|
|
|
|
|
|
|
| |
Finally, drop support for the run-time configurable mandocmsg()
callback. It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.
Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.
|
|
|
|
|
|
|
|
|
|
| |
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.
|
| |
|
|
|
|
|
|
|
| |
Finally merge the pointless file st.in into st.c.
Nobody should do operating systems dependent changes to standards:
By definition, standards are the same for every operating system.
While here, libmdoc.h no longer requires mdoc.h.
|
|
|
|
|
|
| |
Move the roffhash_*() functions from roff.h to roff_int.h
because they are only intended for use by parsers,
neither by main programs nor by formatters.
|
|
|
|
|
|
| |
No need to expose the eqn(7) syntax tree data structures everywhere.
Move them to their own include file, "eqn.h".
While here, delete the unused enum eqn_pilet.
|
|
|
|
|
|
|
|
| |
In libroff.h, nothing was left except the eqn(7) parser interface, which
isn't really part of the roff(7) parser, so rename it to eqn_parse.h.
While here, move struct eqn_def to eqn.c because that's the only
file using it, and let eqn_box_free() and eqn_free() handle NULL.
|
|
|
|
|
| |
Move tbl(7)-specific parser internals out of libroff.h.
Move some tbl(7)-internal processing from roff.c to tbl.c.
|