summaryrefslogtreecommitdiffstats
path: root/mdoc.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up {mdoc,man}_pmsg and vmsg invocations (ignore return values).Kristaps Dzonsons2011-01-011-14/+16
|
* Specifying both %T and %J in an `Rs' block causes the title to be quotedKristaps Dzonsons2010-12-251-0/+2
| | | | | 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-6/+44
| | | | | | | | 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-22/+6
| | | | | | | 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-0/+3
| | | | | 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-0/+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.
* Merge schwarze@'s relaxation of scope-breaking rules: allow implicitKristaps Dzonsons2010-12-061-3/+1
| | | | ending of scopes and drop stray scope-endings.
* Make sure that the manual section defaults to `1' if it's unset. ThisKristaps Dzonsons2010-12-011-0/+2
| | | | | behaviour only happens if `Dt' isn't specified, which can be exhibited by running mandoc -mdoc on a man manual.
* mdoc_action.c is no more. Attic it and remove it from the Makefile.Kristaps Dzonsons2010-11-301-4/+0
| | | | | Remove references to MDOC_ACTED (it was only assertions) and the pre- and post-action functions.
* Merge from OpenBSD right after 1.10.6; now back to full sync.Ingo Schwarze2010-09-271-7/+4
| | | | | | | | | | * 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@
* Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close scope. This isKristaps Dzonsons2010-08-291-2/+5
| | | | | | experimental and hasn't been rigorously tested. It's only implemented in -mdoc for the time being. This is absolutely required for pod2man. It does, however, make the pod2man preamble be processed in full.
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-29/+6
| | | | | | | | | | | | | | | | | 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.
* simplify the code copying the macro name, and sync theIngo Schwarze2010-08-081-8/+5
| | | | | accompagnying comment between man_pmacro() and mdoc_pmacro(); ok'd by kristaps@ together with main.c rev. 1.102
* Clean out the isgraph() checks in mdoc.c and man.c. These code pathsKristaps Dzonsons2010-08-071-12/+1
| | | | | were never taken since main.c begin skipping over unrecognisable characters, so they were noops.
* "Groff allows the initial macro on a line to be delimited by a space ofKristaps Dzonsons2010-08-071-6/+15
| | | | | by a tab; so allow the tab in mandoc, too." Original problem noted by schwarze@. Sync with OpenBSD.
* Text ending in a full stop, exclamation mark or question markIngo Schwarze2010-07-181-1/+1
| | | | | | | | | | | | | | | | | | should not flag the end of a sentence if: 1) The punctuation is followed by closing delimiters and not preceded by alphanumeric characters, like in "There is no full stop (.) in this sentence" or 2) The punctuation is a child of a macro and not preceded by alphanumeric characters, like in "There is no full stop .Pq \&. in this sentence" "looks fine" to kristaps@; 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.
* 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@
* Stash `Bf' parameters into struct mdoc_bf.Kristaps Dzonsons2010-07-021-0/+9
|
* Remove my own dumb FIXME and mark a static function defn as static.Kristaps Dzonsons2010-07-011-3/+2
|
* Make struct_bl and struct_bd into pointers. This removes the need to doKristaps Dzonsons2010-07-011-4/+12
| | | | | | | | | | | 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.
* In the mdoc(7) parser, inspect roff registers early such that all partsIngo Schwarze2010-07-011-14/+18
| | | | | | | | | | | | of the parser can use the resulting cues. In particular, this allows to use .nr nS to force SYNOPSIS-style .Nm indentation outside the SYNOPSIS as needed by ifconfig(8). To actually make this useable, .Pp must rewind .Nm, or the rest of the section would end up indented. Implement a quick hack for now, a generic solution can be designed later. ok kristaps@ and tested by sobrado@
* Support for badly nested blocks, written around the time ofIngo Schwarze2010-06-291-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Allow registers to be unset. Implement and document the `.nr nS val'.Kristaps Dzonsons2010-06-271-0/+9
|
* Following clue-stick applied by schwarze@, back out const-ness of regsetKristaps Dzonsons2010-06-271-2/+11
| | | | | | | | | 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-25/+17
| | | | | | | | | 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.
* Mechanical diff allowing the const struct regset to propogate throughKristaps Dzonsons2010-06-261-17/+25
| | | | libman and libmdoc.
* Churn-ish check-in getting mdoc_parseln() and man_parseln() to accept aKristaps Dzonsons2010-06-261-1/+3
| | | | const struct regset pointer. No functionality.
* `Bl' is now using a struct instead of a single enum mdoc_list for itsKristaps Dzonsons2010-06-121-4/+4
| | | | cached values. You can probably guess where this is going.
* Fixed my breaking of Ingo's eoln-whitespace detection code, where aKristaps Dzonsons2010-05-311-0/+1
| | | | | hyphen wasn't resetting the fact of being whitespace. Noted by Jason McIntyre.
* Macro lines now infer an `It' if they immediately follow a `Bl -column'Kristaps Dzonsons2010-05-311-10/+55
| | | | | | | or a closed-out `It' block within a `Bl -column' (which only happens when a macro or free-form text is encountered prior to an `It'). Added some regression tests for this behaviour.
* Strengthened constraint for passing into `It'.Kristaps Dzonsons2010-05-311-1/+2
| | | | Added regression test for constrained condition.
* Add ability to interpret initial free-form lines as part of a `BlKristaps Dzonsons2010-05-311-1/+25
| | | | | | | | -column' up until the first `It'. This is UGLY and should have all sorts of warnings, and will. On the one hand, it fits with groff's notion of tabs and tab-spaces. On the other hand, it's not really "free-form" text any more. Note that this does not yet accomodate for macros coming on these lines.
* Remove enum mdocargerr from phrase() (unused).Kristaps Dzonsons2010-05-311-1/+1
| | | | | | | | | | | | | | 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'.
* Made `Dt' default to LOCAL and UNKNOWN instead of local and unknown (note case).Kristaps Dzonsons2010-05-301-3/+3
| | | | | | | | Have `Dt' default to UNKNOWN if it's an empty string. Raise a warning if `Dt' title isn't capitalised. Sync'd `Dt' documentation with reality.
* Fixed `Lb' to be in_line (reported by Ulrich Spoerlein).Kristaps Dzonsons2010-05-261-0/+2
| | | | | | | | | Added `Lb' documentation to mdoc.7. Removed harmless but superfluous pre_lb check (was just NULL entries). Added regressions for `Lb' (NOTE that these will only run on new groff, as old groff doesn't support `Lb' at all).
* Modified version of Ingo Schwarze's patch for hyphen-breaking.Kristaps Dzonsons2010-05-251-0/+4
| | | | | | | Breakable hyphens are cued in the back-ends (with ASCII_HYPH) and acted upon in term.c or ignored in html.c. Also cleaned up XML decl printing (no need for extra vars).
* rewrite the main mdoc text parser, mdoc_ptext(),Ingo Schwarze2010-05-241-38/+51
| | | | | | | | making it easier to understand and fixing various bugs: * correctly strip whitespace from the end of text lines * issue consistent warnings regarding trailing spaces and tabs * escaped backslashes no longer escape the following character ok kristaps@
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-111/+25
| | | | | | | | | | | stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
* Allow roff_parseln() to be re-run.Kristaps Dzonsons2010-05-161-28/+30
| | | | | | | | | Allow roff_parseln() to manipulate the line buffer offset. This is used in situations like `.ie n .TH FOO 1' or `.ie n .ie n', where the line buffer offset is recalculated then the roff parser re-run. Fix mdoc_parseln() and man_parseln() to accept the initial line offset. WARNING: backed-out ALL roff macros whilst accomodating for how roff handles multi-line conditionals (in short, re-running the parser).
* Fix allowing silly '\'' control character.Kristaps Dzonsons2010-05-161-1/+1
|
* LIBRARY can also occur in section 9.Kristaps Dzonsons2010-05-151-1/+3
| | | | | | All manual sections (unknown, 3p, 3f, etc.) correctly handled by -mdoc. Useful warning printed if unknown manual section. Checking for manual sections (e.g., LIBRARY) checks only first character, so 3p, 3f, etc. are free.
* More EOS: append_delims() fitted with EOS detection, so ANY macro with ↵Kristaps Dzonsons2010-05-151-0/+2
| | | | | | appended delimiters will properly EOS. Fixed mandoc_eos() to accept sentence punctuation followed by close-delim buffers.
* Backed out check for `Ex' manual sec (ok schwarze@, joerg@), in turn backing ↵Kristaps Dzonsons2010-05-141-1/+0
| | | | out check_msec() and deps.
* Fixed bug in -Thtml -mdoc where `Lb' would line-break in LIBRARY section.Kristaps Dzonsons2010-05-131-4/+10
| | | | | Fixed assumption that parse-point == 1 equates to beginning of line (false if whitespace separates macro and control character). Fixed line-break for non-first-macro in several SYNOPSIS macros.
* Put the eos-checker into libmandoc.h.Kristaps Dzonsons2010-05-121-13/+1
| | | | Added bits in mdoc.7 and man.7 about EOS spacing.
* Tiny EOS patch. Back-end cues front-end through flag. Front-end cues ↵Kristaps Dzonsons2010-05-121-1/+27
| | | | output engine with flag.
* Fix asserts on stripping end-of-line whitespace.Kristaps Dzonsons2010-05-081-3/+1
|
* Strip trailing, unescaped whitespace from free-form, non-literal lines (like ↵Kristaps Dzonsons2010-05-081-3/+17
| | | | groff).
* Lint fixes (type-safety for enums via -cefuh).Kristaps Dzonsons2010-05-081-9/+11
|