summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
Commit message (Collapse)AuthorAgeFilesLines
* Make SYNOPSIS sections and code having .nr nS enabledIngo Schwarze2010-12-111-1/+14
| | | | | | | | | behave as if the whole code were wrapped in .Bk/.Ek, i.e. keeping input lines together on output lines. This is compatible with new groff behaviour and deviates from historical groff. Tweaked version of a patch sent by kristaps@ on July 16, 2010. ok kristaps@ jmc@ sobrado@ millert@
* Merge schwarze@'s changes allowing nested displays. Tweak the patch byKristaps Dzonsons2010-12-051-0/+4
| | | | | | | making sure output doesn't add a superfluous newline with the nested displays. Also add a COMPATIBILITY note. Rename a macro (DATESIZ) to be in line with OpenBSD (DATESIZE).
* Move `Mt', `Ar', and `Li' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-1/+1
| | | | | | | | Clarify that `Mt' gets a default `~' (as per groff 1.20) and document it in mdoc.7. Made `Lk' be removed in mdoc_macro.c if it has no arguments. This fixes segfaults in mdoc_{term,html}.c that nobody's managed to raise yet.
* let .Bsx print just "BSD/OS" like in modern groffIngo Schwarze2010-10-231-1/+1
| | | | from Ulrich Spoerlein <uqs at spoerlein dot net>
* `Sm' no longer produces a linebreak when used in `Bd'.Kristaps Dzonsons2010-10-101-0/+2
|
* * need a space before .No even if it starts with a closing delimiterIngo Schwarze2010-10-011-5/+4
| | | | | | | * slightly simplify .Pf *_IGNDELIM code, and share part of it with .No * do not let opening delimiters fall out of the front of .Ns (from kristaps@) This fixes a few spacing issues in csh(1) and ksh(1). OK kristaps@
* Merge from OpenBSD right after 1.10.6; now back to full sync.Ingo Schwarze2010-09-271-1/+0
| | | | | | | | | | * mdoc.c: blank lines outside literal mode are more similar to .sp than .Pp * backslashes do not terminate macros; partial revert of mdoc.c 1.164; the intention of that commit is fully achieved in roff.c * mdoc_term.c: no need to list the same prototype twice * mdoc_validate.c: drop .Pp before .sp just like .Pp before .Pp * fix off-by-one found by jsg@ with parfait, OpenBSD term_ps.c 1.12 ok kristaps@
* Suppress whitespace following Pp, Lp, sp, and the other newline-emittingKristaps Dzonsons2010-09-271-0/+20
| | | | macros within an unfilled or literal `Bd'.
* Linted function arguments.Kristaps Dzonsons2010-09-261-0/+2
|
* Big clean-up consolidating all punctuation opening/closing functions intoKristaps Dzonsons2010-09-261-225/+117
| | | | | | | | | a single one. This makes code auditing easier and cuts down on bytesize. I also removed some NOSPACE clauses that were handled implicitly by the punctuation itself, e.g., a NOSPACE prior to printing ')', which in term.c has its leading whitespace automatically suppressed.
* A `%T' invoked outside of `Rs' should not produce trailing punctuation.Kristaps Dzonsons2010-09-251-1/+3
| | | | | This from a TODO entry. Also stripped the superfluous NOSPACE, which is handled in term_word() or print_text() anyway.
* Add `Rs' vertical-space in -T[x]html "SEE ALSO" section. RemoveKristaps Dzonsons2010-09-251-1/+5
| | | | | | corresponding TODO entry. Also have the "." after an `Rs' block trigger inter-sentence spacing.
* When the HEAD of an .Nm block in the SYNOPSIS might be widerIngo Schwarze2010-09-231-6/+12
| | | | | | | | | | | than the column containing it, the TERMP_HANG flag is required, but avoid the flag when we know that the HEAD is shorter, because in that case, the flag might ruin the alignment. Problem originally reported by jmc@, who also spotted a regression in an earlier version of this patch. "feel free to commit" kristaps@
* Properly handle -mdoc %A in all outputs. This has two-author entiresKristaps Dzonsons2010-09-041-1/+25
| | | | | | | separated by only "and" while two or more are with ", and" for the last author. Also remove relevant TODO and add regression tests.
* Backout previous.Ingo Schwarze2010-08-211-13/+0
| | | | | | | | | | | | | | | As Kristaps found out, i was wrong: .Bl -column phrases do not ignore spacing rules for trailing punctuation in general. In particular, - the rightmost column of a column list is unaffected - columns terminated by the .Ta macro instead of a tab are unaffected - columns ending in a blank are unaffected Spacing rules for trailing punctuation are only ignored when the tab follows the punctuation immediately, without a blank in between, because then the combination of punctuation and tab is treated by roff as a word, and the punctuation is not recognized as isolated. The reason this doesn't work in mandoc is that in the special case of .Bl -column (not in general!), mandoc treats tabs as word delimiters. We either need to solve this differently, or call it a bug in roff.
* .Bl -column phrases ignore spacing rules for trailing punctuationIngo Schwarze2010-08-201-0/+13
| | | | | and render it just like normal text. Minimal fix of a formatting bug in operator(7) reported by ray@.
* Correctly print `Lk' arguments in -Tascii. Issue raised by Aldis Berzoja.Kristaps Dzonsons2010-08-091-5/+7
| | | | Behaviour ok'd by schwarze@.
* merge from OpenBSD mdoc_term.c rev. 1.100:Ingo Schwarze2010-08-071-2/+4
| | | | | | preserve blank lines in .Bd -literal, both in the middle and at the end of the display ok kristaps@
* Fix how `Bd -unfilled' and `Bd -literal' break lines. This unbreaksKristaps Dzonsons2010-07-271-7/+3
| | | | | displays to work as old groff shows them; however, new groff still does some fancy shit.
* `Ad' is supposed to underline. Found whilst trolling through manuals.Kristaps Dzonsons2010-07-261-1/+1
|
* In the SYNOPSIS, .Nm at the beginning of an input line startsIngo Schwarze2010-07-211-1/+2
| | | | | | | | | | an .Nm block, and gets special handling (new line, indentation). But .Nm in the middle of a line is just a normal in-line element, so make sure it does NOT get the special handling. Partly fixes the test(1) SYNOPSIS; indentation after "[" is still excessive, which is an unrelated and more difficult issue. Reminded of the problem by jmc@; OK kristaps@.
* Remove some FIXMEs: `Ms' accepts arbitrary text, so it can't/shouldn'tKristaps Dzonsons2010-07-191-1/+1
| | | | | | be converted into a symbol. The `Pp' issue has also been fixed.
* Fix spurrious newline emitted by `Pp' when specified before or afterKristaps Dzonsons2010-07-191-0/+5
| | | | `Sh'/`Ss'. Reported by Jason McIntyre.
* After .Sm on, spacing ought to restart right away, before the next token,Ingo Schwarze2010-07-161-2/+4
| | | | | | | and not with a delay, after the next token. But be careful not to cause leading white space at the beginning of a line or column. In OpenBSD, improves chmod(1), ksh(1), tar(1), ps(1) and probably many more. ok kristaps@ and tested by jmc@ and sobrado@
* Re-constitution of `ds' symbol processing. First, push theKristaps Dzonsons2010-07-071-1/+0
| | | | | | | | | roff_getstr() family of functions into roff.c with the "first_string" directly in struct roff. Second, pre-process each line for reserved words in libroff, splicing and re-running a line if it has one (this allows defined symbols to be macros). Remove term.c's invocation of the roff_getstrn() function. Removed function documentation in roff.3 and added roff.7 `ds' documentation.
* Proper `Bk -words' support: only suppress breaks within a line, butKristaps Dzonsons2010-07-061-0/+17
| | | | | | | allow end-of-line to break. This fixes the bad behaviour found when macros within `Bk' never break. "Excellent" schwarze@
* Assert my copyright, making it explicit that i'm granting the same licenseIngo Schwarze2010-07-041-1/+2
| | | | | on those parts of the code and text that i have written as Kristaps is. "fine with me" kristaps@
* Cache column sizes and char pointer into mdoc_bl. Finally get rid ofKristaps Dzonsons2010-07-041-27/+5
| | | | the loops here and there to track down the MDOC_Column arguments.
* Allow empty `Fo' to get by without an assertion.Kristaps Dzonsons2010-07-031-1/+3
|
* Cached `An' arguments in struct mdoc_an. Note that this isn't aKristaps Dzonsons2010-07-021-15/+2
| | | | pointer like the other data members, as there's no need to copy it around.
* Stash `Bf' parameters into struct mdoc_bf.Kristaps Dzonsons2010-07-021-15/+4
|
* Lint fixes.Kristaps Dzonsons2010-07-021-2/+5
|
* Make struct_bl and struct_bd into pointers. This removes the need to doKristaps Dzonsons2010-07-011-22/+24
| | | | | | | | | | | copying on internals after modification. Even more importantly, if an ENDBODY token is provided, it would have been impossible for post-change copying of the data to take place in the BLOCK. This allows it to happen by dint of pointers. Also did some bikeshedding in mdoc_term.c: checking against enum type and explicitly casting to the "post" function to void. This is for my own readability.
* Improve .Nm indentation in the SYNOPSIS;Ingo Schwarze2010-07-011-2/+42
| | | | | | | kristaps@ will do the missing HTML part soon. "looks nicer" jmc@ "seems perfect to me" sobrado@ "slap it in" kristaps@
* More reality-checks for the p->end type.Kristaps Dzonsons2010-07-011-1/+1
|
* Support for badly nested blocks, written around the time ofIngo Schwarze2010-06-291-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | the Rostock mandoc hackathon and tested and polished since, supporting constructs like: .Ao Bo Ac Bc (exp breaking exp) .Aq Bo eol Bc (imp breaking exp) .Ao Bq Ac eol (exp breaking imp) .Ao Bo So Bc Ac Sc (double break, inner before outer) .Ao Bo So Ac Bc Sc (double break, outer before inner) .Ao Bo Ac So Bc Sc (broken breaker) .Ao Bo So Bc Do Ac Sc Dc (broken double breaker) There are still two known issues which are tricky: 1) Breaking two identical explicit blocks (Ao Bo Bo Ac or Aq Bo Bo eol) fails outright, triggering a bogus syntax error. 2) Breaking a block by two identical explicit blocks (Ao Ao Bo Ac Ac Bc or Ao Ao Bq Ac Ac eol) still has a minor rendering error left: "<ao1 <ao2 [bo ac2> ac1> bc]>" should not have the final ">". We can fix these later in the tree, let's not grow this diff too large. "get it in" kristaps@
* minor .Bk fixes:Ingo Schwarze2010-06-271-3/+13
| | | | | | | | * do not print invalid arguments verbatim (no groffs prints them, either) * do not trigger TERMP_PREKEEP twice * do not die from invlid arguments (groff won't die, either) * continue to ignore even valid arguments (just like groff) ok kristaps@ on the previous version, before removing my last bug ;)
* Following clue-stick applied by schwarze@, back out const-ness of regsetKristaps Dzonsons2010-06-271-6/+6
| | | | | | | | | passed in to libmdoc and libman. Fix mdoc.3 and man.3 EXAMPLE sections to include regset. Add MDOC_SYNPRETTY flag cueing front-end to nicely format certain values as if SEC_SYNOPSIS were the current section.
* Basic implementation of .Bk/.Ek; from OpenBSD.Ingo Schwarze2010-06-271-1/+21
| | | | OK and one stylistic tweak by kristaps@.
* Churn-ish check-in getting mdoc_parseln() and man_parseln() to accept aKristaps Dzonsons2010-06-261-0/+1
| | | | const struct regset pointer. No functionality.
* Initial chunks for variable-width fonts. Pushes all width calculationsKristaps Dzonsons2010-06-251-39/+41
| | | | | | | | in mdoc_term.c and man_term.c down into term.c. This is still not implemented in term.c, although stubs for width calculations are in place. From now on, offset, rmargin, and other layout variables are abstract screen widths. They will resolve to the the familiar values for -Tascii but -Tps will eventually use points instead of chars.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-1/+1
|
* Remove arg_getattrs(), as we only have arg_getattr()-like calls now thatKristaps Dzonsons2010-06-131-44/+14
| | | | -width is cached.
* Switch on cached -width usage in front-ends.Kristaps Dzonsons2010-06-131-9/+10
|
* Allow -width for lists to be cached in mdoc_bl. This requires someKristaps Dzonsons2010-06-131-0/+1
| | | | | | trickery because widths may be on-the-fly recalculated. I don't like how these are split between mdoc_action.c and mdoc_validate.c, but for the time being, it'll do.
* Cached `Bl -offset' into mdoc_bl. Removed erroneous "-offset defaultsKristaps Dzonsons2010-06-121-10/+10
| | | | | to 6n if no value is specified" and added regression tests for `Bl' testing against the empty -offset argument.
* Reverted to mdoc_term.c 1.149 (`It' does not inherit `Bl's cache,Kristaps Dzonsons2010-06-121-7/+10
| | | | | obviously, which was causing fallout) and again remove the loop code. Tested more thoroughly.
* Moved `Bl -compact' into cached data. This allowed the removal ofKristaps Dzonsons2010-06-121-10/+9
| | | | scanning the argv list in print_bvspace(), and thus the parent pointer.
* `Bl' is now using a struct instead of a single enum mdoc_list for itsKristaps Dzonsons2010-06-121-4/+5
| | | | cached values. You can probably guess where this is going.
* Cache all of `Bd's resolved arguments into mdoc_bd, which is stashed inKristaps Dzonsons2010-06-121-18/+15
| | | | | | the "data" union in mdoc_node. Allows me to remove some ugly loops in the front-end and duplicate tests in mdoc_action.c. Add a regression test to make sure we're not doing anything bad (more to come).