| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
trying very hard to avoid false positives,
not at all trying to catch as many cases as possible;
feature originally suggested by tb@,
OK tb@ kn@ jmc@
|
|
|
|
|
| |
disagrees with the section number given in the .Dt or .TH macro;
feature suggested and patch tested by jmc@
|
|
|
|
| |
to the first word, or the first few words if they are short.
|
|
|
|
|
|
|
| |
with NODE_HREF) from the target element of the link (still marked
with NODE_ID). In many cases, use this to move the target to the
beginning of the paragraph, such that readers don't get dropped
into the middle of a sentence.
|
|
|
|
| |
This fixes a crash in makewhatis(8) encountered by naddy@.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in tag.{h,c} and {mdoc,man}_validate.c
and into a formatting part including command line argument checking
in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c.
Immediate functional benefits include:
* Improved prioritization of automatic tags for .Em and .Sy.
* Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged.
* Explicit tagging of .Er and .Fl now works in HTML output.
* Automatic tagging of .IP and .TP now works in HTML output.
But mainly, this patch provides clean earth to build further improvements on.
Technical changes:
* Main program: Write a tag file for ASCII and UTF-8 output only.
* All formatters: There is no more need to delay writing the tags.
* mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection.
* HTML formatter: If available, use the "string" attribute as the tag.
* HTML formatter: New function to write permalinks, to reduce code duplication.
Style cleanup in the vicinity while here:
* mdoc(7) terminal formatter: To set up bold font for children,
defer to termp_bold_pre() rather than calling term_fontpush() manually.
* mdoc(7) terminal formatter: Garbage collect some duplicate functions.
* mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions.
* Where possible, use switch statements rather than if cascades.
* Get rid of some more Yoda notation.
The necessity for such changes was first discussed with kn@, but i didn't
bother him with a request to review the resulting -673/+782 line patch.
|
|
|
|
|
|
|
|
|
| |
everywhere and not only in the parsers.
For more uniform messages, use it at more places instead of err(3),
in particular in the main program.
While here, integrate a few trivial functions called at exactly one
place into the main option parser, and let a few more functions use
the normal convention of returning 0 for success and -1 for error.
|
|
|
|
|
|
|
|
| |
While there is no bug, it logically makes sense given the meaning
of the variable that lastln is NULL as long as firstln is NULL.
Michal Nowak <mnowak at startmail dot com> reported that gcc 4.4.4
and 7.4.0 on illumos throw -Wuninitialized false positives.
|
|
|
|
|
|
|
| |
the line input buffer to a length of one byte, do not write one byte
past the end of the line input buffer. Minimal code to show the bug:
printf ".ds X\n.X\n\n" | MALLOC_OPTIONS=C mandoc
Bug found by bentley@ in the sysutils/rancid par(1) manual page.
|
|
|
|
|
|
| |
cannot be opened:
* Mention the filename.
* Report the errno for the file itself, not the one with .gz appended.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
definition) request, used for example by groff_hdtbl(7).
This simplistic implementation may interact incorrectly
with the .tr (input character translation) request.
But come on, you are not only using .char *and* .tr, but you do so
with respect to the same character in the same manual page?
|
|
|
|
|
|
|
|
|
|
|
| |
Needed for example by groff_hdtbl(7).
There are two limitations:
It does not support nested .while requests yet,
and each .while loop must start and end in the same scope.
The roff_parseln() return codes are now more flexible
and allow OR'ing options.
|
|
|
|
|
|
|
| |
parsed earlier, so they will have to be saved for reuse - but the
read.c preparser does not know yet whether a line contains a .while
request before passing it to the roff parser. To cope with that,
save all parsed lines for now. Even shortens the code by 20 lines.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for example used by groff_hdtbl(7) and groff_mom(7).
Also correctly interpolate arguments during nested macro execution
even after .shift and .return, implemented using a stack of argument
arrays.
Note that only read.c, but not roff.c can detect the end of a macro
execution, and the existence of .shift implies that arguments cannot
be interpolated up front, so unfortunately, this includes a partial
revert of roff.c rev. 1.337, moving argument interpolation back into
the function roff_res().
|
|
|
|
|
|
|
|
| |
Leah Neukirchen pointed out that mdoclint(1) used to warn about a
leading zero before the day number, so we know that both NetBSD and
Void Linux want the message. It does no harm on OpenBSD because
Mdocdate always does the right thing anyway.
jmc@ agrees that it makes sense in contexts not using Mdocdate.
|
|
|
|
| |
Suggested by Thomas Klausner <wiz at NetBSD>; discussed with jmc@.
|
|
|
|
|
|
| |
we leak memory internally used by zlib to keep compression state.
Bug reported by Wolfgang Mueller <vehk at vehk dot de> who also
provided an incomplete patch, part of which i'm using in this commit.
|
|
|
|
| |
from jca@, ok jmc@
|
|
|
|
| |
return failure such that we can continue with the next file.
|
|
|
|
|
|
|
|
|
|
|
|
| |
right from roff_parseln() rather than delegating to read.c,
similar to what i just did for eqn(7).
The interface function roff_span() becomes obsolete and is deleted,
the former interface function roff_addtbl() becomes static,
the interface functions tbl_read() and tbl_cdata() become void,
and minus twelve linus of code.
No functional change.
|
|
|
|
|
|
| |
of struct roff_node which is allocated for each equation anyway.
2. Do not keep a list of equation parsers, one parser is enough.
Minus fifty lines of code, no functional change.
|
|
|
|
|
|
| |
that are not syntax mistakes and that do not cause wrong formatting
or content to style suggestions.
Also upgrade two warnings that may cause information loss to errors.
|
|
|
|
|
| |
is confusing, simply print "STYLE:", which is intuitive and does not
sound excessively alarming; suggested by jmc@, OK tedu@ jmc@.
|
|
|
|
| |
the idea came up in a discussion with Thomas Klausner <wiz at NetBSD>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
in the base system, inspired by mdoclint(1).
We are able to do this because (1) the -mdoc parser, the -Tlint validator,
and the man(1) manual page lookup code are all in the same program
and (2) the mandoc.db(5) database format allows fast lookup.
Feedback from, previous versions tested by, and OK jmc@.
A few features will be added to this in the tree, step by step.
|
|
|
|
| |
triggered by a question from Yuri Pankov (illumos)
|
|
|
|
|
|
| |
I'm using a very simple, linear time / zero space fuzzy string
matching heuristic rather than a full Levenshtein metric, to keep
the code both simple and fast.
|
|
|
|
| |
inspired by mdoclint
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system. Mark operating system specific messages
with "(OpenBSD)" at the end.
Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.
Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.
|
| |
|
| |
|
|
|
|
|
| |
and operating system dependent messages about missing or unexpected
Mdocdate; inspired by mdoclint(1).
|
| |
|
|
|
|
| |
inspired by mdoclint(1), and jmc@ considers it useful
|
| |
|
| |
|