]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
7 years agoRewrite half of this, i was completely unaware how bad it was.
Ingo Schwarze [Wed, 28 Jun 2017 00:59:57 +0000 (00:59 +0000)]
Rewrite half of this, i was completely unaware how bad it was.
Remove several lies, lots of duplicate information,
and a lengthy discussion of features we don't support.
Clarify the wording in some places and make it more concise in others.
Delete examples from where they don't belong
and write a new EXAMPLES section from scratch.

7 years agotest inter-column spacing
Ingo Schwarze [Tue, 27 Jun 2017 19:51:48 +0000 (19:51 +0000)]
test inter-column spacing

7 years agoImplement spacing of columns as defined in the table layout;
Ingo Schwarze [Tue, 27 Jun 2017 18:25:02 +0000 (18:25 +0000)]
Implement spacing of columns as defined in the table layout;
this is for example used by lftp(1)
and, ironically, misused by our very own tbl(7) manual...

7 years agowarn about .Ns macros that have no effect because they are followed
Ingo Schwarze [Tue, 27 Jun 2017 12:18:00 +0000 (12:18 +0000)]
warn about .Ns macros that have no effect because they are followed
by an isolated closing delimiter; inspired by mdoclint

7 years agocatch up with the recent eqn(7) improvements
Ingo Schwarze [Mon, 26 Jun 2017 20:11:45 +0000 (20:11 +0000)]
catch up with the recent eqn(7) improvements

7 years agoComplete rewrite of the lexer in a single function with four operation
Ingo Schwarze [Mon, 26 Jun 2017 20:09:04 +0000 (20:09 +0000)]
Complete rewrite of the lexer in a single function with four operation
modes instead of four functions, resulting in considerable
simplification, fifty lines less of code, fifteen fewer automatic
variables, and several bug fixes, for example:

1. The delim control statement consumes exactly two bytes of input,
requires no whitespace after these two bytes, and does not treat
quotes in any special way.
2. If the argument of left, right, gfont, gsize, or size is defined
as an alias, only the first word of the value is used as the
delimiter, font name, or font size.
3. If a back, fwd, down, or up keyword is followed by another keyword
instead of the required number, GNU eqn does nothing useful, but
typically errors out.  So no need to have special handling (with
an ugly goto!) for it in mandoc.

Also getting rid of one pointless static buffer and twelve redundant
calls to strlcpy(3).

7 years agowhen splitting a composite word,
Ingo Schwarze [Mon, 26 Jun 2017 11:04:47 +0000 (11:04 +0000)]
when splitting a composite word,
do not forget to close the inserted list box

7 years agoCatch typos in .Sh names; suggested by jmc@.
Ingo Schwarze [Sun, 25 Jun 2017 17:43:45 +0000 (17:43 +0000)]
Catch typos in .Sh names; suggested by jmc@.

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.

7 years agotest new MT macro
Ingo Schwarze [Sun, 25 Jun 2017 14:09:44 +0000 (14:09 +0000)]
test new MT macro

7 years agocope with changes in BASE messages
Ingo Schwarze [Sun, 25 Jun 2017 12:51:47 +0000 (12:51 +0000)]
cope with changes in BASE messages

7 years agoadd support for the MT and ME mailto macros, used for example in wg(8);
Ingo Schwarze [Sun, 25 Jun 2017 11:42:02 +0000 (11:42 +0000)]
add support for the MT and ME mailto macros, used for example in wg(8);
patch from bentley@

7 years agodelete useless .Ns macro that jmc@ found with mdoclint(1)
Ingo Schwarze [Sat, 24 Jun 2017 21:08:44 +0000 (21:08 +0000)]
delete useless .Ns macro that jmc@ found with mdoclint(1)

7 years agodocument message "unknown architecture"
Ingo Schwarze [Sat, 24 Jun 2017 19:06:51 +0000 (19:06 +0000)]
document message "unknown architecture"

7 years agooperating system dependent message about unknown architecture;
Ingo Schwarze [Sat, 24 Jun 2017 18:58:33 +0000 (18:58 +0000)]
operating system dependent message about unknown architecture;
inspired by mdoclint

7 years agodelete old, undocumented, obsolete section names that nobody uses
Ingo Schwarze [Sat, 24 Jun 2017 17:37:06 +0000 (17:37 +0000)]
delete old, undocumented, obsolete section names that nobody uses

7 years agoin the base system, suggest leaving .Os blank; inspired by mdoclint
Ingo Schwarze [Sat, 24 Jun 2017 15:59:50 +0000 (15:59 +0000)]
in the base system, suggest leaving .Os blank; inspired by mdoclint

7 years agoSplit -Wstyle into -Wstyle and the even lower -Wbase, and add
Ingo Schwarze [Sat, 24 Jun 2017 14:38:32 +0000 (14:38 +0000)]
Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-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@.

7 years agoDelete .St -p1003.1-2013.
Ingo Schwarze [Sat, 24 Jun 2017 13:49:29 +0000 (13:49 +0000)]
Delete .St -p1003.1-2013.
It is an OpenBSD addition that did not get used a single time in
three years, and groff did not pick it up either, so removing it
does not affect any existing manuals anywhere.
Cleanup suggested by jmc@, OK bentley@.

7 years agoConsistently treat character escape sequences as operators,
Ingo Schwarze [Fri, 23 Jun 2017 23:00:01 +0000 (23:00 +0000)]
Consistently treat character escape sequences as operators,
not as letters, even if their names contain letters.

This is certainly not perfect, but code to recognize that \(*a is
not an operator but a letter would need a huge table, or Unicode
character property support, which won't happen at this time.

7 years agoeqn(1) output operator translation
Ingo Schwarze [Fri, 23 Jun 2017 22:20:17 +0000 (22:20 +0000)]
eqn(1) output operator translation

7 years agosplitting a text box sometimes requires wrapping it in a list
Ingo Schwarze [Fri, 23 Jun 2017 21:04:57 +0000 (21:04 +0000)]
splitting a text box sometimes requires wrapping it in a list

7 years agoStop using "mdocml" as an official name.
Ingo Schwarze [Fri, 23 Jun 2017 15:58:14 +0000 (15:58 +0000)]
Stop using "mdocml" as an official name.
Prefer mandoc.bsd.lv to mdocml.bsd.lv.

7 years agoWrite text boxes as <mi>, <mn>, or <mo> as appropriate,
Ingo Schwarze [Fri, 23 Jun 2017 02:32:12 +0000 (02:32 +0000)]
Write text boxes as <mi>, <mn>, or <mo> as appropriate,
and write fontstyle or fontweight attributes where required.
Missing features reported by bentley@.

7 years agoSimplify font handling:
Ingo Schwarze [Fri, 23 Jun 2017 00:30:38 +0000 (00:30 +0000)]
Simplify font handling:
1. Inherit the font attribute from the parent box, such that iteration
is no longer required to find the current font.
2. For well-known function name tokens, do not insert an EQN_LISTONE
box into the AST; simply set the font attribute of the text box
itself that contains the name.

Also improve word splitting of unquoted strings in default font mode:
3. Split between numbers and punctuation because both will soon get
different HTML markup.
4. Do not split between letters.  With the newly ubiquitious font
attributes, all formatters will be able to figure out what to do
without putting each letter into a separate box.

7 years agoFix font selection for text boxes in the terminal formatter.
Ingo Schwarze [Thu, 22 Jun 2017 00:30:20 +0000 (00:30 +0000)]
Fix font selection for text boxes in the terminal formatter.
Issue reported by bentley@.

The AST data structure is powerful enough that all required
information can easily be provided in the parser, and no change
of the formatting code is needed.

7 years agoOutside explicit font context, give every letter its own box.
Ingo Schwarze [Wed, 21 Jun 2017 20:50:50 +0000 (20:50 +0000)]
Outside explicit font context, give every letter its own box.
The formatters need this to correctly select fonts.
Missing feature reported by bentley@.

7 years agoquoted words are not parsed for defined keys
Ingo Schwarze [Wed, 21 Jun 2017 18:38:26 +0000 (18:38 +0000)]
quoted words are not parsed for defined keys

7 years agoRecognize well-known functions names (the same that Heirloom recognizes,
Ingo Schwarze [Wed, 21 Jun 2017 18:04:34 +0000 (18:04 +0000)]
Recognize well-known functions names (the same that Heirloom recognizes,
which includes those recognized by groff) and wrap them in a roman box
unless they already are in roman context.
Missing feature reported by bentley@.

7 years agoKNF: remove parentheses from switch case labels; no binary change
Ingo Schwarze [Tue, 20 Jun 2017 17:24:35 +0000 (17:24 +0000)]
KNF: remove parentheses from switch case labels; no binary change

7 years agoFix a regression in the previous revision:
Ingo Schwarze [Mon, 19 Jun 2017 12:57:08 +0000 (12:57 +0000)]
Fix a regression in the previous revision:
When there is no link description, reuse the URI.
Reported by tj@ and bentley@.

7 years agoImplement appending to standard man(7) and mdoc(7) macros with .am.
Ingo Schwarze [Sun, 18 Jun 2017 17:36:03 +0000 (17:36 +0000)]
Implement appending to standard man(7) and mdoc(7) macros with .am.

With roff_getstrn(), provide finer control which definitions
can be used for what:
* All definitions can be used for .if d tests and .am appending.
* User-defined for \* expansion, .dei expansion, and macro calling.
* Predefined for \* expansion.
* Standard macros, original or renamed, for macro calling.

Several related improvements while here:
* Do not return string table entries that have explicitly been removed.
* Do not create a rentab entry when trying to rename a non-existent macro.
* Clear an existing rentab entry when the external interface
roff_setstr() is called with its name.
* Avoid trailing blanks in macro lines generated from renamed
and from aliased macros.
* Delete the duplicate __m*_reserved[] tables, just use roff_name[].

7 years agostyle message about duplicate RCS ids; inspired by mdoclint
Ingo Schwarze [Sat, 17 Jun 2017 23:07:00 +0000 (23:07 +0000)]
style message about duplicate RCS ids; inspired by mdoclint

7 years agostyle message about missing RCS ids; inspired by mdoclint
Ingo Schwarze [Sat, 17 Jun 2017 22:43:14 +0000 (22:43 +0000)]
style message about missing RCS ids; inspired by mdoclint

7 years agoif .in is used inside the .TP head, it's always relative
Ingo Schwarze [Sat, 17 Jun 2017 16:47:48 +0000 (16:47 +0000)]
if .in is used inside the .TP head, it's always relative

7 years agotables leak tab settings to subsequent text
Ingo Schwarze [Sat, 17 Jun 2017 14:55:30 +0000 (14:55 +0000)]
tables leak tab settings to subsequent text

7 years agocorrect handling of blank lines after \c
Ingo Schwarze [Sat, 17 Jun 2017 13:06:16 +0000 (13:06 +0000)]
correct handling of blank lines after \c

7 years agoproperly set the default indentation
Ingo Schwarze [Sat, 17 Jun 2017 01:27:05 +0000 (01:27 +0000)]
properly set the default indentation
such that even pages without any .SH macros get it

7 years agoMultiple tbl(7) improvements:
Ingo Schwarze [Fri, 16 Jun 2017 20:01:06 +0000 (20:01 +0000)]
Multiple tbl(7) improvements:
* Do not discard data that lacks a matching layout cell but remains
within the number of columns of the table as a whole.
* Do not insert dummy data rows for any layout row starting with a
horizontal line, but only for layout rows that would discard all
the data on a matching non-empty data row.
* Print horizontal lines specified in the layout even if there is
no matching data cell.
* Improve the logic for extending vertical lines to adjacent rows,
for choosing cross marks versus line segments, and some related details.

7 years agoround default width of tbl(7) text blocks in the same way as groff
Ingo Schwarze [Thu, 15 Jun 2017 00:27:52 +0000 (00:27 +0000)]
round default width of tbl(7) text blocks in the same way as groff

7 years agoimplement so-called absolute horizontal motion: \h'|...',
Ingo Schwarze [Wed, 14 Jun 2017 23:24:17 +0000 (23:24 +0000)]
implement so-called absolute horizontal motion: \h'|...',
used for example by zoem(1)

7 years agoNaive implementation of the roff(7) .po (page offset) request.
Ingo Schwarze [Wed, 14 Jun 2017 22:51:25 +0000 (22:51 +0000)]
Naive implementation of the roff(7) .po (page offset) request.

This clearly works when .po is called on the top level, but might
not be sophisticated enough if people call .po inside indentation-changing
contexts, but i haven't seen that in manual pages (yet :).

7 years agoadd the \(ru (0.5m baseline ruler) character escape sequence,
Ingo Schwarze [Wed, 14 Jun 2017 20:57:07 +0000 (20:57 +0000)]
add the \(ru (0.5m baseline ruler) character escape sequence,
abused by mail/nmh; groff_char(7) confirms that this really exists

7 years agosimple implementation of the roff(7) .als (macro alias) request,
Ingo Schwarze [Wed, 14 Jun 2017 19:39:18 +0000 (19:39 +0000)]
simple implementation of the roff(7) .als (macro alias) request,
sufficient for pages using po4a(1)

7 years agolet \l use the right fill character
Ingo Schwarze [Wed, 14 Jun 2017 18:23:37 +0000 (18:23 +0000)]
let \l use the right fill character

7 years agoimprove rounding rules for scaling units
Ingo Schwarze [Wed, 14 Jun 2017 17:51:15 +0000 (17:51 +0000)]
improve rounding rules for scaling units
in horizontal orientation in the terminal formatter

7 years agoharmless, but weird typo; found with afterstep_faq(1)
Ingo Schwarze [Wed, 14 Jun 2017 14:24:20 +0000 (14:24 +0000)]
harmless, but weird typo; found with afterstep_faq(1)

7 years agoimplement the roff(7) d (macro or string defined) conditional
Ingo Schwarze [Wed, 14 Jun 2017 14:02:39 +0000 (14:02 +0000)]
implement the roff(7) d (macro or string defined) conditional

7 years agoimplement roff(7) .rj (right justify) request
Ingo Schwarze [Wed, 14 Jun 2017 13:00:31 +0000 (13:00 +0000)]
implement roff(7) .rj (right justify) request

7 years agoimplement the roff(7) \p (break output line) escape sequence
Ingo Schwarze [Wed, 14 Jun 2017 01:31:26 +0000 (01:31 +0000)]
implement the roff(7) \p (break output line) escape sequence

7 years agoPartial support for the \n[an-margin] number register.
Ingo Schwarze [Tue, 13 Jun 2017 19:34:40 +0000 (19:34 +0000)]
Partial support for the \n[an-margin] number register.

Manuals autogenerated from reStructuredText are reckless enough
to peek at this non-portable, implementation-dependent, highly
groff-specific internal register - for no good reason, because the
man(7) language natively provides in a much simpler way what they
are trying to emulate here with much fragility.

A full implementation would be very hard because it would require
access to output-device-specific formatting data at the roff(7)
preprocessor stage, which mandoc doesn't support at all.
So hardcode a few magic numbers as reStructuredText expects them
for terminal output.  For other output modes (like HTML), code using
this register is utterly broken anyway.

7 years agoIf the layout is empty except for requesting a left vertical frame,
Ingo Schwarze [Tue, 13 Jun 2017 16:12:01 +0000 (16:12 +0000)]
If the layout is empty except for requesting a left vertical frame,
record that detail in struct tbl_opts, such that term_tbl() can do
correct column calculations and doesn't prematurely break lines.
Fixes the tbl/layout/empty regression test that got broken when
line breaking in text block cells was implemented.

7 years agoDelete the arbitrary range restriction for -Owidth.
Ingo Schwarze [Tue, 13 Jun 2017 15:06:56 +0000 (15:06 +0000)]
Delete the arbitrary range restriction for -Owidth.
We provide users with tools.  We don't attempt to prevent them from
using them in stupid ways: depending on the context, not every
stupid-looking use is necessarily actually stupid, and not every
stupidity can be automatically detected anyway, so don't even try.

7 years agofix the interaction of the allbox option with spanned cells in the layout
Ingo Schwarze [Tue, 13 Jun 2017 14:39:13 +0000 (14:39 +0000)]
fix the interaction of the allbox option with spanned cells in the layout

7 years agoExplicitly ignore .br, .ce, and .sp inside tbl(7) text blocks.
Ingo Schwarze [Tue, 13 Jun 2017 13:51:11 +0000 (13:51 +0000)]
Explicitly ignore .br, .ce, and .sp inside tbl(7) text blocks.
With the current code structure, they would appear at the wrong
place in the syntax tree, so it is better to not insert them
into the tree at all and issue an UNSUPP message instead.

7 years agotest the new allbox and wrapping features
Ingo Schwarze [Mon, 12 Jun 2017 22:50:38 +0000 (22:50 +0000)]
test the new allbox and wrapping features

7 years agoTwo minor fixes for the "allbox" modifier:
Ingo Schwarze [Mon, 12 Jun 2017 22:49:16 +0000 (22:49 +0000)]
Two minor fixes for the "allbox" modifier:
1. It does not reduce explicit "||" in the layout to "|".
2. It does not cause three horizontal lines at the end of a table,
even if the table ends with an explicit "_" data line.

7 years agoIf a tbl(7) layout contains a 'w' (minimum width) modifier for a
Ingo Schwarze [Mon, 12 Jun 2017 22:05:57 +0000 (22:05 +0000)]
If a tbl(7) layout contains a 'w' (minimum width) modifier for a
given column, that column contains no literal or numeric cell of
larger width, and all text block cells in that column can be line
wrapped to fit into that minimum width, groff does not increase
that column width beyond the specified minimum: so do the same.

7 years agoimplement the tbl(7) "allbox" option;
Ingo Schwarze [Mon, 12 Jun 2017 20:45:18 +0000 (20:45 +0000)]
implement the tbl(7) "allbox" option;
used for example by curs_getch(3) and GLwDrawingArea(3)

7 years agofix column width calculation for text block cells
Ingo Schwarze [Mon, 12 Jun 2017 20:14:18 +0000 (20:14 +0000)]
fix column width calculation for text block cells

7 years agoImplement automatic line breaking
Ingo Schwarze [Mon, 12 Jun 2017 19:05:47 +0000 (19:05 +0000)]
Implement automatic line breaking
inside individual table cells that contain text blocks.
This cures overlong lines in various Xenocara manuals.

7 years agoooops, fix a glitch in the previous commit...
Ingo Schwarze [Sun, 11 Jun 2017 20:03:02 +0000 (20:03 +0000)]
ooops, fix a glitch in the previous commit...

7 years agoStyle message about legacy man(7) date format in mdoc(7) documents
Ingo Schwarze [Sun, 11 Jun 2017 19:45:05 +0000 (19:45 +0000)]
Style message about legacy man(7) date format in mdoc(7) documents
and operating system dependent messages about missing or unexpected
Mdocdate; inspired by mdoclint(1).

7 years agoStyle message about legacy man(7) date format in mdoc(7) documents
Ingo Schwarze [Sun, 11 Jun 2017 19:37:00 +0000 (19:37 +0000)]
Style message about legacy man(7) date format in mdoc(7) documents
and operating system dependent messages about missing or unexpected
Mdocdate; inspired by mdoclint(1).

7 years agostyle message about missing .Fn markup; inspired by mdoclint
Ingo Schwarze [Sun, 11 Jun 2017 17:16:51 +0000 (17:16 +0000)]
style message about missing .Fn markup; inspired by mdoclint

7 years agoDo not issue the message "no blank before trailing delimiter" for .No.
Ingo Schwarze [Sun, 11 Jun 2017 14:24:55 +0000 (14:24 +0000)]
Do not issue the message "no blank before trailing delimiter" for .No.
In practice, that message only matters inside .Bf, and even there, it
can occasionally be a false positive.  In all other cases, it usually
is a false positive, so it is better to drop it outright.
Suggested by jmc@.

7 years agoadd forgotten file
Ingo Schwarze [Sun, 11 Jun 2017 14:23:53 +0000 (14:23 +0000)]
add forgotten file

7 years agofix order of messages
Ingo Schwarze [Sun, 11 Jun 2017 14:20:27 +0000 (14:20 +0000)]
fix order of messages

7 years agoReduce false positives for the "no blank before trailing delimiter" message.
Ingo Schwarze [Sat, 10 Jun 2017 16:54:16 +0000 (16:54 +0000)]
Reduce false positives for the "no blank before trailing delimiter" message.
This brings us down to one false positive for about every 18 pages.

7 years agominor markup simplifications
Ingo Schwarze [Sat, 10 Jun 2017 16:32:27 +0000 (16:32 +0000)]
minor markup simplifications

7 years agostyle message about missing blank before trailing delimiter;
Ingo Schwarze [Sat, 10 Jun 2017 01:48:53 +0000 (01:48 +0000)]
style message about missing blank before trailing delimiter;
inspired by mdoclint(1), and jmc@ considers it useful

7 years agodo not break the line between Bsx/Bx/Fx/Nx/Ox/Dx and its arguments
Ingo Schwarze [Sat, 10 Jun 2017 01:28:33 +0000 (01:28 +0000)]
do not break the line between Bsx/Bx/Fx/Nx/Ox/Dx and its arguments

7 years agoProperly reinitialize roffce_node between parses,
Ingo Schwarze [Thu, 8 Jun 2017 19:35:51 +0000 (19:35 +0000)]
Properly reinitialize roffce_node between parses,
or this may crash with use-after-free in makewhatis(8);
reported by jmc@, thanks!

7 years agoImplement w layout specifier (minimum column width).
Ingo Schwarze [Thu, 8 Jun 2017 18:11:22 +0000 (18:11 +0000)]
Implement w layout specifier (minimum column width).
Improve width calculation of text blocks.
Reduces the groff/mandoc diff in Base+Xenocara by about 800 lines.

7 years agomake the internal a2roffsu() interface more powerful by returning
Ingo Schwarze [Thu, 8 Jun 2017 12:54:58 +0000 (12:54 +0000)]
make the internal a2roffsu() interface more powerful by returning
a pointer to the end of the parsed data, making it easier to
parse subsequent bytes

7 years agowarning about unknown .Lb arguments; inspired by mdoclint(1)
Ingo Schwarze [Thu, 8 Jun 2017 00:23:30 +0000 (00:23 +0000)]
warning about unknown .Lb arguments; inspired by mdoclint(1)

7 years agostyle checks related to .Er; inspired by mdoclint(1)
Ingo Schwarze [Wed, 7 Jun 2017 23:29:48 +0000 (23:29 +0000)]
style checks related to .Er; inspired by mdoclint(1)

7 years agoAlso catch "new sentence, new line" if there are three blanks
Ingo Schwarze [Wed, 7 Jun 2017 20:58:49 +0000 (20:58 +0000)]
Also catch "new sentence, new line" if there are three blanks
between the sentences.  Thomas Klausner says he has seen some
of these, and i don't see any false positives.

7 years agoMake "new sentence, new line" detection stricter:
Ingo Schwarze [Wed, 7 Jun 2017 20:30:40 +0000 (20:30 +0000)]
Make "new sentence, new line" detection stricter:
Also catch cases where the new sentence starts with a one-letter word
and the input line is broken right after that word.
Suggested by Thomas Klausner <wiz @ NetBSD>.

It's merely a three-bit diff, changing one byte from 0x34 to 0x33,
so what can possibly go wrong...

7 years agoPrepare the terminal driver for filling multiple columns in parallel,
Ingo Schwarze [Wed, 7 Jun 2017 20:01:19 +0000 (20:01 +0000)]
Prepare the terminal driver for filling multiple columns in parallel,
second step: make the per-column byte pointer persistent across
term_flushln() calls, such that a subsequent call can continue at
the point where the previous call left.  If more than one column
is in use, return from term_flushln() when the column is full,
rather than breaking the output line.

No functional change, because nothing sets up multiple columns yet.

7 years agoPrepare the terminal driver for filling multiple columns in parallel,
Ingo Schwarze [Wed, 7 Jun 2017 17:38:26 +0000 (17:38 +0000)]
Prepare the terminal driver for filling multiple columns in parallel,
first step: split column data out of the terminal state struct into
a new column state struct and use an array of such column state
structs.  No functional change.

7 years agoThe \h escape sequence provides another method for moving backwards,
Ingo Schwarze [Wed, 7 Jun 2017 02:14:09 +0000 (02:14 +0000)]
The \h escape sequence provides another method for moving backwards,
and after that, previously written output gets overwritten, but
overwriting with blanks does *not* erase previously written content.
Yes, manual pages exist that are crazy enough to rely on that...

7 years agoImplement the roff(7) .rn (rename macro or string) request.
Ingo Schwarze [Wed, 7 Jun 2017 00:50:34 +0000 (00:50 +0000)]
Implement the roff(7) .rn (rename macro or string) request.
Renaming a user-defined macro is very simple: just copy
the definition to the new name and delete the old name.
Renaming high-level macros is a bit tricky: use a dedicated
key-value-table, with non-standard names as keys and standard
names as values.  When a macro is found that is not user-defined,
look it up in the "renamed" table and translate it back to the
standard name before passing it on to the high-level parsers.

7 years agodocument the new .ce implementation
Ingo Schwarze [Tue, 6 Jun 2017 15:03:35 +0000 (15:03 +0000)]
document the new .ce implementation

7 years agoMinimal implementation of the roff(7) .ce request (center a number
Ingo Schwarze [Tue, 6 Jun 2017 15:01:04 +0000 (15:01 +0000)]
Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.

7 years agoImplement the roff(7) .mc (right margin character) request.
Ingo Schwarze [Sun, 4 Jun 2017 22:44:15 +0000 (22:44 +0000)]
Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively.
Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf;
instead, implement a proper TERMP_BRNEVER flag.

7 years agoMake term_flushln() simpler and more robust:
Ingo Schwarze [Sun, 4 Jun 2017 18:50:35 +0000 (18:50 +0000)]
Make term_flushln() simpler and more robust:
Eliminate the "overstep" state variable.
The information is already contained in "viscol".
Minus 60 lines of code, no functional change intended.

7 years agoPure preprocessor implementation of the roff(7) .ec and .eo requests
Ingo Schwarze [Sun, 4 Jun 2017 00:13:15 +0000 (00:13 +0000)]
Pure preprocessor implementation of the roff(7) .ec and .eo requests
(escape character control), touching nothing after the preprocessing
stage and keeping even the state variable local to the preprocessor.
Since the escape character is also used for line continuation, this
requires pulling the implementation of line continuation from the
input reader to the preprocessor, which also considerably shortens
the code required for that.

When the escape character is changed, simply let the preprocessor
replace bare by escaped backslashes and instances of the non-standard
escape character with bare backslashes - that's all we need.

Oh, and if anybody dares to use these requests in OpenBSD manuals,
sending a medium-sized pack of axe-murderers after them might be a
worthwhile part of the punishment, but probably insuffient on its own.

7 years agoignore blank lines in man(7) next line scope;
Ingo Schwarze [Sat, 3 Jun 2017 15:55:24 +0000 (15:55 +0000)]
ignore blank lines in man(7) next line scope;
strange groff edge case behaviour found in multimedia/mjpegtools

7 years agoenable -Wstyle by default in -Tlint; OK jmc@
Ingo Schwarze [Sat, 3 Jun 2017 12:17:25 +0000 (12:17 +0000)]
enable -Wstyle by default in -Tlint; OK jmc@

7 years agoPartial implementation of \h (horizontal line drawing function).
Ingo Schwarze [Fri, 2 Jun 2017 19:21:23 +0000 (19:21 +0000)]
Partial implementation of \h (horizontal line drawing function).
A full implementation would require access to output device properties
and state variables (both only available after the main parser has
finalized the parse tree) before numerical expansions in the roff
preprocessor (i.e., before the main parser is even started).

Not trying to pull that stunt right now because the static-width
implementation committed here is sufficient for tcl-style manual pages
and already more complicated than i would have suspected.

7 years agoadd about 15 missing character escape sequences found in groff_char(7);
Ingo Schwarze [Fri, 2 Jun 2017 12:43:52 +0000 (12:43 +0000)]
add about 15 missing character escape sequences found in groff_char(7);
triggered by multimedia/mkvtoolnix mkvmerge(1) using \(S2

7 years agoMinimal implementation of the \h (horizontal motion) escape sequence.
Ingo Schwarze [Thu, 1 Jun 2017 19:05:37 +0000 (19:05 +0000)]
Minimal implementation of the \h (horizontal motion) escape sequence.
Good enough to cope with the average DocBook insanity.

7 years agoSTYLE message about full stop at the end of .Nd; inspired by mdoclint(1)
Ingo Schwarze [Thu, 1 Jun 2017 15:25:39 +0000 (15:25 +0000)]
STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)

7 years agoSTYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@
Ingo Schwarze [Wed, 31 May 2017 15:31:00 +0000 (15:31 +0000)]
STYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@

7 years agotweak previous; from jmc@
Ingo Schwarze [Tue, 30 May 2017 20:25:32 +0000 (20:25 +0000)]
tweak previous; from jmc@

7 years agoSTYLE message about useless macros we don't want (Bt Tn Ud);
Ingo Schwarze [Tue, 30 May 2017 19:30:38 +0000 (19:30 +0000)]
STYLE message about useless macros we don't want (Bt Tn Ud);
not a WARNING because they don't endanger portability

7 years agofix formatting of intermediate punctuation in .Lk
Ingo Schwarze [Tue, 30 May 2017 16:31:29 +0000 (16:31 +0000)]
fix formatting of intermediate punctuation in .Lk

7 years agoMacro argument quoting does not prevent recognition of punctuation
Ingo Schwarze [Tue, 30 May 2017 16:22:03 +0000 (16:22 +0000)]
Macro argument quoting does not prevent recognition of punctuation
and of called macros.

This bug affects almost all macros, and fixing it simplifies the
code.  It is amazing that the bogus ARGS_QWORD feature got implemented
in the first place, and then carrier along for more than eight years
without anybody ever noticing that it was pointless.

Reported by Leah Neukirchen <leah at vuxu dot org>, found on Void Linux.

7 years agoUse [ rather than [[ for portability,
Ingo Schwarze [Thu, 18 May 2017 14:45:34 +0000 (14:45 +0000)]
Use [ rather than [[ for portability,
in particular since it makes no difference in the case at hand.
Reported by Leah Neukirchen <leah at vuxu dot org> (Void Linux).

7 years agoDelete the -T xhtml command line option.
Ingo Schwarze [Wed, 17 May 2017 23:39:31 +0000 (23:39 +0000)]
Delete the -T xhtml command line option.
It has been obsolete for more than two years.
Use -T html.