aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.h
Commit message (Collapse)AuthorAgeFilesLines
* Partial implementation of .Bd -centered.Ingo Schwarze2014-07-291-2/+2
| | | | | | | | | In groff, .Bd -centered operates in fill mode, which is relatively hard to implement, while this implementation operates in non-fill mode so far. As long as you pay attention that your lines do not overflow, it works. To make sure that rendering is the same for mandoc and groff, it is recommended to insert .br between lines for now. This implementation will need improvement later.
* Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,Ingo Schwarze2014-07-021-1/+2
| | | | | since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-10/+10
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Support the CONTEXT section for kernel manual pages found in Solaris andIngo Schwarze2014-03-311-1/+2
| | | | | OpenBSD manuals. It describes which contexts you can call functions in. from dlg@, ok jmc@ deraadt@
* Implement the roff(7) .ll (line length) request.Ingo Schwarze2014-03-301-1/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* If an .Nd block contains macros, avoid fragmented entries in mandocdb(8),Ingo Schwarze2014-03-231-1/+2
| | | | instead use the .Nd content recursively.
* When deciding whether two consecutive macros are on the same input line,Ingo Schwarze2013-12-241-1/+2
| | | | | | | | we have to compare the line where the first one *ends* (not where it begins) to the line where the second one starts. This fixes the bug that .Bk allowed output line breaks right after block macros spanning more than one input line, even when the next macro follows on the same line.
* Improve formatting of badly nested font blocks.Ingo Schwarze2012-11-161-1/+2
| | | | | | | | | | | | | | | | | The basic idea is to already pop the font at the end marker instead of allowing it to linger until the final end of the block. This requires a few preliminaries: * For each block, save a pointer to the previous font to be used in case the block breaks another and gets extended. * That requires making node information writable during rendering. * Now fonts may get popped in the wrong order; hence, after the stack has already been rewound further by some block that began earlier, ignore popping a font that was put on the stack later. * To be able to exploit all this for font blocks, tie processing to their body, not their block, which is more logical anyway. Triggered by florian@ reporting vaguely similar issues with list blocks.
* * implement -Tman .Bl -item -inset -diag -ohang -dash -hyphen -enum .ItIngo Schwarze2012-07-101-1/+2
| | | | | | | | | | * fix -Tman .Bl -bullet .It * adjust the -Tascii .Bl -bullet -dash -hyphen .It default and minimum width to new groff standards, it changed from 4n (in groff 1.15) to 2n (in groff 1.21) * same for -Tascii -enum, it changed from 5n to 2n * use -hang formatting for -Tascii -enum -width 2n * for -Tascii -enum, the default is -width 3n
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-1/+3
| | | | | | | | | error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
* Add some documentation and clean up mdoc.h/man.h.Kristaps Dzonsons2011-03-221-117/+76
|
* Step 1 of restructuring: libmandoc.h. Move all compiler-set-specificKristaps Dzonsons2011-03-221-10/+1
| | | | | | | | | | stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now used by read.c. The motivation behind this is to tighten the relationship between the underlying compilers while keeping parse data hidden from general callers (e.g., main.c). While here, also move register values from mandoc.h into libmandoc.h as noted by schwarze@. See above for explanation.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-2/+2
| | | | | | | | | libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the time being in libmandoc.h. This requires struct mparse to be passed into the allocation routines instead of mandocmsg and a void pointer. Then, move some of the functionality of the old mmsg() into read.c's mparse_mmsg() (check against wlevel and setting of file_status) and use main.c's mmsg() as simply a printing tool.
* Clean up date handling,Ingo Schwarze2011-03-071-3/+3
| | | | | | | | | | | | as a first step to get rid of the frequent petty warnings in this area: - always store dates as strings, not as seconds since the Epoch - for input, try the three most common formats everywhere - for unrecognized format, just pass the date though verbatim - when there is no date at all, still use the current date Originally triggered by a one-line patch from Tim van der Molen, <tbvdm at xs4all dot nl>, which is included here. Feedback and OK on manual parts from jmc@. "please check this in" kristaps@
* Allow EQN data to be pushed down into libmdoc via mdoc_addeqn(). OnlyKristaps Dzonsons2011-02-091-1/+4
| | | | the adding itself is implemented; equation data is not yet shown.
* Add initial libmdoc and libman top-most machinery for accepting TBLKristaps Dzonsons2011-02-061-1/+2
| | | | | directives. For now this will just ignore them (except for -Ttree, which just notes that an EQN's been accepted).
* If %B is specified, quote %T. Noted by schwarze@ in the TODO.Kristaps Dzonsons2011-01-251-2/+2
|
* Add table processing structures to -mdoc. This consists of anKristaps Dzonsons2011-01-011-1/+5
| | | | | | external-facing function mdoc_addspan(), then various bits to prohibit printing and scanning (this requires some if's to be converted into switch's).
* Whack MDOC_ACTED and MAN_ACTED (these no longer exist).Kristaps Dzonsons2010-12-261-2/+1
|
* Implement schwarze@'s much more elegant version of my %T/%J fix.Kristaps Dzonsons2010-12-251-2/+2
|
* Specifying both %T and %J in an `Rs' block causes the title to be quotedKristaps Dzonsons2010-12-251-1/+6
| | | | | instead of underlined. This only happens in -Tascii, as -T[x]html both underlines and italicises.
* As per schwarze@'s suggestions, roll back the refcount structure inKristaps Dzonsons2010-12-241-11/+2
| | | | | | | | favour of a simpler shim for normalised data in the node allocation and free routines. This removes the need to bump and copy references within validator handlers, removes a pointer redirect, and also kills the refcount structure itself. Data is assumed to "live" either in a MDOC_BLOCK or MDOC_ELEM and is copied accordingly.
* Implement reference-counted version of original union mdoc_data. ThisKristaps Dzonsons2010-12-221-7/+16
| | | | | | | simplifies clean-up and allows for more types without extra hassle. Also made in-line literal types in -T[x]html use CODE instead of SPAN to match how literal blocks use PRE.
* Migrate `An' to use a pointer in its data, like everybody else. This isKristaps Dzonsons2010-12-161-2/+2
| | | | | the first step to having a simpler ref-counted system for "data" associated with a node.
* Add a "last child" member of struct mdoc_node.Kristaps Dzonsons2010-12-151-1/+2
| | | | | | | Remove `Pp' or `Lp' if it is the FIRST or LAST child of an `Sh' or `Sh' body. Make "skipping paragraph" be an error, not a warning, as information (an invoked macro) is ignored.
* In-progress move from -T[x]html using DIVs for its lists to using DL,Kristaps Dzonsons2010-12-151-2/+3
| | | | | OL, and UL. Issue raised by Will Backman, solution proposed by schwarze@.
* Revert merging of {mdoc,man}.h -> mandoc.h.Kristaps Dzonsons2010-10-041-9/+386
| | | | While I'm add it, properly document all structures in these files.
* Unify mdoc and man enums and structs into mandoc.h. This is part of theKristaps Dzonsons2010-10-021-328/+1
| | | | | slow process of logically splitting formatting frontend and parser backend without pollution.
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-6/+2
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* Finally make mdoc argv CPP-defines into a proper enum.Kristaps Dzonsons2010-07-211-31/+32
|
* correct lots of copyright notices;Ingo Schwarze2010-07-131-2/+2
| | | | ok kristaps@
* Cache column sizes and char pointer into mdoc_bl. Finally get rid ofKristaps Dzonsons2010-07-041-1/+3
| | | | the loops here and there to track down the MDOC_Column arguments.
* Cached `An' arguments in struct mdoc_an. Note that this isn't aKristaps Dzonsons2010-07-021-1/+12
| | | | 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-2/+14
|
* Lint fixes.Kristaps Dzonsons2010-07-021-2/+2
|
* Make struct_bl and struct_bd into pointers. This removes the need to doKristaps Dzonsons2010-07-011-3/+3
| | | | | | | | | | | 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.
* Support for badly nested blocks, written around the time ofIngo Schwarze2010-06-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Following clue-stick applied by schwarze@, back out const-ness of regsetKristaps Dzonsons2010-06-271-2/+3
| | | | | | | | | 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.
* Downstream maintainers: this removes UGLY! I don't want divergingKristaps Dzonsons2010-06-271-7/+4
| | | | | | | | | functionality and UGLY works quite well thanks to schwarze@'s careful attention. This also backs out function-prototype changes for struct regset, instead stuffing a pointer to the regset directly into struct mdoc/man/roff.
* Churn-ish check-in getting mdoc_parseln() and man_parseln() to accept aKristaps Dzonsons2010-06-261-2/+4
| | | | const struct regset pointer. No functionality.
* First step of adding register support. This is inspired by a significantKristaps Dzonsons2010-06-261-1/+2
| | | | | | patch by schwarze@. This commit adds support to libroff parsing `nr' into register set defined in regs.h. This will propogate into libmdoc and libman in later commits.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-2/+2
|
* Allow -width for lists to be cached in mdoc_bl. This requires someKristaps Dzonsons2010-06-131-1/+2
| | | | | | 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-1/+2
| | | | | to 6n if no value is specified" and added regression tests for `Bl' testing against the empty -offset argument.
* Moved `Bl -compact' into cached data. This allowed the removal ofKristaps Dzonsons2010-06-121-5/+6
| | | | 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-2/+6
| | | | 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-2/+8
| | | | | | 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).
* Added enum mdoc_disp (similar to enum mdoc_list). Display types are nowKristaps Dzonsons2010-06-121-2/+12
| | | | | | | | | | | only calculated once in mdoc_validate.c. Noted that `Bd -file xxx' is not supported: it now raises a fatal warning. This is noted in mdoc.7. Empty `Bd' now defaults to LIST_ragged, which is not quite what groff does, but close enough (gross just throws away the `Bd' and gets upset when it encounters an `Ed').
* Remove enum mdocargerr from phrase() (unused).Kristaps Dzonsons2010-05-311-1/+2
| | | | | | | | | | | | | | Add `Ta' macro, which is basically a NULL case everywhere but in mdoc_macro.c, where it closes out an existing `It' body scope and opens a new one, then continues parsing as in phrase() (TODO: merge these two?). Fix where scope-breaking was silently just dying instead of printing an error. Fix where trailing `Ta' or tab weren't creating a new MDOC_BODY context. We now support arbitrarily complex `It' contents for `Bl -column'.
* Increase performance by stashing the list type in struct mdoc_node.Kristaps Dzonsons2010-05-171-1/+20
| | | | | | | This will eventually be used so that mdoc_macro can known whether to dump list line arguments into the body (`Bl -column' overflowing). Remove a2list() and arg_listtype() because of this.