summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Protect against malicious manual pages containing .ll requests withIngo Schwarze2018-05-201-0/+6
| | | | | | | | | | | | | | excessive arguments: apply the same cutoff as for the -O width= command line argument. While here, also place some assertions at strategical places to prevent excessive indentations from being printed in case of bugs. In the past, we had more than one bug that caused mandoc to print effectively infinite output, filling up people's /tmp/ file system, which is not funny. We cannot prevent bugs from crashing the program, but we can at least make filling up the disk less likely. Triggered by a remark from sthen@ on source-changes@.
* In a nutshell, all mobile browsers are broken.Ingo Schwarze2018-05-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, no matter the physical screen size, they use a fixed viewport width of about 1000px, then scale down the rendered page to make that huge viewport fit on the physical screen. That results in poor rendering for bad websites which assume a large fixed-size viewport (typically requiring zooming in to be able to actually read any text), but in atrocious rendering for good websites that make no assumption about the screen size (unreadably small text in the top left corner, most of the screen empty). A standard way to disable that insane behaviour and just render normally on the actual physical screen size does not exist. The closest thing is the CSS3 Device Adaptation Module Level 1 https://drafts.csswg.org/css-device-adapt/ but https://caniuse.com/#feat=css-deviceadaptation tells me that basically no browser implements it, not even on mobile. The next closest thing is the HTML meta viewport element - even though the problem has nothing to do with HTML and is purely a CSS issue. Standardization is not even planned for that one: * HTML 5.2 mentions it in passing without specifying it: https://www.w3.org/TR/html/document-metadata.html#the-meta-element * The Web Hypertext Application Technology Working Group provides very incomplete information: https://wiki.whatwg.org/wiki/MetaExtensions * CSS3 Device Adaptation Module Level 1 already wants to deprecate it, explaining mostly how to migrate *away* from it to some castle in the sky that no browser implements: https://drafts.csswg.org/css-device-adapt/#viewport-meta While i strongly believe in sticking to well-established standards, in the absence of standards and with atrocious behaviour being universal, there appears to be no alternative to using whatever works. The meta viewport element appears to be the only way to make real-world mobile browsers decently render any HTML page that does not have a fixed-width layout of 1000px. So use it, grudgingly. Originally suggested by xcv at dr dot com. Direction supported by espie@.
* Some broken terminal emulators (e.g. sakura) do the equivalentIngo Schwarze2018-05-141-1/+2
| | | | | | of "stty cols 0". Ignore that insanity rather than setting conf.output.width to an invalid value and embarking on infinite loops. Issue reported by Jesper Wallin <jesper at ifconfig dot se>, thanks!
* Fix a long-standing issue:Ingo Schwarze2018-05-094-16/+17
| | | | | | | | | Some macros (Nd, Oo) can contain blocks but rendered as elements that can only contain phrasing content, resulting in invalid HTML nesting. Switch them to <div>. Also move the related "display: inline" style from the HTML to the CSS. Reminded during a conversation with John Gardner.
* Eliminate the class=It-* attributes.Ingo Schwarze2018-05-085-78/+43
| | | | | Cleaner HTML, more idiomatic CSS, and minus 30 lines of C code. Suggested by John Gardner <gardnerjohng at gmail dot com>.
* Switch the emitted HTML element from <b> to <code> for the fixedIngo Schwarze2018-05-083-18/+40
| | | | | | | | syntax element macros .Nm, .Fl, .Cm, .Ic, .In, .Fd, .Fn, and .Cd. Adjust both the internal and external style sheets such that rendering remains unchanged in typical browsers. Based on feedback from John Gardner <gardnerjohng at gmail dot com>.
* Minor correction: we render HTML character references hexadecimal,Ingo Schwarze2018-05-031-1/+1
| | | | not decimal; bentley@ changed that in html.c on July 14, 2017.
* skip printing the embedded style sheet if an external style is referencedIngo Schwarze2018-05-011-5/+6
|
* Simpler description of output formats, shortening the manual page by 15 lines.Ingo Schwarze2018-04-291-99/+85
| | | | | | | Avoid the double redirection from -Tutf8 via -Tlocale to -Tascii. Add LC_CTYPE to the ENVIRONMENT section. While here, also correct a few inaccuracies and tweak some wordings. Triggered by a question from Laura Morales <lauretas at mail dot com>.
* Better mandoc(1) -I and -T options for Heirloom comparisons.Ingo Schwarze2018-04-241-7/+10
| | | | | | Filter through col(1) -b for Heirloom because it produces double encoding. Switch on mandoc(1) -Wall in groff comparisons. Update usage.
* multiple new entries from various sourcesIngo Schwarze2018-04-241-0/+41
|
* replace my vague and idiosyncratic term "selflink"Ingo Schwarze2018-04-243-14/+14
| | | | | with the clearer and more usual "permalink"; suggested by John Gardner <gardnerjohng at gmail dot com>
* dedup issuesIngo Schwarze2018-04-201-1/+6
|
* Tweak the description of -l:Ingo Schwarze2018-04-191-2/+3
| | | | | | | | | | | Avoid the misunderstanding that the essential purpose of -l is similar to the purpose of the -a option in mandoc(1), which is not the point: the fact that -l implies -a is merely a minor detail. The point of -l is to make man(1) behave like mandoc(1). Move the mention of -a to the end to de-emphasize it. Nate Bargmann reported that this seriously confused him, and i can see why.
* Compatibility with man-db:Ingo Schwarze2018-04-191-12/+56
| | | | | | | | | In page name mode (= man(1) default mode), also try to interpret names containing slashes as absolute or relative file names. Missing feature reported by Nate Bargmann on <groff at gnu dot org>, and the man-db maintainer Colin Watson <cjwatson at debian dot org> kindly explained to me how this is supposed to work.
* Use TIOCGWINSZ to reduce the default -Owidth during interactive useIngo Schwarze2018-04-132-5/+21
| | | | | | | on terminals narrower than 79 columns and the default -Oindent on terminals narrower than 66 columns. Requested by and feedback from pirofti@; mpi@ and juanfra@ also like the general direction.
* Make sure that mandoc only goes into UTF-8 mode if the user reallyIngo Schwarze2018-04-131-2/+14
| | | | | | selected UTF-8, not some other multibyte locale. This obviously makes no difference on OpenBSD but improves portability. Issue reported by <Nakayama at NetBSD> via wiz@.
* preserve comments before .Dd and .TH (typically Copyright and license)Ingo Schwarze2018-04-135-28/+83
| | | | | in full HTML output, but not with -Ofragment, e.g. in man.cgi(8); suggested by Thomas Klausner <wiz at NetBSD>
* preserve comments before .Dd when converting mdoc(7) to man(7)Ingo Schwarze2018-04-1111-25/+78
| | | | with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
* Two new low-level roff(7) features:Ingo Schwarze2018-04-106-26/+110
| | | | | | * .nr optional third argument (auto-increment step size) * \n+ and \n- numerical register auto-increment and -decrement bentley@ reported on Dec 9, 2013 that lang/sbcl(1) uses these.
* When accessing an undefined number register, define it to be zero, likeIngo Schwarze2018-04-095-25/+66
| | | | | | the previous commit for strings and macros, only technically simpler. Desired behaviour also mentioned by Werner Lemberg in 2011. This diff adds functionality but is -21 +19 LOC. :-)
* Using an undefined string or macro will cause it to be defined as empty.Ingo Schwarze2018-04-096-48/+191
| | | | | Observed by Werner Lemberg on Nov 14, 2011 and rotting on my TODO list ever since.
* Stop documenting the non-portable .R man(7) macro. Neither groffIngo Schwarze2018-04-051-15/+2
| | | | | nor the heirloom-doctools support it. Adding it was a mistake in the first place.
* Do not use a non-portable .R man(7) macro. Neither groff nor theIngo Schwarze2018-04-051-1/+1
| | | | | | heirloom-doctools support it. Work around the gap by using .BR with an empty first argument. This was noticed more than once in the past, but i always forgot to fix it.
* use the portable \(lq and \(rq internally rather than \(Lq and \(RqIngo Schwarze2018-04-053-47/+47
|
* For .Do/.Dq, use the documented and portable \(lq and \(rqIngo Schwarze2018-04-051-2/+2
| | | | | | | | | character escape sequences rather than the undocumented and non-portable \(Lq and \(Rq. Bug reported by Tim L <darkxst at github> via Thomas Klausner <wiz at NetBSD>; see https://github.com/nih-at/libzip/pull/42
* Ouch, fix previous: In the edge case of a single-character stringIngo Schwarze2018-03-161-1/+2
| | | | | containing nothing but a single hyphen, the pointer got incremented twice at one point, causing a read overrun found by naddy@.
* Style message about bad input encoding of em-dashes as -- instead of \(em.Ingo Schwarze2018-03-164-9/+74
| | | | Suggested by Thomas Klausner <wiz at NetBSD>; discussed with jmc@.
* Soften the language discouraging special character escape sequences.Ingo Schwarze2018-03-151-6/+20
| | | | | | | After i improved their ASCII renderings in groff and mandoc some time ago, mathematical symbols can now be used in specialised mathematical manual pages like libm and some X libraries. Tweaks and OK jmc@.
* Add strndup(3) compat implementation.Ingo Schwarze2018-02-274-1/+71
| | | | Jan Stary reports that MacOS X Snow Leopard and older lacks it.
* After opening a file with gzdopen(3), we have to call gzclose(3) orIngo Schwarze2018-02-231-6/+31
| | | | | | we leak memory internally used by zlib to keep compression state. Bug reported by Wolfgang Mueller <vehk at vehk dot de> who also provided an incomplete patch, part of which i'm using in this commit.
* clarify documentation of macro keysIngo Schwarze2018-02-231-0/+23
|
* Logically, the following are are type names - just like .Vt,Ingo Schwarze2018-02-231-5/+26
| | | | | | | | | | | | some of them with an optional variable name following: - .Ft - .Fa in the SYNOPSIS - .Fn second and later arguments in the SYNOPSIS So add these to the .Vt macro table in the mandoc.db(5) database. During my LibreSSL work, i'm getting really tired of typing $ man -k Vt,Ft,Fa=some_type_name over and over again; now, this becomes just: $ man -k Vt=some_type_name
* Invalidate the tag_files.tfd after fclose(3)ing the stram associatedIngo Schwarze2018-02-232-1/+4
| | | | | | with it. In main() assert that the tfd was actually invalidated. This avoids closing an invalid fd. From tb@; OK deraadt@ on an earlier version.
* In man(7) and cat pages, cut off excessive one line descriptions.Ingo Schwarze2018-02-071-2/+12
| | | | | An extreme example of how rogue files could mess up apropos(1) output was reported by bentley@: qwtlicense(3) in the x11/qwt port.
* Fix the mandoc_strndup() utility function. All existing callers seemIngo Schwarze2018-02-071-3/+3
| | | | | safe so far, but implementing it with an unchecked memcpy(3) is just wrong and quite dangerous.
* fix wrong dateIngo Schwarze2018-02-072-2/+2
|
* Delete the "no blank before trailing delimiter" check from theIngo Schwarze2018-02-0610-24/+8
| | | | | partial explicit macros. Leah Neukirchen <leah at vuxu dot org> rightfully points out that the check makes no sense for these macros.
* Remove the implicit display feature of .Lk because it was inconsistentIngo Schwarze2018-01-133-20/+2
| | | | | | | | | across output devices, counter-intuitive, and resulted in ugly output for many real-world manual pages. Always format even long links in-line. I already committed a similar change to groff. OK jmc@, bentley@, and the original author of the feature, Werner Lemberg <wl@gnu.org>.
* typo; from Alexander Kuleshov <kuleshovmail at gmail dot com>Ingo Schwarze2017-12-151-1/+1
|
* Recognize .Bl -column at parse time, and not only at validation time,Ingo Schwarze2017-11-291-9/+14
| | | | | | | even if other arguments precede -column. This is required because the .It parser needs to know whether or not we are a -column list. Fixes tree corruption leading to an assertion failure. Bug reported by bentley@.
* duplicate word, found by igor(1)Ingo Schwarze2017-11-281-1/+1
|
* streamline termp allocation: this will allow the init functionIngo Schwarze2017-11-101-14/+5
| | | | | to do things differently in the ps vs pdf case; from espie@
* be less assertive when warning about a possible typo;Ingo Schwarze2017-11-103-3/+3
| | | | from jca@, ok jmc@
* Shrink -Tps output by more than 50%Ingo Schwarze2017-11-022-15/+37
| | | | | | | | by using PostScript as a programming language. * Define and use one PostScript procedure to select each font. * Define and use procedures combining "use" and "show". * In one of these, reuse the current row if it did not change. Most ideas and most coding by espie@, tweaked by me.
* Print a human-readable media name in the %%DocumentMedia DSC commentIngo Schwarze2017-10-291-10/+27
| | | | | | | | | and use the setpagedevice PostScript operator to help printers automatically select the paper of the best matching PageSize. Many thanks to Mike Williams <obsd1 at eandem dot co dot uk> for teaching me about the relevant features of PostScript and DSC and for suggesting what to put into the first %%DocumentMedia argument.
* duplicate anchorsIngo Schwarze2017-10-281-0/+4
|
* more readable conversion of paper size from millimeters to PostScriptIngo Schwarze2017-10-261-2/+2
| | | | basic units, also slightly more precise
* The page footer line (psmarg) is created in ps_begin(), and theIngo Schwarze2017-10-251-2/+0
| | | | | | | | | | | last call writing to it is always ps_endline(), which ends with ps_pclose(), which prints "ET" (end text). Consequently, do not print another instance of "ET" in ps_closepage() after the footer line and before the "endstream" for the page. Fixing a PDF syntax error found while investigating the bug report from Jan Stary that also resulted in the previous commit.
* Properly close out the top-level Font object, the end-of-pageIngo Schwarze2017-10-251-3/+3
| | | | | | | Resource objects, and the Catalog object, fixing three PDF syntax errors that were present in every PDF file generated with mandoc since the initial checkin of the formatter in July 2010. Bug reported by Jan Stary <hans at stare dot cz> on misc@.