aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc.c
Commit message (Collapse)AuthorAgeFilesLines
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-51/+1
| | | | | | | | | 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().
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-9/+9
| | | | | | | | | 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.
* Tiny optimisation in mandoc_isdelim() check.Kristaps Dzonsons2011-03-171-3/+3
|
* Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows theKristaps Dzonsons2011-03-171-6/+52
| | | | | | 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.
* Make lint shut up a little bit.Kristaps Dzonsons2011-03-151-2/+2
|
* my $buf = "string"; return $string; is cool in Perl, but not in C;Ingo Schwarze2011-03-151-17/+23
| | | | | found by Ulrich Spoerlein <uqs at freebsd> using the clang static analyzer; "ok, but please document the numbers" kristaps@
* Clean up date handling,Ingo Schwarze2011-03-071-28/+47
| | | | | | | | | | | | 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@
* Unify roff macro argument parsing (in roff.c, roff_userdef()) and man macroIngo Schwarze2011-01-031-3/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | argument parsing (in man_argv.c, man_args()), both having different bugs, to use one common macro argument parser (in mandoc.c, mandoc_getarg()), because from the point of view of roff, man macros are just roff macros, hence their arguments are parsed in exactly the same way. While doing so, fix these bugs: * Escaped blanks (i.e. those preceded by an odd number of backslashes) were mishandled as argument separators in unquoted arguments to user-defined roff macros. * Unescaped blanks preceded by an even number of backslashes were not recognized as argument separators in unquoted arguments to man macros. * Escaped backslashes (i.e. pairs of backslashes) were not reduced to single backslashes both in unquoted and quoted arguments both to user-defined roff macros and to man macros. * Escaped quotes (i.e. pairs of quotes inside quoted arguments) were not reduced to single quotes in man macros. OK kristaps@ Note that mdoc macro argument parsing is yet another beast for no good reason and is probably afflicted by similar bugs. But i don't attempt to fix that right now because it is intricately entangled with lots of unrelated high-level mdoc(7) functionality, like delimiter handling and column list phrase handling. Disentagling that would waste too much time now.
* Churny commit to quiet lint. No functional changes.Kristaps Dzonsons2010-09-041-5/+5
|
* Remove overstrike `\o'. This isn't the best solution because we reallyKristaps Dzonsons2010-08-291-3/+3
| | | | | should be printing the contents, but for the time being, this is good enough.
* Handle nested, recursive mathematical subexpressions. This isKristaps Dzonsons2010-08-241-2/+25
| | | | | definitely not general, but it's good enough for pod2man definitions (after I clean up the roff, which will be addressed in later fixes).
* Strip out `\k' escape.Kristaps Dzonsons2010-08-241-2/+2
|
* Stripping out of `\w' groff escape. Yet another for pod2man...Kristaps Dzonsons2010-08-241-3/+7
|
* Strip out the `\z' escape. This is the first recursive sequence,Kristaps Dzonsons2010-08-241-1/+8
| | | | getting mandoc ready to handle pod2man's complex escapes.
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-5/+5
| | | | | | | | | | | | | | | | | 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.
* Add \v and \h to ignored escapes. These are in the category of \s.Kristaps Dzonsons2010-08-161-10/+12
| | | | | | Also made sign-less \s-style escapes be ok (this is technically against what's in the groff.7 manual, but seems pretty widespread). Noted by Thomas Jeunet as uglifying the gcc.1 manual.
* Ensure that isalnum is called with unsigned char argument.Joerg Sonnenberger2010-07-251-2/+2
|
* Accept "\s0" (i.e., properly ignore it). Found in the wild (e.g., gfdl.7).Kristaps Dzonsons2010-07-221-1/+4
|
* Accomodate for groff's crappy behaviour wherein an unrecognisedKristaps Dzonsons2010-07-211-2/+2
| | | | | | | | | | | | | single-character escape (and ONLY this type of escape) will map back into itself: "If a backslash is followed by a character that does not constitute a defined escape sequence the backslash is silently ignored and the character maps to itself." (From groff.7.) Found by Jason McIntyre.
* Throw out a2roffdeco() in out.c for a readable version. The prior oneKristaps Dzonsons2010-07-181-3/+62
| | | | | | | | | | | | | was completely unmaintainable. The new one is both readable and quite similar to mandoc_special(), which in future versions will easily allow throwing-away of unsupported escapes (such as \m). It's also a fair bit smaller. DECO_SIZE has been removed: this crap, like colours, will not be supported. mandoc_special() also has #if 0'd switch branches for ALL groff.7 escapes and some lint fixes.
* Text ending in a full stop, exclamation mark or question markIngo Schwarze2010-07-181-10/+13
| | | | | | | | | | | | | | | | | | 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@
* Clean up mandoc_special() (in order later to catch \m). It also flagsKristaps Dzonsons2010-07-181-151/+63
| | | | | | several syntactic errors that weren't caught before. Also un-puke chars.c on zero-length \[].
* Resurrect mandoc.c after bogus removal (was: libmandoc.c).Kristaps Dzonsons2010-07-061-0/+396
|
* Renamed mandoc.c to libmandoc.c. This is in the efforts of getting aKristaps Dzonsons2010-07-051-396/+0
| | | | | | | cleaner namespace for functions across the entire system (mandoc.h: getting parsed-string values, or declarations necessary for the AST data), and compiler functions (libmandoc.h: back-end functions and declarations).
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-2/+2
|
* Squash bug noted by Ulrich Spoerlein where "-" were being converted toKristaps Dzonsons2010-06-091-30/+54
| | | | | | | | | ASCII_HYPH, as per normal, but were screwing up mandoc_special(). Fixed by making mandoc_special() first check isspace() instead of ! isgraph(), then normalise its string as it passes out. This require de-constifying some validation routines not already de-constified (those in libman), but that's ok, because I'd like to be pushing actions into validation routines to save on space and redundant calculations.
* Fixed condition of `\}' closing a conditional at the start of the line.Kristaps Dzonsons2010-06-011-1/+3
| | | | | | | | Fixed flushed-out condition of \} causing subsequent arguments to be truncated, when in fact the whole line should be passed through (if the conditional succeeds) to the front-end and the \} ignored there. Added regression test of this behaviour.
* Modified version of Ingo Schwarze's patch for hyphen-breaking.Kristaps Dzonsons2010-05-251-1/+29
| | | | | | | 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).
* Documented EOS buffered spaces and added `]'.Kristaps Dzonsons2010-05-151-1/+3
|
* More EOS: append_delims() fitted with EOS detection, so ANY macro with ↵Kristaps Dzonsons2010-05-151-13/+27
| | | | | | appended delimiters will properly EOS. Fixed mandoc_eos() to accept sentence punctuation followed by close-delim buffers.
* Block-implicit macros now up-propogate end-of-sentence spacing. NOTE: GROFF ↵Kristaps Dzonsons2010-05-141-2/+3
| | | | IS NOT SMART ENOUGH TO DO THIS.
* Put the eos-checker into libmandoc.h.Kristaps Dzonsons2010-05-121-1/+24
| | | | Added bits in mdoc.7 and man.7 about EOS spacing.
* Add support/ignoring of \f(xy, \f[X...], \F(xy, \FX, \F[X...] roff-style ↵Kristaps Dzonsons2010-04-071-5/+5
| | | | font escapes (noted by Frantisek Holop).
* Removed references to `\\' escape (noted by Jason McIntyre, Ingo Schwarze).Kristaps Dzonsons2010-01-051-3/+1
|
* Big check-in of compatibility layer. This should work on most major ↵Kristaps Dzonsons2010-01-011-3/+3
| | | | architectures. Thanks to Joerg Sonnenberger.
* Documented that `\s' and `\f' don't work in HTML mode (and why).Kristaps Dzonsons2009-11-051-3/+80
| | | | Added support for recognising the many forms of `\s' (doesn't yet render).
* Added mandoc_a2time() for proper date conversion.Kristaps Dzonsons2009-11-021-1/+63
| | | | | Fitted TH and Dd handlers to use mandoc_a2time(). Documented date syntax for -man, fixed documentation for -mdoc.
* Using perror() instead of fprintf for failure from library functions.Kristaps Dzonsons2009-10-311-5/+5
|
* libmdoc and libman now using non-recoverable allocations (simpler code).Kristaps Dzonsons2009-10-301-14/+1
|
* Slow movement of internal allocations to fail completely.Kristaps Dzonsons2009-10-281-1/+74
|
* Added `sp' support to libman.Kristaps Dzonsons2009-07-241-1/+3
| | | | Added `\c' to known escapes (only used in man, but still).
* Fix for u_char, FreeBSD 7.2 (uqs@spoerlein.net).Kristaps Dzonsons2009-07-121-1/+3
|
* Moved escape validation into libmandoc.h/mandoc.c (common between ↵Kristaps Dzonsons2009-07-041-0/+101
libman/libmdoc1). libman supports MAN_IGN_ESCAPE (like MDOC_IGN_ESCAPE). All popular escapes now handled consistently.