diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-20 21:03:00 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-20 21:05:29 +0000 |
| commit | f7b19ac5c3e315281b219ced064065d77a2cf852 (patch) | |
| tree | d7fe331ab510a2ff9aee3fc53fdcde5d30d0960d /fix-roff-punct | |
| parent | CI/GitLab: Speed up build by limiting clone depth (diff) | |
| download | inkscape-f7b19ac5c3e315281b219ced064065d77a2cf852.tar.gz inkscape-f7b19ac5c3e315281b219ced064065d77a2cf852.zip | |
cmake: cleanup man page generation
- move code from main CMakeLists.txt to separate cmake file in /man
- root dir tidying: move fix-roff-punct
Diffstat (limited to 'fix-roff-punct')
| -rwxr-xr-x | fix-roff-punct | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/fix-roff-punct b/fix-roff-punct deleted file mode 100755 index dc3c96c10..000000000 --- a/fix-roff-punct +++ /dev/null @@ -1,139 +0,0 @@ -#! /usr/bin/perl -w -use strict; - -# fix-roff-punct: Fix up punctuation usage in automatically-generated -# troff files (man pages). - -# Authors: -# Peter Moulder <pmoulder@mail.csse.monash.edu.au> -# -# Copyright (C) 2004 Monash University -# -# Gnu GPL v2+: -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -# Background: Humans use a number of dash-like characters: -# -# - ASCII hyphen/minus needed for command-line options and other computer -# input; -# - hyphen (`one-to-one'); -# - en dash (`2000-2003'); -# - em dash -- like this. [Not currently handled.] -# -# Troff input spells them as \-, -, \[en], \[em] respectively. (See the -# groff_char.7 man page for a full list of such punctuation characters.) If -# you run `man' with your LC_CTYPE indicating a rich character set like unicode -# (UTF-8 encoding), then it uses different output characters for each of the -# above. -# -# In particular, if your man page source has plain `-' when giving an example -# of a flag or command or other program input, then users won't be able to use -# mouse copy&paste from the formatted man page. - -# This script is something of a hack: it is only big enough to handle a few man -# pages of interest (produced by pod2man). You should manually check the -# changes it makes. - -# Approach: we handle each line a word at a time, and typically make the same -# hyphen-vs-ASCII decision throughout the word. We're a bit haphazard about -# word-splitting, but it's hard to find an example of where we'd be hurt by -# that, and by luck we would do the right thing for many gcc options like -# `-fconstant-string-class=\fICLASS-NAME\fR' (where CLASS-NAME should use a -# hyphen and the others should be ASCII hyphen-minus). -# -# Perl's /e (execute) flag for substitutions does just what we want -# for preserving non-word bits while transforming "words". -# -# We don't currently handle special things like `apt-get' that look like -# hyphenated english words but are actually program names. In general the -# problem is AI complete, e.g. `apt-gettable' could be either hyphen (gettable -# by apt) or ASCII hyphen-minus (able to be processed by the `apt-get' -# program). -# -# We don't currently take hints from font choice. (E.g. text in CR font should -# probably use ASCII hyphen-minus.) -# -# We currently only handle a couple troff requests and escapes (see groff.7). - -sub frob ($); - -my $yearRE = qr/(?:19[6-9]|20[013])[0-9]/; - -sub frob ($) { - my ($x) = @_; - - # Consider splitting into two words. - if ($x =~ m{\A(.*?)(\\(?:[&/,~:d]|f[BRI]|s-?[0-9]+))(.*)\z}) { - my ($before, $s, $after) = ($1, $2, $3); - return frob($before) . $s . frob($after); - } - - if ($x =~ m{\A(.*?)(\.+)\z}) { - my $d = $2; - return frob($1) . $d; - } - - # `32-bit', `5-page'. - if ($x =~ m{\A[0-9]+-[a-z]+\z}) { - return $x; - } - - # Year range: `(C) 1998-2003'. - if ($x =~ m{\A$yearRE\\?-$yearRE\z}) { - $x =~ s{\\?-}{\\[en]}; - return $x; - } - - # ISO date. - if ($x =~ m{\A$yearRE-[01][0-9]-[0-3][0-9]\z}) { - return $x; - } - - # Things likely to be computer input. - if ($x =~ m{[0-9]|\.[a-zA-Z]|\A(?:[-/.]|\\-|\[.*\]\z)}) { - $x =~ s/\\?-/\\-/g; - return $x; - } - - $x =~ s/\\?-/-/g; - return $x; -} - -while(<>) { - if ($_ eq '.tr \(*W-|\(bv\*(Tr' . "\n") { - # Get rid of pod2man's "helpful" munging of pipe symbol. - next; - } - - # Leave ASCII apostrophe unchanged (i.e. \[aq]) for examples. - if (/\A\\\& /) { - s/'/\\[aq]/g; # `\[aq]' = "ascii quote" - } - - if (/\A\.IP /) { - s/\\?-/\\-/g; - s/\\s\\-1/\\s-1/g; - } - elsif (/\A\.IX /) { - s/\\?-/-/g; - } - elsif (!/\A\. *(?:\\"|ds|if|ie)/) { - # As an optimization, we process only words containing `-'. - s{([.@/\\[:alnum:]]*-[-.@/\\[:alnum:]]*)}{frob($1)}ge; - } - print; -} |
