pax_global_header00006660000000000000000000000064135305614360014520gustar00rootroot0000000000000052 comment=dd38295be983f130ba656c0e2c740ec8febf7e46 doclifter-2.19/000077500000000000000000000000001353056143600134265ustar00rootroot00000000000000doclifter-2.19/COPYING000066400000000000000000000025531353056143600144660ustar00rootroot00000000000000 COPYRIGHTS Copyright (c) 2002, 2003, 2007, and 2010 by Eric S. Raymond. BSD LICENSE Copyright (c) 2015, Eric S. Raymond All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. doclifter-2.19/Makefile000066400000000000000000000046101353056143600150670ustar00rootroot00000000000000# Makefile for the doclifter project VERSION=$(shell sed $(MANDIR)/doclifter.1.gz rm doclifter.1 doclifter.1: doclifter.xml xmlto man doclifter.xml manlifter.1: manlifter.xml xmlto man manlifter.xml doclifter.html: doclifter.xml xmlto xhtml-nochunks doclifter.xml manlifter.html: manlifter.xml xmlto xhtml-nochunks manlifter.xml doclifter-$(VERSION).tar.gz: $(SOURCES) mkdir doclifter-$(VERSION) cp -r $(SOURCES) doclifter-$(VERSION) tar -czf doclifter-$(VERSION).tar.gz doclifter-$(VERSION) rm -fr doclifter-$(VERSION) ls -l doclifter-$(VERSION).tar.gz doclifter-$(VERSION).md5: doclifter-$(VERSION).tar.gz @md5sum doclifter-$(VERSION).tar.gz >doclifter-$(VERSION).md5 check: @cd tests >/dev/null; make --quiet PYLINTOPTS = --rcfile=/dev/null --reports=n \ --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \ --dummy-variables-rgx='^_|^dummy' SUPPRESSIONS = "C0103,C0111,C0301,C0302,C0322,C0321,C0324,C0330,C1001,W0110,W0120,W0123,W0201,W0402,W0511,W0702,W0141,W1401,W0231,W0622,W0333,W0631,R0201,R0911,R0912,R0914,R0902,R0903,R0904,R0913,R0914,R0915,E1101" pylint: @pylint $(PYLINTOPTS) --disable=$(SUPPRESSIONS) doclifter pychecker: @echo "Expect 4 warnings." @ln -f doclifter doclifter.py @-pychecker --only --quiet --limit 50 doclifter.py @rm -f doclifter.py doclifter.pyc dist: doclifter-$(VERSION).tar.gz clean: rm -f doclifter.html manlifter.html doclifter.1 manlifter.1 rm -f *.pyc docliftertest.xml foobar* fixed* *~ bugs.html rm -f index.html *.tar.gz *.md5 *old release: doclifter-$(VERSION).tar.gz doclifter-$(VERSION).md5 doclifter.html manlifter.html shipper version=$(VERSION) | sh -e -x htmlclean: rm *.html refresh: htmlclean doclifter.html manlifter.html shipper -N -w version=$(VERSION) | sh -e -x # This is used only for updating the bugs page on my website. # It won't work for anyone else. REMOTE=esr@login.ibiblio.org UPDIR=/public/html/catb/esr/doclifter update: problemgen.py >bugs.html ssh $(REMOTE) rm -fr $(UPDIR)/prepatch scp -r bugs.html prepatch/ $(REMOTE):$(UPDIR) doclifter-2.19/PATCHES000066400000000000000000000561201353056143600144440ustar00rootroot00000000000000# All known problems with the manual pages in a desktop Ubuntu installation # # Send 1 was on 09 Dec 2003 # Send 2 was on 17 Feb 2004 # Send 3 was on 11 Jul 2004 # Send 4 was on 20 Nov 2004 # Send 5 was on 14 Jan 2005 # Send 6 was on 01 Jan 2007 # Send 7 was on 18 Jun 2013 # Send 8 was on 19 Feb 2016 # Send 9 was on 06 Jun 2018 # A Dot or single-quote at start of line turns it into a garbage command. This is a serious error; some lines of your page get silently lost when it is formatted. B ( ) notation for mandatory parts of command syntax should be { }. C Broken command synopsis syntax. This may mean you're using a construction in the command synopsis other than the standard [ ] | { }, or it may mean you have running text in the command synopsis section (the latter is not technically an error, but most cases of it are impossible to translate into DocBook markup), or it may mean the command syntax fails to match the description. D The .ce macro cannot be rendered in HTML, so I have replaced .ce before captions with an .RS/.RE bloxk including both caption and table. E My translator trips over a useless command in list markup. F Nonexistent or non-local .Sx target. G .Pp is structurally incorrect in an element list. H Renaming SYNOPSIS because either (a) third-party viewers and translators will try to interpret it as a command synopsis and become confused, or (b) it actually needs to be named "SYNOPSIS" with no modifier for function protoypes to be properly recognized. I Use of low-level troff hackery to set special indents or breaks can't be translated. The page will have rendering faults in HTML, and probably also under third-party man page browsers such as Xman, Rosetta, and the KDE help browser. This patch eliminates .br, .ta, .ti, .ce, .in, and \h in favor of requests like .RS/.RE that have structural translations. J Ambiguous or invalid backslash. This doesn't cause groff a problem. but it confuses doclifter and may confuse older troff implementations. K Renaming stock man macros throws warnings in doclifter and is likely to cause failures on third-party manual browsers. Please redo this page so it uses distinct names for the custom macros. L List syntax error. This means .IP, .TP or .RS/.RE markup is garbled. Common causes include .TP just before a section header, .TP entries with tags but no bodies, and mandoc lists with no trailing .El. These confuse doclifter, and may also mess up stricter man-page browsers like Xman and Rosetta. M Missing Feature Test Macros header N Extraneous . at start of line. O Command-line options described are not actually implemented. P Removed unnecessary \c that confused the doclifter parser. Q Missing Description header. R .ce markup can't be structurally translated, and is likely to cause rendering flaws in generated HTML. S DEPRECATED: in function syntax cannot be translated. Also, the code and examples need to be marked up better. T Junk at the beginning of the manual page. U Unbalanced group in command synopsis. You probably forgot to open or close a [ ] or { } group properly. W Missing or garbled name section. The most common form of garbling is a missing - or extra -. Or your manual page may have been generated by a tool that doesn't emit a NAME section as it should. Or your page may add running text such as a version or authorship banner. These problems make it impossible to lift the page to DocBook. They can also confuse third-party manpage browsers and some implementations of man -k. V .SS is not .SH and they cannot be used interchangeably. You get away with this by accident in roff, but it will badly confuse other tools that look at man pages. X Unknown or invalid macro. That is, one that does not fit in the macro set that the man page seems to be using. This is a serious error; it often means part of your text is being lost or rendered incorrectly. Y I have been unable to identify an upstream maintainer for this Ubuntu/Debian package, and am notifying the generic "Maintainer" address in the package. Please forward appropriately. Also please fix the package metadata so it identifies the upstream maintainers. Z Your Synopsis is exceptionally creative. Unfortunately, that means it cannot be translated to structural markup even when things like running-text inclusions have been moved elswhere. a Incorrect use of BSD list syntax confused doclifter's parser. b \c is an obscure feature; third-party viewers sometimes don't intepret it. Plain \ is safer. c Function declarations had to be modified in order to fit into the DocBook DTD. This is not an error in troff usage, but it reduces the quality of the HTML that can be generated from this page through the DocBook toolchain. d .eo/.ec and complex tab-stop hackery can't be translated to XML/HTML and are almost certain to confuse third-party readers such as Rosetta and Xman. e Macro definitions in the NAME section confuse doclifter and are likely to screw up third-party man viewers with their own parsers. f Presentation-level use of .SS could not be structurally translated. I changed lower-level instances to .TP or .B. g Use of a double quote for inch measurements often confuses people who aren't from the Anglosphere. h Unbalanced .RS or .EE i Non-ASCII character in document synopsis can't be parsed. j Parenthesized comments in command synopsis. This is impossible to translate to DocBook. k Misspelled macro name. l Invalid or unterminated font escape. m Contains a request or escape that is outside the portable subset that can be rendered by non-groff viewers such as the KDE and GNOME help browsers. n C function syntax has extra or missing paren. o TBL markup not used where it should be. Tables stitched together with .ta or list requests can't be lifted to DocBook and will often choke third-party viewers such as TKMan, XMan, Rosetta, etc. p Garbage trailiing \ in function synopsis. q The .ul request used here can't be translated into document structure. I put these files in a hanging list, which can be. r I supplied a missing mail address. Without it, the .TP at the end of the authors list was ill-formed. s Changed page to use the .URL macro now preferred on man(7). t Synopsis has to be immediately after NAME section for DocBook translation to work. u Use local definitions of .EX/.EE or .DS/.DE to avoid low-level troff requests in the page body. There are plans to add these to groff man; in the interim, this patch adds a compatible definition to your page. v .in and .EX have crossed or inverted scopes. w .SS markup in name section seriously confuses parsing, and sections don't follow standard naming conventions. x Syntax had to be rearranged because of an options callout. This is still excessively complicated; third-party man-page viewers are likely to choke on it. y This page was generated from some sort of non-man markup. Please fix the upstream markup so that it generates a well-formed manual page with the indicated corrections. z Garbled comment syntax. %% b|acl.5 |I |https://savannah.nongnu.org/bugs/index.php?39096 s|afmtodit.1 |k |bug-groff@gnu.org b|american.5,english.5 | |geoff@cs.hmc.edu 3n|analog.1 |CZ |analog-author@lists.meer.net 2n|AnyEvent::FAQ.3pm |W |Marc Lehmann 1n|audispd.8 |* |sgrubb@redhat.com 1n|autosp.1 |Q |Bob Tennent 2n|B::Hooks::EndOfScope::PP.3pm,B::Hooks::EndOfScope::XS.3pm|W |Florian Ragwitz 2n|bash.1 |L |chet.ramey@case.edu, bug-bash@gnu.org 3n|btcflash.8 |J |Daniel Baumann 1n|BUF_MEM_free.3ssl,BUF_MEM_grow.3ssl,BUF_MEM_grow_clean.3ssl,BUF_MEM_new.3ssl,BUF_MEM_new_ex.3ssl,BUF_reverse.3ssl|W |kurt@openssl.org p|bzfs.6 |o |https://github.com/BZFlag-Dev/bzflag/pull/149 3n|bzr.1,bzr.bzr.1 |JX |bazaar@lists.canonical.com b|calc_tickadj.1 |C | p|c_rehash.1ssl,openssl-c_rehash.1ssl,openssl-rehash.1ssl,rehash.1ssl |W |https://github.com/openssl/openssl/pull/6267 1n|calendar.1 |X |Debian Bsdmainutils Team 3n|cdparanoia.1 |L |paranoia-dev@xiph.org b|cgroups.7,cgroup_namespaces.7|v |https://github.com/mkerrisk/man-pages/pull/10 b|cherryd.1 |l | b|chmoddic.1 |BC |Canna@nec.co.jp 3n|chroot.2 |EL |bug-coreutils@gnu.org 2n|claws-mail.1 |L |paul@claws-mail.org p|cmake.1 |B |https://gitlab.kitware.com/cmake/cmake/issues/17917 1n|CPAN::Meta::History::Meta_1_2.3pm,CPAN::Meta::History::Meta_1_3.3pm,CPAN::Meta::History::Meta_1_4.3pm|t |Ken Williams b|co.1,ident.1 |o |rcs-bugs@gnu.org p|cpio.1 |l |bug-cpio@gnu.org 1n|codepage.1 |C |kbd@lists.altlinux.org 3n|compose.1,edit.1 |*y |mime-support@plessy.org 1n|CURLOPT_PROXY_CAPATH.3|XY |Ubuntu Developers n|CURLMOPT_SOCKETFUNCTION.3|* |Ubuntu Developers 3n|dash.1,sh.1,sh.distrib.1|J |dash@vger.kernel.orgiq p|DECLARE_LHASH_OF.3ssl,OPENSSL_LH_COMPFUNC.3ssl,OPENSSL_LH_HASHFUNC.3ssl,OPENSSL_LH_DOALL_FUNC.3ssl,LHASH_DOALL_ARG_FN_TYPE.3ssl,IMPLEMENT_LHASH_HASH_FN.3ssl,IMPLEMENT_LHASH_COMP_FN.3ssl,lh_TYPE_new.3ssl,lh_TYPE_free.3ssl,lh_TYPE_insert.3ssl,lh_TYPE_delete.3ssl,lh_TYPE_retrieve.3ssl,lh_TYPE_doall.3ssl,lh_TYPE_doall_arg.3ssl,lh_TYPE_error.3ssl | |kurt@openssl.org s|DEFINE_STACK_OF.3ssl,DEFINE_SPECIAL_STACK_OF.3ssl,DEFINE_STACK_OF_CONST.3ssl,DEFINE_SPECIAL_STACK_OF_CONST.3ssl,OPENSSL_sk_deep_copy.3ssl,OPENSSL_sk_delete.3ssl,OPENSSL_sk_delete_ptr.3ssl,OPENSSL_sk_dup.3ssl,OPENSSL_sk_find.3ssl,OPENSSL_sk_find_ex.3ssl,OPENSSL_sk_free.3ssl,OPENSSL_sk_insert.3ssl,OPENSSL_sk_is_sorted.3ssl,OPENSSL_sk_new.3ssl,OPENSSL_sk_new_null.3ssl,OPENSSL_sk_num.3ssl,OPENSSL_sk_pop.3ssl,OPENSSL_sk_pop_free.3ssl,OPENSSL_sk_push.3ssl,OPENSSL_sk_set.3ssl,OPENSSL_sk_set_cmp_func.3ssl,OPENSSL_sk_shift.3ssl,OPENSSL_sk_sort.3ssl,OPENSSL_sk_unshift.3ssl,OPENSSL_sk_value.3ssl,OPENSSL_sk.3ssl,zero.3ssl,sk_TYPE_num.3ssl,sk_TYPE_value.3ssl,sk_TYPE_new.3ssl,sk_TYPE_new_null.3ssl,sk_TYPE_free.3ssl,sk_TYPE_zero.3ssl,sk_TYPE_delete.3ssl,sk_TYPE_delete_ptr.3ssl,sk_TYPE_push.3ssl,sk_TYPE_unshift.3ssl,sk_TYPE_pop.3ssl,sk_TYPE_shift.3ssl,sk_TYPE_pop_free.3ssl,sk_TYPE_insert.3ssl,sk_TYPE_set.3ssl,sk_TYPE_find.3ssl,sk_TYPE_find_ex.3ssl,sk_TYPE_sort.3ssl,sk_TYPE_is_sorted.3ssl,sk_TYPE_dup.3ssl,sk_TYPE_deep_copy.3ssl,sk_TYPE_set_cmp_func.3ssl|n |kurt@openssl.org b|Parse::DebControl::Error.3pm|Wy | 1n|devlink.8 |C |netdev@vger.kernel.orgq s|devnag.1 |J |tex-live@tug.org s|dh_install.1 |iy | p|dhclient.8 |U |dhcp-bugs@isc.org 3n|dkms.8 |XJ |dkms-devel@dell.com 2n|dmcs.1,mcs.1,gmcs.1 |LA |mono-docs-list@lists.ximian.com 1n|dmstats.8 |C |Bryn M. Reeves b|dosbox.1 |L | 1n|driverless.1 |L |cups-devel@cups.org b|dump-acct.8 |U |https://savannah.gnu.org/bugs/index.php?54040 b|dv2dt.1 |C | 4n|dvipdf.1,font2c.1 |R |epm@easysw.com 2n|edgepaint.1 |W |Yifan Hu p|editres.1 |I |xorg-devel@lists.freedesktop.org 4n|e2fsck.8 |o |tytso@thunk.org 3n|e2image.8 |J |tytso@thunk.org 4n|efax.1 |Jug |edc@cce.com s|eqn.1,geqn.1 | |bug-groff@gnu.org 2n|irb.1,irb2.5.1 |a |ruby-doc@ruby-lang.org 1n|ethtool.8 |P |netdev@vger.kernel.org p|exiv2.1 |L |robin@clanmills.com p|extractres.1 |R |https://github.com/rrthomas/psutils/pull/4 3n|f2py.1,f2py2.7.1 |C |f2py-users@cens.ioc.ee 3n|faked-sysv.1,faked-tcp.1,faked.1,fakeroot-sysv.1,fakeroot-tcp.1,fakeroot.1|r |schizo@debian.org b|feature_test_macros.7 |I |mtk-manpages@gmx.net 3n|formail.1,lockfile.1,procmail.1,procmailex.5,procmailrc.5,procmailsc.5|K |srb@cuci.nl,guenther@sendmail.com p|fsck.ext2.8,fsck.ext3.8,fsck.ext4.8,fsck.ext4dev.8|o |http://userweb.kernel.org/~kzak/util-linux/ 2n|fuzzyflakes.6x |C |Barry Dmytro 1n|fwup_get_fw_type.3,fwup_get_fw_version.3,fwup_get_guid.3.gz,fwup_get_last_attempt_info.3,fwup_get_lowest_supported_version.3,fwup_get_ux_capsule_info.3,fwup_resource_iter_create.3,fwup_resource_iter_destroy.3,fwup_resource_iter_next.3,fwup_resource_iter_next.3,fwup_set_up_update.3,fwup_supported.3,libfwup.3,fwup_clear_status.3,fwup_get_guid.3,libfwup.h.3 |IXc |Peter Jones 3n|gacutil.1,cli-gacutil.1|N |mono-docs-list@lists.ximian.com s|gdiffmk.1 |Wk |bug-groff@gnu.org 3n|genisoimage.1 |oy |Ubuntu Developers s|getafm.1 |R | 1n|getty.8,agetty.8 |m |Ubuntu Developers b|gftodvi.1 |I | p|gource.1 |C |https://github.com/acaudwell/Gource/pull/155 3n|gpm-types.7 |JC |gpm@lists.linux.it p|grn.1 |J |bug-groff@gnu.org s|groff.1 | |bug-groff@gnu.org s|groff_char.7 | |bug-groff@gnu.org s|groff_man.7 | |bug-groff@gnu.org s|groff_tmac.5 | |bug-groff@gnu.org s|groffer.1 | |bug-groff@gnu.org s|grog.1 | |bug-groff@gnu.org s|gropdf.1 | |bug-groff@gnu.org s|gtbl.1,tbl.1 |* |bug-groff@gnu.org b|gthumb.1 |L | b|gvcolor.1 |C |https://gitlab.com/graphviz/graphviz/issues/1384 b|gvpack.1 |C |https://gitlab.com/graphviz/graphviz/issues/1385 1n|hddtemp.8 |L* |hddtemp-dev@nongnu.org 8n|hfsutils.1 |HJ |Robert Leslie b|hosts_access.5,hosts.allow.5,hosts.deny.5,hosts_options.5|I |Wietse Venema 1n|hp-logcapture.1 |Z |Ubuntu Developers b|html2text.1 |C |Eugene V. Lyubimkin b|html2textrc.5 |X | 3n|hypertorus.6x |C |Jamie Zawinski 4n|icclink.1 |E |malex@debian.org 3n|icctrans.1 |L |malex@debian.org 4n|tifficc.1 |E |malex@debian.org 3n|icedax.1 |AI |Heiko Eissfeldt , debburn-devel@lists.alioth.debian.org 3n|ilbmtoppm.1 |L |bryanh@giraffe-data.com p|includeres.1 |R |https://github.com/rrthomas/psutils/pull/4 b|inode.7 |I |https://github.com/mkerrisk/man-pages/pull/10 3n|intel_panel_fitter.1 |E |intel-gfx@lists.freedesktop.org 1n|inxi.1 |Cl |https://github.com/smxi/inxi/issues/147 3n|IO::WrapTie.3pm |WC |David F. Skoll 4n|ipppd.8 |L |keil@isdn4linux.de 2n|iptables-extensions.8 |JLU |netfilter-devel@lists.netfilter.org s|ipv6calc.8,ipv6logconv.8,ipv6logstats.8,ipv6loganon.8 |L |pb@bieringer.de 3n|irda.7 |c |Jean Tourrilhes 3n|ispell.1,buildhash.1,munchlist.1,findaffix.1,tryaffix.1,icombine.1,ijoin.1|C |ispell-bugs@itcorp.com 3n|ispell-wrapper.1 |C |ispell-bugs@itcorp.com 3n|lamd.1 | |lam-devel@lam-mpi.org 3n|lam.7,LAM.7 |L |lam-devel@lam-mpi.org 3n|lam-helpfile.5 |I |lam-devel@lam-mpi.org b|lastcomm.1 |I |https://savannah.gnu.org/bugs/index.php?39134 p|lgftp.1 |I |lav@yars.free.net 3n|libcaca-authors.3caca|W |Sam Hocevar 3n|libcaca-canvas.3caca |WJ |Sam Hocevar 3n|libcaca-env.3caca |WL |Sam Hocevar 3n|libcaca-font.3caca |WJ |Sam Hocevar 3n|libcaca-ruby.3caca |W |Sam Hocevar 3n|libcaca-tutorial.3caca|W |Sam Hocevar p|libinput.4 |L |xorg-devel@lists.freedesktop.org p|libpng.3 |SJ |png-mng-implement@lists.sourceforge.net 3n|libtiff.3tiff |I |tiff@lists.maptools.org 1n|linkicc.1,transicc.1 |L |Shiju p. Nair , info@littlecm1s.com 1n| List::Compare::Functional.3pm|HY |Ubuntu Developers 3n|list_audio_tracks.1 |W |Heiko Eissfeldt , debburn-devel@lists.alioth.debian.org 4n|ln.1 |j |bug-coreutils@gnu.org 1n|loadkeys.1 |U |kbd@lists.altlinux.org 3n|locate.findutils.1 |U |bug-findutils@gnu.org 1n|logilab-pytest.1 |Zw |python-projects@lists.logilab.org 8n|lpr.1 |U |papowell@lprng.com 1n|lynx.1,www-browser.1 |I |lynx-dev@nongnu.org 1n|mailx.1posix |l |mtk-manpages@gmx.net 3n|makeindex.1 |J |beebe@math.utah.edu p|mathspic.1 |JWt |Dick Nickalls 3n|mawk.1 |R |http://code.google.com/p/original-mawk/issues/detail?id=21&thanks=21&ts=1369758804 b|mdoc.7 |X |mtk-manpages@gmx.net 2n|mke2fs.8,mkfs.ext2.8,mkfs.ext3.8,mkfs.ext4.8,mkfs.ext4dev.8|C |Theodore Ts'o . 3n|mkjobtexmf.1 |Ly |heiko.oberdiek@gmail.com 2n|mmcli.8 |X |Martyn Russell 3n|mono.1,cli.1 |JX |mono-docs-list@lists.ximian.com 3n|mono-config.5 |X |mono-docs-list@lists.ximian.com 3n|mpirun.1,mpirun.lam.1|L |lam-devel@lam-mpi.org 1n|mplayer.1 |CL |diego@biurrun.de 3n|mtools.5,mtools.conf.5|X |info-mtools@gnu.org b|mtr.8 |J |https://bugs.launchpad.net/mtr/+bug/1188596 2n|namespaces.7 |I |Michael Kerrisk 2n|nautilus.1 |L |Ubuntu Desktop Team 3n|nautilus-connect-server.1|L|nautilus-list@gnome.org 3n|netpbm.1 |J |bryanh@giraffe-data.com b|netstat.8 |f |https://sourceforge.net/p/net-tools/bugs/41/ 1n|nfsmount.conf.5 |CY |ubuntu-devel-discuss@lists.ubuntu.com 2n|nmcli.1 |CLf |networkmanager-list@gnome.org 2n|nsenter.1 |L |Eric Biederman 3n|nsgmls.1 |CI |James Clark 3n|ntfs-3g.secaudit.8 |C |ntfs-3g-devel@lists.sf.net 3n|ntfs-3g.usermap.8 |C |ntfs-3g-devel@lists.sf.net 1n|ntfssecaudit.8 |CY |Ubuntu Developers s|ntp-wait.8,ntp-keygen.8,ntp.keys.5|C | 3n|nvidia-settings.1 |IxY |ubuntu-devel-discuss@lists.ubuntu.com 3n|nvidia-smi.1 |IfY |ubuntu-devel-discuss@lists.ubuntu.com p|objcopy.1,objdump.1,x86_64-linux-gnu-objcopy.1,x86_64-linux-gnu-objdump.1 |U |bug-binutils@gnu.org 3n|ode.1 |e |bug-plotutils@gnu.org 3n|omfonts.1 |W |Norbert Preining 4n|openvt.1,open.1 |L |aeb@cwi.nl 3n|orbd.1 |WyY |ubuntu-devel-discuss@lists.ubuntu.com 3n|orca.1 |s |orca-list@gnome.org b|pandoc.1 |J |http://johnmacfarlane.net/ 3n|pax.1posix |DX |Francesco Paolo Lovergine ,mtk.manpages@gmail.com 1n|qsub.1posix |D |mtk.manpages@gmail.com 3n|pbmclean.1,pnmcomp.1,pnmnorm.1,pnmpad.1,pnmquant.1,pnmremap.1,pnmtotiff.1,pgmnorm.1,ppmcolors.1,ppmnorm.1,ppmntsc.1,ppmquant.1,ppmrainbow.1,ppmtogif.1,ppmtoxpm.1,tifftopnm.1|C |bryanh@giraffe-data.com 3n|pbget.1,pbput.1,pbputs.1 |W |Dustin Kirkland 3n|pbmtextps.1 |C |Bryan Henderson 3n|pcap-filter.7 |I |tcpdump-workers@lists.tcpdump.org p|pdfroff.1 |X |bug-groff@gnu.org 1n|pdcp.1 |J |garlick@llnl.gov 1n|pdsh.1,pdsh.bin.1 |J |garlick@llnl.gov 1n|rpdcp.1 |z |garlick@llnl.gov 3n|pidgin.1 |T |Sean Egan , Ben Tegarden , John Bailey 3n|plot.1,plotfont.1 |W |bug-plotutils@gnu.org 3n|pnmhisteq.1,ppmcie.1,ppmlabel.1,sbigtopgm.1|R |Bryan Henderson 3n|pnmpaste.1 |X |Bryan Henderson 3n|pnmtotiffcmyk.1 |C |Bryan Henderson 3n|pnmtofiasco.1 |e |Bryan Henderson 3n|policytool.1 |Wy |openjdk@lists.launchpad.net 1n|postqueue.1 |C |Wietse Venema s|preconv.1 | |bug-groff@gnu.org 2n|prlimit.1 |U |Davidlohr Bueso b|proc.5,procfs.5 |vL |https://github.com/mkerrisk/man-pages/pull/10 b|pstree.1,pstree.x11.1 |C |Craig Small b|pstops.1 |R | b|ps2epsi.1 |j | b|ps2pdfwr.1 |R | 2n|pylint.1 |J |code-quality@python.org 2n|rake2.1.1 |L |ruby-doc@ruby-lang.org b|random.7 |m |mtk-manpages@gmx.net b|rcsfile.5 |d |rcs-bugs@gnu.org 1n|rdma.8 |C |Leon Romanovsky s|refer.1 | |bug-groff@gnu.org 3n|regulatory.bin.5 |w |linux-wireless@vger.kernel.org 2n|request-key.8 |q |David Howells 2n|request-key.conf.5 |q |David Howells b|rexec.3,rexec_af.3 |M |mtk-manpages@gmx.net 3n|rhythmbox-client.1 |L |Sven Arvidsson , gnome-doc-list@gnome.org 1n|ri.1,ri2.5.1 |G |ruby-doc@ruby-lang.org b|rlog.1 |L |rcs-bugs@gnu.org 3n|rlwrap.1,readline-editor.1|J |Chet Ramey 3n|rmid.1 |Wy |openjdk@lists.launchpad.net 3n|rmiregistry.1 |Wy |openjdk@lists.launchpad.net s|roff.7 | |bug-groff@gnu.org b|rotatelogs.8 |L*< | p|s3.4 |I |xorg-devel@lists.freedesktop.org 1n|sane-lexmark.5 |L |https://alioth.debian.org/tracker/index.php?func=detail&aid=315955&group_id=30186&atid=410366 1n|scapy.1 |l |Philippe Biondi p|screen.1 |LI |screen-devel@gnu.org b|SDL_Init.3 |L |sdl@lists.libsdl.org b|SDL_CDPlayTracks.3 |n |docs@lists.libsdl.org b|seccomp.2 |h |https://github.com/mkerrisk/man-pages/pull/10 3n|see.1,run-mailcap.1,print.1 |C |mime-support@plessy.org 2n|semanage-user.8,semanage-boolean.8,semanage-module.8,semanage-permissive.8|B |Daniel Walsh 2n|semanage-fcontext.8 |BU |Daniel Walsh b|semop.2,semtimedop.2 |v |https://github.com/mkerrisk/man-pages/pull/10 p|setcap.8 |C |Andrew G. Morgan 2n|sg_xcopy.8 |l |Douglas Gilbert 3n|sgmlspl.1 |L |Ardo van Rangelrooij b|slapd.conf.5 |LI |OpenLDAP-devel@OpenLDAP.org b|slapd-config.5 |LI |OpenLDAP-devel@OpenLDAP.org b|slapo-constraint.5 |L |OpenLDAP-devel@OpenLDAP.org b|slapo-retcode.5 |C |OpenLDAP-devel@OpenLDAP.org b|software-properties-gtk.1 |W | 3n|spam.1 |C | b|ssh_config.5,sshd_config.5|F | 1n|SSL_get_cipher_name.3ssl,SSL_get_current_cipher.3ssl,SSL_get_cipher_bits.3ssl, SSL_get_cipher_version.3ssl|p |kurt@openssl.org 1n|suffixes.7 |l |Michael Kerrisk 1n|synctex.1 |L |tex-live@tug.org b|sysfs.5 |* |Michael Kerrisk 8n|rb.1,rx.1,rz.1,sb.1,sx.1,sz.1|e |Uwe Ohse p|tar.1 |l |bug-tar@gnu.org 1n|tc-matchall.8,tc-sample.8|h |stephen@networkplumber.org p|tc-cbq-details.8,tc-cbq.8,tc-mqprio.8,tc-prio.8,tc-htb.8|B |netdev@vger.kernel.org 1n|tc-bpf.8 |CL |netdev@vger.kernel.org 1n|tc-nat.8 |C |netdev@vger.kernel.org 1n|tc-pie.8,tc-pedit.8 |L |netdev@vger.kernel.org 4n|tcpd.8 |I |wietse@porcupine.org 3n|tcpdmatch.8 |I |wietse@porcupine.org 1n|tcpdump.8 |l |tcpdump-workers@lists.tcpdump.org 3n|tek2plot.1 |W |bug-plotutils@gnu.org 3n|test.1,[.1 |CO |bug-coreutils@gnu.org 1n|thermal-conf.xml.5 |L |Colin King 3n|TIFFGetField.3tiff |I |tiff@lists.maptools.org 3n|TIFFmemory.3tiff |b |tiff@lists.maptools.org 3n|tnameserv.1 |Wy |openjdk@lists.launchpad.net b|tidy.1 |m |tidy-develop@lists.sourceforge.net,html-tidy@w3.org 1n|top.1 |CY |Ubuntu Developers 8n|tune2fs.8 |C |tytso@thunk.org 1n|ubuntu-advantage.1,ua.1 |L |Ubuntu Desktop Team 2n|unrar.1,unrar-nonfree.1|C |Petr Cech b|upstart-events.7 |I |upstart-devel@lists.ubuntu.com b|usb-creator-gtk.8 |W |Roderick B. Greening s|update-leap.1 |CX | 3n|uuencode.1posix |I |Francesco Paolo Lovergine 2n|winemaker.1 |U |wine-devel@winehq.org 1n|vim-addon-manager.1,vam.1,vim-addons.1 |V |James Vega p|xlogo.1 |I |xorg-devel@lists.freedesktop.org 1n|X509_SIG_getm.3ssl,X509_SIG_get0.3ssl|p |https://github.com/openssl/openssl/pull/6429 2n|XML::LibXML::Pattern.3pm|W |perl-xml@listserv.ActiveState.com 2n|XML::LibXML::Reader.3pm|W |perl-xml@listserv.ActiveState.com 2n|XML::LibXML::RegExp.3pm|W |perl-xml@listserv.ActiveState.com 2n|XML::LibXML::XPathExpression.3pm|W |perl-xml@listserv.ActiveState.com gA|xmlto.1 |I |tim@cyberelk.net 3n|Xserver.1 |I |xorg-devel@lists.freedesktop.org 4n|xterm.1 |LI |xorg-devel@lists.freedesktop.org b|zic.8 |o |https://github.com/mkerrisk/man-pages/pull/10 1n|zip.1 |JC |Info-ZIP-Dev@goatley.com 3n|zipinfo.1 |* |newt@pobox.com p|zipcloak.1,zipnote.1,zipsplit.1|I |Info-ZIP-Dev@goatley.com 3n|zlib.3 |C |zlib@gzip.org doclifter-2.19/README000066400000000000000000000020711353056143600143060ustar00rootroot00000000000000 doclifter The doclifter program translates documents written in troff macros to DocBook. Lifting documents from presentation level to semantic level is hard, and a really good job requires human polishing. This tool aims to do everything that can be mechanized, and to preserve any troff-level information that might have structural implications in XML comments. This tool does the hard parts. TBL tables are translated into DocBook table markup, PIC into SVG, and EQN into MathML (relying on pic2svg and GNU eqn for the last two). Install by doing, "make install". To install to a prefix other than the default (/usr), set a PREFIX environment variable e.g. "PREFIX=/usr/local make -e install" Test loads are included in the distribution; do "make check" to run the regression tests. The code has been live tested in about the most brutal possible way; it has been run against every single man page in all sections of a desktop Ubuntu installation. It lifts over 93% of these pages without requiring any hand-hacking. There is a detailed change log in the NEWS file. doclifter-2.19/TODO000066400000000000000000000004201353056143600141120ustar00rootroot00000000000000Bugs: * Docbook 5 translation is incomplete; inclusions won't work, entities are untested. * doclifter doesn't lnow about groff compatibility mode; de and de1 are treated as equivalent. See the PATCHES file for other, more minor problems mainly due to bad markup. doclifter-2.19/doclifter000077500000000000000000014167401353056143600153440ustar00rootroot00000000000000#!/usr/bin/env python r""" doclifter: translate man/mdoc/ms/me/mm sources to DocBook. By Eric S. Raymond, copyright 2002, 2006, 2007. Released as open source under the BSD license. This comment is addressed to you if you want to add support for another macro package to doclifter. Or if you have encountered a bug in doclifter and need to understand the code in doclifter in order to fix it. Or if you just want to understand how it works. This code has only one piece of global state: globalhints. Two other globals, stdout and stderr, don't retain state. A global prettyprinter instance named `pretty' may be created if you're debugging. Internally, doclifter consists mainly of a framework class called DocLifter. This class is instantiated and told to do its stuff by a routine called transfile, which handles all I/O to disk and gives doclifter its cc-like invocation protocol. Underneath, it passes TroffInterpreter a string consisting of the entire text of the file to be translated and accepts a translated string back. TroffInterpreter provides I/O and other basic services for a stack of request interpreters. Interpreters get added to the stack when TroffInterpreter recognizes certain patterns in the input; see the table interpreter_dispatch for details. If a string pattern added to this table is length 2, TroffInterpreter will assume it is a request name and check to make sure that it's not a macro. The interpreter stack always includes TroffInterpreter at the bottom. This request interpreter handles the small set of troff requests that we translate, including .so, .nf, .fi, .if, etc. It also handles macro and string expansion. Note that commands are looked up in reverse order of class activation, e.g most recent extension set first. This means that definitions in a later class override definitions in earlier ones. Each request interpreter is a class that provides methods and members to be used by the framework. Here they are: name The name of the macro set exclusive Whether this is a "major" macro set like man, mdoc, mm, ms, or me -- as opposed to a minor one like pod2man or TkMan. Whichever major macro set is triggered earliest in the file gets a lock on it; trigger patterns from other exclusive macros are subsequently ignored. toptag The top-level tag in the type of DocBook that this request interpreter generates. The top tag for the generated XML will be the top tag of the only exclusive macro set in the stack, if there is one; otherwise it will be the top tag of the most recently added interpreter. ignore_set Tags to ignore. List here any presentation-level tags that don't have structural implications. They will be silently discarded. Note: there is a potential subtle gotcha in the handling of ignore sets. The code presently assumes that no tag in any interpreter's ignore set is handled by any other interpreter. complain_set Tags to complain about. Put here things that can't be translated out of presentation level but that might have structural meaning (such as indentation changes). The user will be warned on stderr when these come up. Otherwise they're ignored. parabreak_set The set of tags that forces a new paragraph without changing the document section. Used to recognize the end of lists. sectionbreak_set The set of tags that forces a new document section. Things that are going to translate to a DocBook sect, refsect, or section tag should go here. listbreak_set The set of tags that forces an end to a list section. Normally includes everything in the sectionbreak_set. scoped_set The set of list tags that is scoped, e.g has an end tag and should *not* be interrupted by list breakers. translations Special-character to ISO literal mappings. These are applied late in the translation, *after* string and macro evaluation. It's also useful to know that your request interpreter can call the function declare_body_start() to tell the framework class where the body of the document starts (as opposed to the preamble full of troff requests). This infornation is used to restrict the scope of character translations. interpret The request interpreter. Called on every input line that begins with a command character, that is . or ' not followed by another ' on the same line. This method needs to be careful about troff continuation (\c) characters. If you add trailing markup to a line, or entirely replace the line, be sure to check for trailing \c first, remove it if present, and paste it back on the end. preprocess, postprocess Pre-processing and postprocessing hooks. Each takes a string (assumed to be the entire file text) and returns a string. reductions: A list of pairs of macro names. In each pair, the first is to be replaced by the second if this macro set is active and the definition of the first contains the second. This member is useful for replacing stereotyped wrapper macros with standard constructs that the translator knows how to handle. Most frequent case: lots of man page authors define a .Pp macro that does various funky things in troff but just expands to .PP in nroff. If we replace this with .PP various nasty parsing situations suddenly don't break. The easiest way to write a full-blown new request interpreter is to take an existing one and mutate it. If the macro package you are trying to support merely adds a few tags to an existing one, consider writing an interpreter for just those tags and adding it to the stack (this is the way the Pod2ManInterpreter code relates to ManInterpreter). Warning: much of this code is grubby. Alas, the grubbiness is intrinsic, because the troff request language is grubby. """ # SPDX-License-Identifier: BSD-2-Clause import sys, os, glob, re, string, tempfile, time, pprint, subprocess, io try: import exceptions BaseException = exceptions.Exception except ImportError: pass try: getstatusoutput = subprocess.getstatusoutput except AttributeError: import commands getstatusoutput = commands.getstatusoutput version = "2.19" # This is a speed hack recommended by Armin Rigo. It cuts runtime by about 33% # and makes it possible for psyco 1.2 to reduce runtime another 33%. re_cache = {} def re_compile(st, flags=0): try: return re_cache[st] except KeyError: r = re_cache[st] = re.compile(st, flags) return r # In order: Dutch, English/German, French, Italian, Norwegian/Danish, Polish, # Spanish, Swedish. name_synonyms = re.compile("^(naam|name|nom|nome|navn|nazwa|nombre|namn)$", re.I) # How to detect synopses synopsis_label = re.compile("SYNOPSIS$", re.I) synopsis_header = re.compile(r'\.S[Hh]\s*"?(?:SYNOPSIS)"?$', re.I) description_label = re.compile("DESCRIPTION$", re.I) # Qt part descriptions. It's OK to see these in function synopses, we just # turn them into an info section. qt_headers = ("Public Members", "Public Slots", "Signals", "Static Public Members", "Properties", "Protected Members",) # Used to distinguish first-level section headers from second-level ones # when the Qt grotty hack is enabled. caps_header = re.compile("^[A-Z ]*$") # These have to be messed with by the Qt grotty hack. qt_invert = ("Property Documentation", "Member Type Documentation") blankline = re.compile(r"^\s*$") # Start tag on a line by itself endtag = re.compile("<[^>]*>$") # Used in C syntax recognition c_declarators = ("void", "char", "short", "int", "long", "float", "double", "signed", "unsigned", "typedef", "struct", "union", "enum", "const", "volatile", "inline", "restricted", # C9X "virtual",) # C++ c_source_re = re.compile("|".join(c_declarators)) # Used to strip headers off generated HTML documents. xmlheader = re.compile(r"<\?.*\?>\n") doctype = re.compile(r"<\!DOCTYPE[^>]*\>\n") # These patterns are applied *after* special-character translation # Match an RFC822 email address, possibly with surrounding <>. # This is the right thing because the XSL stylesheets surround # content with <> on output. email_re = re.compile(r"\b(?:<)?(?P[-\w_.]+@[-\w_.]+)(?:>)?\b") # Match an URL. This pattern is carefully constructed not to eat # a following period if (as is often the case) it occurs at the # end of a sentence. url_re=re.compile(r"(?P\b(http|ftp|telnet|mailto)://[-_%\w/&;.~]+[-_%\w/&;])") # Match a xmlns URL in the top level tag, so that the url_re does not try to ulink-ize it. xmlns_re=re.compile(r"\w xmlns='http://docbook.org/ns/docbook'") # Match a troff highlight troff_highlight = re.compile(r"(\\[fF]\([A-Z][A-Z])|(\\f\[[A-Z]*\])|(\\[fF][A-Z0-9])|(\\F\[\])") troff_highlight_stripper = re.compile(r"^\.[BI] ") # Match a glue token with all preceding and following whitespace hotglue = re.compile(r"\s*@GLUE@\s*") cleantag = re.compile(r"<\1>") # Match an identifier token in C or Python id_re = re.compile("^[_a-zA-Z][_a-zA-Z0-9]*$") # List how troff specials that can appear as list tags map into # DocBook mark types. According to Norm Walsh's DSSL and XSL # stylesheets, both toolchains have two styles available; bullet and # box. An older version of the DocBook documentation said that in # itemizedlists the attributes can be the three names HTML supports: "disc", # "circle", and "square", with "bullet" as a synonym for "disc" and # "box" as a synonym for "square". We map dash to box here for consistency # with the -dash/-bullet distinction in mdoc, where -dash can only # reasonably be mapped to box rather than disc. ip_tag_mapping = { r"\(bu":"bullet", r"\(sq":"box", "*" : "bullet", "-" : "box", } # Add this to the V4 preamble when we have MathML elements mathml_entities = ''' %mathml; ''' # Add this to the V5 preamble when we have entities allent = ''' %allent; ]>''' # Convert empty man pages generated by POD, but be rude about it. rudeness = """This empty page was brought to you by brain damage somewhere in POD, the Perl build system, or the Perl maintainers' release procedures.\ """ empty = """\ Description """ + rudeness + """ """ # Verbosity thresholds for debugging general_verbosity = "g" # More details on warnings section_verbosity = "s" # Show section pushes and pops classify_verbosity = "c" # Show section classification details parse_verbosity = "p" # Show synopsis parse details macro_verbosity = "m" # Show expression evaluation details highlight_verbosity = 'h' # Show highlight resolution details io_verbosity = "i" # Show low-level I/O interpreter_verbosity = "z" # Show low-level interpreter checks bsd_verbosity = 'b' # BSD macroexpansion tokenizer_verbosity = 'x' # Tokenizer verbosity timing_verbosity = 't' # Execution profiling supersub_verbosity = 'u' # Super/subscript recognition velocity. namesection_verbosity = 'n' # Name section parsing def deemphasize(st): "Throw out highlighting info from a string." return troff_highlight.sub("", st) def is_command(line): # This works around a common bug -- string-enclosing ' at the left margin return len(line) > 1 and \ (line[0] == TroffInterpreter.ctrl or (line[0] == TroffInterpreter.ctrl_nobreak and line[1:].find(TroffInterpreter.ctrl_nobreak) == -1)) def is_comment(line): # The malformed crap people write as troff comments is amazing... line = line.replace(" ", "").replace("\t", "") return line == TroffInterpreter.ctrl or line == TroffInterpreter.ctrl_nobreak or line[:3] in (r'.\"', r'/\"', r'./"', r".\'", '\'\\"', r'\'\"', r'\".', r"...", r"'''", r"\!.") or line[:2] in (r'."', r".'", r'\"', r"'#", r"\#") or line[:4] in (r'.\\"', r"'.\"") def match_command(line, tag): # Cope with the possibility of spaces after the dot if not line or line[0] not in (TroffInterpreter.ctrl, TroffInterpreter.ctrl_nobreak): return False tokens = line[1:].strip().split() return tokens and tokens[0] == tag def quoteargs(tokens): "Quote argument tokens so that re-parsing them won't produce surprises." if len(tokens) == 0: return "" elif len(tokens) == 1: return tokens[0] else: return tokens[0] + ' "' + '" "'.join([x.replace('"', '""') for x in tokens[1:]]) + '"' #def untagged(pattern): # "Transform the pattern to guarantee that it won't match marked-up text." # # Warning! Only really works with fixed-length patterns. # return re_compile("(?)" + pattern.pattern + "(?! -1 and istr[last_font_escape+2] not in "R": istr += r"\fR" istr = re_compile(r"\f[^P]\fR$").sub(r"\fR", istr) last_font_escape = istr.rfind(r'\F') if last_font_escape > -1 and istr[last_font_escape+2:last_font_escape+4] != "[]": istr += r"\f[]" return istr def get_xml_char(istr): "Extract a leading character or XML escape from the string." if len(istr) == 0: return "" elif istr[0] != "&": return istr[0] else: take = 1 while istr[take] != ';': take += 1 return istr[:take+1] def make_comment(istr): if istr.startswith("."): istr = istr[1:] istr = istr.replace(r'\"', "").replace(r'\\"', "").replace(r'\(co', "(C)") istr = istr.strip() return "" def lineparse(line): "Parse arguments of a dot macro." if not is_command(line): return None #stderr.write("About to parse: " + line + "\n") tokens = [line[0]] state = 'dot' # Start after the dot in dot state for c in line[1:]: if state == 'dot': # accumulating a token if c in (" ", "\t"): continue else: tokens[-1] += c state = 'token' elif state == 'token': # accumulating a token if c in (" ", "\t"): state = 'ws' elif c == '\\': tokens[-1] += '\\' state = 'tokencont' else: tokens[-1] += c elif state == 'tokencont': # accumulating a token if c in (" ", "\t", "\n"): tokens[-1] = tokens[-1][:-1] tokens[-1] += c state = 'token' elif state == 'ws': # in whitespace if c in (" ", "\t"): continue elif c == '"': tokens.append('"') state = 'string' elif c == '\\': state = 'leader?' else: tokens.append(c) state = 'token' elif state == 'string': # in string tokens[-1] += c if c == '"': state = 'stringend' elif state == 'stringend': # just saw end-of-string, what now? if c == '"': state = 'string' elif c in (" ", "\t", "\n"): state = 'ws' elif c == '\\': state = 'leader?' else: state = 'token' tokens.append(c) elif state == 'leader?': # possible comment leader if c == '"': break elif c in (" ", "\t", "\n"): tokens.append(c) state = 'token' else: tokens.append("\\" + c) state = 'token' # Special case: turn trailing brackets into an argument if len(tokens) == 1: trailer = tokens[0][3:5] if trailer in (r"\{", r"\}"): tokens[0] = tokens[0][:3] tokens.append(trailer) return tokens def stripquotes(arg): "Perform quote-stripping appropriate for macros and .ds commands." if type(arg) == type([]): return list(map(stripquotes, arg)) else: if arg and arg[0] == '"': arg = arg[1:] if arg and arg[-1] == '"': arg = arg[:-1] return arg class LiftException(BaseException): def __init__(self, source, message, retval=1): self.source = source self.message = message self.retval = retval def __str__(self): legend = '"%s"' % (spoofname or self.source.file) if self.source.lineno: legend += ', line %d' % (self.source.lineno) if self.message: legend += ": " + self.message return legend class Dropout(BaseException): pass class SemanticHintsRegistry: "Represent all the semantic information gathered during a run." def __init__(self): self.dictionary = {} def post(self, token, ptype): "Post an association of a string with a semantic markup type." #stdout.write("Markup %s as %s\n" % (token, ptype)) self.dictionary[token] = ptype def get(self, token): return self.dictionary.get(token) def apply(self, text): "Apply all known hints to lift tokens in a text string." # stderr.write("Marked tokens:" + repr(self.dictionary) + "\n") for (token, tag) in list(self.dictionary.items()): with_hi = r"(%s)" % token #stdout.write("marking %s as %s via %s\n" % (token, tag, with_hi)) try: ender = tag.split()[0] # discard attributes text = re_compile(with_hi).sub(r"<%s>\1"%(tag,ender),text) text = re_compile(r"\b("+token+")\b").sub(r"<%s>\1" % (tag, ender), text) except re.sre_compile.error: pass return text def read(self, rinput): "Read in a hints string or file as dumped by __str__" if hasattr(rinput, "read"): fp = open(rinput) data = fp.readlines() fp.close() else: data = rinput.split('\n') for line in data: if line.startswith('.\\" | '): # Someday we'll have more declarations try: (mark, token, as_word, markup) = line[5:].split() if mark != "mark" or as_word != "as": continue self.post(token, markup) except ValueError: continue def __repr__(self): "Dump a representation of hint info." out = '.\\" Begin doclifter hints.\n' for (token, tag) in list(self.dictionary.items()): out += '.\\" | mark %s as %s\n' % (token, tag) out += '.\\" End doclifter hints.\n' return out class Frame: "Frame state for the list-markup stack." def __init__(self, command, ftype): self.command = command self.type = ftype self.count = 0 def __repr__(self): return "" class DocLifter: "DocBook translation of generic troff macros." # In each tuple, the first element is an emphasis remap attribute. # The second element is a regexp to match to the tag content. # If the regexp matches, the bracketing emphasis tags are replaced # with the semantic tag in the third column. lift_highlights = [(re_compile(r"(%s)" % (x[0], x[1])), x[2]) for x in ( ("SM", r"[A-Z.]*", "acronym"), # Historical -- SM is rare ("SM", r"[A-Z]+_[A-Z_]+", "envar"), # In bison.1, cvs.1 ("[BI]",r"-[^<]+", "option"), # likely command option man(7) ("[BI]",r"[0-9.]+", "literal"), # literal value ("[BI]",r"[a-zA-Z0-9.]+((\s| )--?[^<]+)+", "userinput"), # user command ("[BI]",r"\.[a-zA-Z][^<]*", "markup"), # roff markup ("[BI]",r"/[^<]+", "filename"), # Marked filenames ("[BI]",r"~/[^<]*", "filename"), # Home directory filenames ("[BI]",email_re.pattern,"email"), # email addresses ("[BI]",r"SIG[A-Z]+", "constant"), # signal ("[BI]",r"errno", "varname"), # variable ("[BI]",r"[a-z_]*_t", "type"), ("[BI]",r"[a-z_]+(?:\(\))", "function"), # Error codes. This is the Linux set. ("[BI]",r"E2BIG", "errorcode"), ("[BI]",r"EACCES", "errorcode"), ("[BI]",r"EAGAIN", "errorcode"), ("[BI]",r"EBADF", "errorcode"), ("[BI]",r"EBADMSG", "errorcode"), ("[BI]",r"EBUSY", "errorcode"), ("[BI]",r"ECANCELED", "errorcode"), ("[BI]",r"ECHILD", "errorcode"), ("[BI]",r"EDEADLK", "errorcode"), ("[BI]",r"EDOM", "errorcode"), ("[BI]",r"EEXIST", "errorcode"), ("[BI]",r"EFAULT", "errorcode"), ("[BI]",r"EFBIG", "errorcode"), ("[BI]",r"EINPROGRESS", "errorcode"), ("[BI]",r"EINTR", "errorcode"), ("[BI]",r"EINVAL", "errorcode"), ("[BI]",r"EIO", "errorcode"), ("[BI]",r"EISDIR", "errorcode"), ("[BI]",r"EMFILE", "errorcode"), ("[BI]",r"EMLINK", "errorcode"), ("[BI]",r"EMSGSIZE", "errorcode"), ("[BI]",r"ENAMETOOLONG","errorcode"), ("[BI]",r"ENFILE", "errorcode"), ("[BI]",r"ENODEV", "errorcode"), ("[BI]",r"ENOENT", "errorcode"), ("[BI]",r"ENOEXEC", "errorcode"), ("[BI]",r"ENOLCK", "errorcode"), ("[BI]",r"ENOMEM", "errorcode"), ("[BI]",r"ENOSPC", "errorcode"), ("[BI]",r"ENOSYS", "errorcode"), ("[BI]",r"ENOTDIR", "errorcode"), ("[BI]",r"ENOTEMPTY", "errorcode"), ("[BI]",r"ENOTSUP", "errorcode"), ("[BI]",r"ENOTTY", "errorcode"), ("[BI]",r"ENXIO", "errorcode"), ("[BI]",r"EPERM", "errorcode"), ("[BI]",r"EPIPE", "errorcode"), ("[BI]",r"ERANGE", "errorcode"), ("[BI]",r"EROFS", "errorcode"), ("[BI]",r"ESPIPE", "errorcode"), ("[BI]",r"ESRCH", "errorcode"), ("[BI]",r"ETIMEDOUT", "errorcode"), ("[BI]",r"EXDEV", "errorcode"), # Standard environment variables from environ(5). ("[BI]","USER", "envar"), ("[BI]","LOGNAME", "envar"), ("[BI]","HOME", "envar"), ("[BI]","LANG", "envar"), ("[BI]","PATH", "envar"), ("[BI]","PWD", "envar"), ("[BI]","SHELL", "envar"), ("[BI]","TERM", "envar"), ("[BI]","PAGER", "envar"), ("[BI]","EDITOR", "envar"), ("[BI]","VISUAL", "envar"), ("[BI]","BROWSER", "envar"), # Common library environment variables, also from environ(5) ("[BI]","LANG", "envar"), ("[BI]","LANGUAGE", "envar"), ("[BI]","NLSPATH", "envar"), ("[BI]","LOCPATH", "envar"), ("[BI]","LC_ALL", "envar"), ("[BI]","LC_MESSAGES", "envar"), ("[BI]","TMPDIR", "envar"), ("[BI]","LD_LIBRARY_PATH", "envar"), ("[BI]","LD_PRELOAD", "envar"), ("[BI]","POSIXLY_CORRECT", "envar"), ("[BI]","HOSTALIASES", "envar"), ("[BI]","TZ", "envar"), ("[BI]","TZDIR", "envar"), ("[BI]","TERMCAP", "envar"), ("[BI]","COLUMNS", "envar"), ("[BI]","LINES", "envar"), ("[BI]","PRINTER", "envar"), ("[BI]","LPDEST", "envar"), )] post_translation_patterns = ( # man(7)-style man-page references (re.compile(r"([^ ]+)(?:&zerosp;| )?\(([0-9]+[A-Za-z]?)\)"), r"\2\3"), # Here's where we fold all those continuation lines. (re.compile(r"\\c"), "\n"), (re.compile("\\\c\n"), ""), # Interpret attempts to fake up double quotes. Should be safe as # these never occur in program listings. (re.compile("``([^`']+)''"), r"“\1”"), ) post_lift_patterns = ( # Find a highlight directly after an