aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-06-15 14:13:54 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-06-15 14:13:54 +0100
commit883e9c3ca406a8707f9540c86c4e79d18283c68b (patch)
treeec35f0f58b7cc25928d25ccab74e1b895fe11aab
parent66db4266279cebda911423d15ab31f8f0174a0fc (diff)
downloadpaludis-883e9c3ca406a8707f9540c86c4e79d18283c68b.tar.gz
paludis-883e9c3ca406a8707f9540c86c4e79d18283c68b.tar.xz
Better man page escaping
-rw-r--r--misc/Makefile.am2
-rw-r--r--misc/asciidoc.conf9
-rw-r--r--paludis/args/man.cc26
-rw-r--r--src/clients/accerso/Makefile.am2
-rw-r--r--src/clients/appareo/Makefile.am2
-rw-r--r--src/clients/cave/Makefile.am2
-rw-r--r--src/clients/cave/cave.txt34
-rw-r--r--src/clients/instruo/Makefile.am2
8 files changed, 34 insertions, 45 deletions
diff --git a/misc/Makefile.am b/misc/Makefile.am
index 65ea672..6293f4c 100644
--- a/misc/Makefile.am
+++ b/misc/Makefile.am
@@ -1,6 +1,6 @@
CLEANFILES = *~ *.epicfail
MAINTAINERCLEANFILES = Makefile.in
-EXTRA_DIST = generated-file.txt do_m4.bash make_se.bash make_nn.bash common-makefile.am
+EXTRA_DIST = generated-file.txt do_m4.bash make_se.bash make_nn.bash common-makefile.am asciidoc.conf
AUTOMAKE_OPTIONS = 1.11 parallel-tests
diff --git a/misc/asciidoc.conf b/misc/asciidoc.conf
new file mode 100644
index 0000000..a4ed938
--- /dev/null
+++ b/misc/asciidoc.conf
@@ -0,0 +1,9 @@
+[quotes]
+'=
+
+[replacements]
+(^-- )=--&#32;
+(\n-- )|( -- )|( --\n)=&#32;--&#32;
+(\w)--(\w)=\1--\2
+\\--(?!-)=--
+
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index 421655e..7cd0fa4 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -208,40 +208,20 @@ namespace
{
void escape_asciidoc(std::ostream & stream, const std::string & s)
{
- // escape the n-th char unless n = 0 (start of string) or if n-1 = \s \t or \n
- auto t(s.begin()), t_end(s.end());
char previous('\0');
-
- if (t != t_end)
- {
- switch (*t)
- {
- case '\'':
- stream << "\\'";
- ++t;
- break;
- case '*':
- stream << "\\*";
- ++t;
- break;
- }
- }
-
- for ( ; t != t_end ; ++t)
+ for (auto t(s.begin()), t_end(s.end()) ; t != t_end ; ++t)
{
switch (previous)
{
+ case '\0':
case ' ':
case '\n':
case '\t':
- if ('\'' == *t or '*' == *t)
- stream << '\\';
- break;
- // Escape '*/*' -> \'\*/*'
case '\'':
if ('*' == *t)
stream << '\\';
break;
+ // Escape '*/*' -> '\*/*'
}
stream << *t;
previous = *t;
diff --git a/src/clients/accerso/Makefile.am b/src/clients/accerso/Makefile.am
index 6be9fd7..ce3578c 100644
--- a/src/clients/accerso/Makefile.am
+++ b/src/clients/accerso/Makefile.am
@@ -28,7 +28,7 @@ $(man_MANS_txts) : man-accerso
if ! ./man-accerso `echo $@ | sed -e 's.^accerso-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
.txt.xml : $(man_MANS_txts)
- asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ --conf=$(top_srcdir)/misc/asciidoc.conf $<
.xml.1 : $(man_MANS_xmls)
xmlto man $<
diff --git a/src/clients/appareo/Makefile.am b/src/clients/appareo/Makefile.am
index c096793..b01345a 100644
--- a/src/clients/appareo/Makefile.am
+++ b/src/clients/appareo/Makefile.am
@@ -28,7 +28,7 @@ $(man_MANS_txts) : man-appareo
if ! ./man-appareo `echo $@ | sed -e 's.^appareo-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
.txt.xml : $(man_MANS_txts)
- asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ --conf=$(top_srcdir)/misc/asciidoc.conf $<
.xml.1 : $(man_MANS_xmls)
xmlto man $<
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index a96e563..ec94522 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -103,7 +103,7 @@ $(command_MANS_txts) : man-cave
./man-cave `echo $@ | sed -e 's.^cave-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
.txt.xml : $(man_MANS_txts)
- asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ --conf=$(top_srcdir)/misc/asciidoc.conf $<
.xml.1 : $(man_MANS_xmls)
xmlto man $<
diff --git a/src/clients/cave/cave.txt b/src/clients/cave/cave.txt
index 05c64a3..345667b 100644
--- a/src/clients/cave/cave.txt
+++ b/src/clients/cave/cave.txt
@@ -18,14 +18,14 @@ DESCRIPTION
-----------
The front-end to a number of commands.
-For the COMMAND argument, see \'cave help' for a list of common commands, or
-\'cave help --all' for all commands. To see documentation for a command named
-\'foo', use \'man cave-foo'.
+For the COMMAND argument, see 'cave help' for a list of common commands, or
+'cave help --all' for all commands. To see documentation for a command named
+'foo', use 'man cave-foo'.
In addition to built-in commands, cave will also look in the directories named
in the colon-separated CAVE_COMMANDS_PATH environment variable, or, if unset,
-\'/usr/libexec/cave/commands'. Any executables in this path will also be
+'/usr/libexec/cave/commands'. Any executables in this path will also be
available as commands (with any file extension stripped); these executables
may use the $CAVE environment variable to get access to the main cave program.
@@ -111,8 +111,8 @@ owner::
Shows package IDs owning a given file.
purge::
-Uninstalls any package that is not either in \'world' or a dependency of a
-package in \'world'.
+Uninstalls any package that is not either in 'world' or a dependency of a
+package in 'world'.
report::
Displays a formatted summary of potential problems with installed packages.
@@ -122,8 +122,8 @@ Displays how to resolve one or more targets. If instructed, then executes the
relevant install and uninstall actions to perform that resolution.
resume::
-Resumes a failed resultion from \'cave resolve'. To enable resumes, use \'cave
-resolve --resume-file state --execute', and then if errors occur, use \'cave
+Resumes a failed resultion from 'cave resolve'. To enable resumes, use 'cave
+resolve --resume-file state --execute', and then if errors occur, use 'cave
resume --resume-file state [ --retry-failed ] [ --retry-skipped ]' to try
again.
@@ -142,9 +142,9 @@ Syncs repositories. If any repository names are specified, these repositories
are synced. Otherwise, all syncable repositories are synced.
uninstall::
-Uninstalls one or more packages. Note that \'cave uninstall' simply rewrites
-the supplied dependency specifications and then uses \'cave resolve' to do the
-work; \'cave uninstall foo' is the same as \'cave resolve !foo'.
+Uninstalls one or more packages. Note that 'cave uninstall' simply rewrites
+the supplied dependency specifications and then uses 'cave resolve' to do the
+work; 'cave uninstall foo' is the same as 'cave resolve !foo'.
SUPPLEMENTAL COMMANDS
---------------------
@@ -299,27 +299,27 @@ INTERNAL COMMANDS
-----------------
display-resolution::
-Displays a dependency resolution created using \'cave resolve'. Mostly for
+Displays a dependency resolution created using 'cave resolve'. Mostly for
internal use; most users will not use this command directly.
execute-resolution::
-Execute a dependency resolution created using \'cave resolve'. Mostly for
+Execute a dependency resolution created using 'cave resolve'. Mostly for
internal use; most users will not use this command directly.
find-candidates::
-Finds a list of candidate packages for a search. Used by \'cave search'; not
+Finds a list of candidate packages for a search. Used by 'cave search'; not
generally called directly by end users. Note that this command will often
select candidates that do not actually match some of the supplied
-restrictions; use \'cave match' to obtain accurate results.
+restrictions; use 'cave match' to obtain accurate results.
graph-jobs::
-Creates a Graphviz graph for jobs in a resolution created using \'cave
+Creates a Graphviz graph for jobs in a resolution created using 'cave
resolve'. Mostly for internal use; most users will not use this command
directly.
match::
Determines whether a particular package version has certain properties. Mostly
-for use by \'cave search'; not generally for use by end users.
+for use by 'cave search'; not generally for use by end users.
perform::
Perform an action upon a package. Not suitable for direct use, although it may
diff --git a/src/clients/instruo/Makefile.am b/src/clients/instruo/Makefile.am
index 35ea242..52a3768 100644
--- a/src/clients/instruo/Makefile.am
+++ b/src/clients/instruo/Makefile.am
@@ -28,7 +28,7 @@ $(man_MANS_txts) : man-instruo
if ! ./man-instruo `echo $@ | sed -e 's.^instruo-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
.txt.xml : $(man_MANS_txts)
- asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ --conf=$(top_srcdir)/misc/asciidoc.conf $<
.xml.1 : $(man_MANS_xmls)
xmlto man $<