Teach -man that a literal context should be closed by SS/SH in the
backend (the front-end already accomodated for this). Found indirectly
from a question by Brad Smith.
Finishing touches on demandoc. It now backs over ending punctuation as
well as leading punctuation. Again, this isn't the same as deroff
(which uses, I think, some punctuation as delimiters), but it's easier
to explain and simpler to audit.
Make `-w' mode work much better. This is INCREDIBLY poorly specified in
any other deroff manual, and as I don't think anybody actually uses
deroff, I don't feel compelled to research its behaviour too much and
can just do what's logical.
First, use \(dq instead of \*q for double-quote. Second, use `Li' to
note literal text in "Examples:" parts. Finally, move parts of
Quotation related to keeping whitespace into Whitespace and clean up the
text to be a bit clearer. Examples can be added back in at will, but
now it follows the general layout of explanation followed by examples.
Align `-offset indent' and `D1' by forcing BLOCKQUOTE to have a 5ex
margin. This is dubious: the HTML4 spec specifically says that
BLOCKQUOTE shouldn't be abused for indentation, which is exactly what we
do. However, `D1' needs indentation and it's the only way to force text
browsers to do so. Alternatives?
Also remove the unused HALFINDENT defines while here.
Have `Li' be correctly monospaced in -T[x]html. Also make sure that
`Li' prints as a CODE tag and the style-sheet has the `lit' class apply
to multiple tag types.
Sync man.7's LANGUAGE SYNTAX (was INPUT ENCODING) with mdoc.7.
While here, fix the scaling widths example that incorrectly used `br'
(it now correctly uses `sp').
Ingo Schwarze [Tue, 16 Aug 2011 23:44:58 +0000 (23:44 +0000)]
Replace the .Fl examples by others exhibiting the same features,
but avoiding use of .Nm, because letting .Nm call other macros
is unusual style, and we don't want unusual style in examples.
Issue brought up by kristaps@.
Fixed mingw compatibility where the "z" printf() modifier isn't
recognised. It's easier to make these u_int than to jump through hoops
for a special formatter.
Allow `Sx' and `Ss' to have child nodes. Fixes manuals in NetBSD.
Originally pointed out by joerg@ then again by Thomas Klausner by way of
Nicolas Joy. Note: don't use these constructions as you can't link to
the sections with `Sx'.
Ingo Schwarze [Wed, 3 Aug 2011 21:25:23 +0000 (21:25 +0000)]
Add small chunks of new text and better examples written from scratch,
filling gaps found by checking the MANUAL DOMAIN chapter in mdoc.samples(7).
While here, fix lots of minor issues.
feedback and ok jmc@
Ingo Schwarze [Tue, 2 Aug 2011 01:07:26 +0000 (01:07 +0000)]
The term "reserved terms" is too broad, so narrow it down
to "delimiters", and explain which special handling they get
as macro arguments. Move the text to a better place and remove
a few lies. Postpone figuring out the lists of macros causing
that special handling, it would cost too much time right now.
feedback and ok jmc@
This also brings the file back in sync with OpenBSD.
Ingo Schwarze [Mon, 1 Aug 2011 07:45:11 +0000 (07:45 +0000)]
Add some new text written from scratch after checking whether anything
explained in mdoc.samples(7) is missing from mdoc(7):
* Discourage trailing whitespace.
* Move all information about quoted arguments to the relevant
subsection, shortening it a bit, and adding an example.
* Mention that blanks can be quoted with a backslash.
* A better .Nd line in the template (verbatim from mdoc.samples(7)).
* Explain how to escape callable macro names, and provide examples.
ok jmc@
trivial fixes found while merging to OpenBSD:
* ellipsis is an argument to .Ar, not part of the preceding argument
* libz, libpam, on, off are not placeholders for arguments
* .Rv is not only relevant for system calls, see atexit(3), sem_init(3)
Make sure that in -Tascii mode, predefined strings render the same
way as in groff. With this fix, \*(If, \*(Pi and \*(Tm change in
other output modes, but -Tascii is what matters.
Found when merging 1.11.3 to OpenBSD; ok kristaps@.
Regression fixes after merging 1.11.3 to OpenBSD (rev. 1.20):
* Do not pass integers outside the ASCII range to isprint().
* Make sure escaped characters are really printed verbatim
when the escape sequence has no special meaning.
ok kristaps@
An implementation of `tr'. This routes allocations of TEXT nodes
through libroff, which does the appropriate translations of `tr'. This
is SLOW: it uses the backend of `ds' and `de', which is a simple linear
list. However, unlike `ds' and `de', it iterates over EACH CHARACTER of
the entire file looking for replacements.
Move mandoc_hyph() into roff_parsetext() as a single conditional. While
here, do some function renames for clarity and make all function
prototypes be in one place.
First, roff_res() has no need to invoke ROFF_RERUN: since it's executed
before any other roff processing occurs, it's Ok to just let it do its
thing and pass through. Also, make sure this function is ALWAYS called,
not just when first_string is defined.
Second, add a new function, roff_parsetext(), that post-processes
non-macro lines. This, for the time being, amounts to detecting soft
hyphens. This fixes a long-standing bug in that -man now has proper
hyphen breaking!
Move checking of escapes into roff.c, where we're already stepping
through looking for user-defined escapes. This clears up a nice bit of
validation code.
Implement the first steps of equation parsing from within libmdoc.
This consists of a shim around the text parser that calls out to libroff
if equation components exist on the line. Right now this will do
nothing, as the equation delimiter always returns nil.
Scary-looking but otherwise harmless changes allow me to build for Windows.
That is to say, with mingw32. This amounts to the following:
(1) break compat.c into compat_strlcpy.c and compat_strlcat.c
(2) add compat_getsubopt.c (from OpenBSD) and test-getsubopt.c
(3) add test-strptime.c for HAVE_STRPTIME
(4) add ifdef bits here and there, where necessary
(5) remove some harmless unportable stuff (u_char, localtime_r)
I've added the appropriate mdocml.zip target to the Makefile, too.
Add support for tdefine and ndefine. Consolidate some error messages. Add
somem more version notes (getting there). Have the equation nanme be captured.
The circumflex is also a special space character.
Note this and clean up some documentation in eqn.7.
Also add some version notes, although I'm not ready for a release yet.
Add all rendered symbols used by eqn. I use the Second-Edition User's
Manual (1978) for this, so it should catch most of them. They just map
into the mandoc_char escaped characters.
Use a macro instead of doing a string-fragment compare. I just get
worried that I'm going to write the wrong size on both sides of the
equality (I've already done it a few times). This cleans up the code
readability a bit.
Accomodate for hard-spaces with tildes. For now, consider them regular
spaces. Also allow for tabs. Finally, have the parser correctly handle
open and close brackets smooshed against other terms. All of these
handle "details" noted in the CACM paper.
Complete eqn.7 parsing. Features all productions from the original 1975
CACM paper in an LR(1) parse (1 -> eqn_rewind()). Right now the code is
a little jungly, but will clear up as I consolidate parse components.
The AST structure will also be cleaned up, as right now it's pretty ad
hoc (this won't change the parse itself). I added the mandoc_strndup()
function will here.
Finish the eqn syntactic parser. This correctly parses terms and does
the proper `define' dance, which amounts to pure word-replace (you can,
say, define `foo' as `define' then define `define' as something else).
eqn.c is now ready for some semantic parsing of `box' and `eqn'
productions as defined by the grammar.