summaryrefslogtreecommitdiffstats
path: root/mandoc.h
Commit message (Collapse)AuthorAgeFilesLines
* The post_nm() validation function crashed when the first .Nm child nodeIngo Schwarze2012-07-121-1/+1
| | | | | | | | | | was a non-text node. Fix this by rewriting post_nm() to always set the meta name to UNKNOWN when the name is missing or unusable. While here, make MANDOCERR_NONAME an ERROR, as it usually renders the page content unintelligible. Bug reported by Maxim <Belooussov at gmail dot com>, thanks. OpenBSD rev. 1.105
* Implement the roff \z escape sequence, intended to output the nextIngo Schwarze2012-05-311-1/+2
| | | | | | | | | | | | | | | | | | character without advancing the cursor position; implement it to simply skip the next character, as it will usually be overwritten. With this change, the pod2man(1) preamble user-defined string \*:, intended to render as a diaeresis or umlaut diacritic above the preceding character, is rendered in a slightly less ugly way, though still not correctly. It was rendered as "z.." and is now rendered as ".". Given that the definition of \*: uses elaborate manual \h positioning, there is little chance for mandoc(1) to ever render it correctly, but at least we can refrain from printing out a spurious "z", and we can make the \z do something semi-reasonable for easier cases. "just commit" kristaps@
* Do not handle vertical lines as additional tbl(7) columns,Ingo Schwarze2012-05-271-9/+2
| | | | | | | | | | | | | | | | instead save their properties with the following column. This simplifies layout parsing and saves a lot of code related to column handling. At output time, print all white space and vertical lines separating columns before printing the following column, and none after printing the preceding column, considerably simplifying white space handling and width calculations. No functional change, but it saves 150 lines of code, and it allows the next patch to tbl_term.c, tbl_literal(). "Please check them in and I'll look into them later!" kristaps@
* Support -Ios='OpenBSD 5.1' to override uname(3) as the source of theIngo Schwarze2012-05-271-2/+2
| | | | | | | | | | default value for the mdoc(7) .Os macro. Needed for man.cgi on the OpenBSD website. Problem with man.cgi first noticed by deraadt@; beck@ and deraadt@ agree with the way to solve the issue. "Please check them in and I'll look into them later!" kristaps@
* Add mparse_readmem, which allows application to run the parser directlyJoerg Sonnenberger2012-02-161-0/+2
| | | | from memory, e.g. after de-compressing a document.
* Const-ify some mchars arguments. I think these are non-const for historicalKristaps Dzonsons2011-11-081-2/+2
| | | | dumbness on my part.
* When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze2011-11-071-1/+0
| | | | | | | | do not abort with a FATAL error, but report a report a WARNING, remove the broken .TP from the syntax tree, and prod on. Reported repeatedly by ports people, at least by brad@ and jeremy@. Also fixes rendition(4) in Xenocara. ok kristaps@
* If -Tman is specified and input is -man, echo the preprocessed (`so'Kristaps Dzonsons2011-10-061-16/+17
| | | | | | | | | | | | | | replaced by file) input. This replaces earlier behaviour of doing nothing, which I found unexpected (mandoc should always output). This requires a buffer in read.c that saves the input lines before being parsed, with a special hook if `so' is invoked. This buffer is just flushed to output if -mman is the input. While mucking around doing this, I also alpha-ordered the mandoc.h functions. Ok schwarze@, with no screaming when the polished patch was published.
* Note GNU extensions in eqn.7. Also add `col' and `pile', which areKristaps Dzonsons2011-07-231-0/+2
| | | | | mentioned briefly in the eqn User's Manual, but otherwise are unspecified.
* Add support for tdefine and ndefine. Consolidate some error messages. AddKristaps Dzonsons2011-07-231-1/+1
| | | | somem more version notes (getting there). Have the equation nanme be captured.
* Add `fat' font. This pretty much brings us in line with the secondKristaps Dzonsons2011-07-231-0/+1
| | | | edition of eqn.
* Add matrix support. Also remove "above" notion, as all elements in aKristaps Dzonsons2011-07-231-2/+5
| | | | list are delimited by their "aboveness" and it's superfluous.
* Add support for `gsize' eqn token (introduced in second-edition troff).Kristaps Dzonsons2011-07-221-1/+0
|
* Give lists their own eqn function.Kristaps Dzonsons2011-07-221-1/+2
|
* Complete eqn.7 parsing. Features all productions from the original 1975Kristaps Dzonsons2011-07-211-4/+21
| | | | | | | | 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.
* Support `size' constructs in eqn.7. Generalise mandoc_strontou to thisKristaps Dzonsons2011-07-211-0/+2
| | | | effect.
* Full support for eqn positionals (above, over, sup, sub, etc.).Kristaps Dzonsons2011-07-211-0/+16
|
* Add eqn subexpression fonts.Kristaps Dzonsons2011-07-211-2/+11
|
* Add support for markers. These decorate the last box: see eqn.7.Kristaps Dzonsons2011-07-211-0/+14
|
* Support nested `{, }' subexpressions in eqn. Document in code.Kristaps Dzonsons2011-07-211-7/+14
|
* Flip eqn into using parsed nodes. I've temporarily disabled printingKristaps Dzonsons2011-07-211-2/+13
| | | | | | | these in the front-ends except for -Ttree, which will display the parsed tree. While here, fix that quoted strings aren't scanned for replacement parts.
* Finish the eqn syntactic parser. This correctly parses terms and doesKristaps Dzonsons2011-07-211-1/+1
| | | | | | | 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.
* Forgot to add these bits to the last commit.Kristaps Dzonsons2011-07-181-0/+1
|
* Provide implementations of `define', `set', and `unset'.Kristaps Dzonsons2011-07-171-0/+3
| | | | | | Tie them into the stream of data. Document these appropriate, bringing in the grammar as defined by the original eqn manual (Kernighan/Richie).
* Warn if equation `define' key is quoted (groff-ism).Kristaps Dzonsons2011-07-171-0/+3
|
* Expose mandoc_strdup() to the outside world.Kristaps Dzonsons2011-07-151-0/+1
|
* Remove all references to ESCAPE_PREDEF, which is now not exposed passedKristaps Dzonsons2011-05-241-3/+0
| | | | the libroff point. This clears up a nice chunk of code.
* Flip on unicode output (via \[uNNNN]) in -T[x]html. Here we go!Kristaps Dzonsons2011-05-171-0/+1
|
* Support groff's escape for Unicode input. SeeKristaps Dzonsons2011-05-151-0/+1
| | | | | | http://mdocml.bsd.lv/archives/tech/0368.html For the time being, we just throw it away.
* Make mchars_num2char() return a char like it says.Kristaps Dzonsons2011-04-301-1/+1
|
* Rename mchars_init() -> mchars_alloc() for consistency.Kristaps Dzonsons2011-04-301-1/+1
|
* Remove enum mcharst, which hasn't been used in quite some time.Kristaps Dzonsons2011-04-301-6/+1
|
* Move "chars" interface out of out.h and into mandoc.h. This doesn'tKristaps Dzonsons2011-04-291-0/+15
| | | | | | | | | | change any code but for renaming functions and types to be consistent with other mandoc.h stuff. The reason for moving into libmandoc is that the rendering of special characters is part of mandoc itself---not an external part. From mandoc(1)'s perspective, this changes nothing, but for other utilities, it's important to have these part of libmandoc. Note this isn't documented [yet] in mandoc.3 because there are some parts I'd like to change around beforehand.
* Remove a2roffdeco() and mandoc_special() functions and replace them withKristaps Dzonsons2011-04-091-0/+16
| | | | | | | | | | | | | | | | | | a public (mandoc.h) function mandoc_escape(), which merges the functionality of both prior functions. Reason: code duplication. The a2roffdeco() and mandoc_special() functions were pretty much the same thing and both quite complex. This allows one function to receive improvements in (e.g.) subexpression handling and performance, instead of having to replicate functionality. As such, the mandoc_escape() function already handles a superset of the escapes handled in previous versions and has improvements in performance (using strcspn(), for example) and reliable handling of subexpressions. This code Works For Me, but may need work to catch any regressions. Since the benefits are great (leaner code, simpler API), I'd rather have it in-tree than floating as a patch.
* Put mandocerrs and mandoclevels arrays into libmandoc with accessorsKristaps Dzonsons2011-03-281-0/+2
| | | | mparse_strerror() and mparse_strlevel().
* Make (e.g.) `SM' before `B' be only a warning. In reality, this refersKristaps Dzonsons2011-03-231-1/+1
| | | | | | | to ELINE macros ("next-line", but not unbreakable like the next-line paragraph macros) followed by other macros. This addresses a report by Christian Weisgerber, posted in the TODO by schwarze@, and aired on discuss@ (22/03/2011) for whether a fix is warranted.
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-18/+0
| | | | | | | | | 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 a FATAL error for when no manual type was assigned (you can repeatKristaps Dzonsons2011-03-221-0/+1
| | | | this for yourself by having a file consisting only of comments).
* Step 1 of restructuring: libmandoc.h. Move all compiler-set-specificKristaps Dzonsons2011-03-221-36/+0
| | | | | | | | | | 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.
* Let read.c worry about the currently-open file instead of having thisKristaps Dzonsons2011-03-201-4/+1
| | | | | | information duplicated in main.c. For the time being, remove evt_close and evt_open, as the only known mparse interface (main.c) doesn't need them.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-4/+4
| | | | | | | | | 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.
* Split the document parsing sequence out of main.c and into read.c,Kristaps Dzonsons2011-03-201-0/+25
| | | | | | | | putting the interface into mandoc.h. This effectively makes the function of main.c be command-line handling, invoking the parser, and sending its output to the output handler. The sequence of parsing (pfile(), pdesc(), etc.) has changed very little but for clean-up of some state variables (curp->fd, etc.).
* mandocmsg finally has no return value.Kristaps Dzonsons2011-03-171-1/+1
|
* Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows theKristaps Dzonsons2011-03-171-0/+18
| | | | | | removal of manual delimiter checks in html.c and term.c. Finally, add the escaped period as a closing delimiter, removing a TODO to this effect.
* Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.hKristaps Dzonsons2011-03-171-6/+6
| | | | | | | | so that everybody can use them. This follows the convention of libXXXX.h being internal to a library and XXXX.h being the external interface. Not only does this allow the removal of lots of redundant NULL-checking code, it also sets the tone for adding new mandoc-global routines.
* Clean up date handling,Ingo Schwarze2011-03-071-1/+2
| | | | | | | | | | | | 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-0/+2
| | | | the adding itself is implemented; equation data is not yet shown.
* Let the line-number of a tbl_span be remembered.Kristaps Dzonsons2011-02-061-0/+1
|
* Add initial EQN support to mandoc. This parses, then throws away, dataKristaps Dzonsons2011-02-061-0/+5
| | | | | | | | between EQ and EN roff blocks. EQN is different from TBL in that data after .EQ is unilaterally considered an equation until an .EN. Thus, there's no need to jump through hoops in having table spans and so on. This is ONLY the parse code framework in libroff. EQN is not yet passed into the backends.
* If `Ns' is specified on its own line, it should be ignored. This isKristaps Dzonsons2011-02-021-0/+1
| | | | | shitty groff behaviour. Do the same, but raise a warning to this effect. This from a TODO noted by schwarze@.