aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-16 16:02:25 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-16 16:02:25 +0000
commite6d1c28fbc15ae287fc5641fe1d365bddd113b9f (patch)
tree3312da2307e008c0f8c72ed890ac37ddd32e8536
parentaefe735296fe393531652bc729872a0e7ec96f3a (diff)
downloadpaludis-e6d1c28fbc15ae287fc5641fe1d365bddd113b9f.tar.gz
paludis-e6d1c28fbc15ae287fc5641fe1d365bddd113b9f.tar.xz
asciidocify accerso
-rw-r--r--.gitignore2
-rw-r--r--src/clients/accerso/Makefile.am22
-rw-r--r--src/clients/accerso/man_accerso.cc22
3 files changed, 33 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 91c1079..19850f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -491,6 +491,8 @@ paludis-*.*.*.tar.bz2
/paludis/version_spec_TEST
/pkg-config/paludis.pc
/src/clients/accerso/accerso
+/src/clients/accerso/*.txt
+/src/clients/accerso/*.xml
/src/clients/appareo/appareo
/src/clients/cave/cave
/src/clients/cave/*.txt
diff --git a/src/clients/accerso/Makefile.am b/src/clients/accerso/Makefile.am
index 5d8a939..9d131a8 100644
--- a/src/clients/accerso/Makefile.am
+++ b/src/clients/accerso/Makefile.am
@@ -14,8 +14,20 @@ bin_PROGRAMS = accerso
noinst_PROGRAMS = man-accerso
man_MANS = accerso.1
-accerso.1 : man-accerso
- ./man-accerso > $@
+SUFFIXES = .1 .txt .xml
+
+man_MANS_txts = accerso.txt
+man_MANS_xmls = accerso.xml
+
+$(man_MANS_txts) : man-accerso
+ if ! ./man-accerso --asciidoc `echo $@ | sed -e 's.^accerso-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
+
+.txt.xml :
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+
+.xml.1 :
+ xmlto man $<
+ @: $@
man_accerso_SOURCES = \
man_accerso.cc \
@@ -47,5 +59,9 @@ EXTRA_DIST = \
$(man_MANS) \
$(TESTS)
-DISTCLEANFILES = $(man_MANS) $(noinst_DATA)
+DISTCLEANFILES = \
+ $(man_MANS) \
+ $(noinst_DATA) \
+ $(man_MANS_txts) \
+ $(man_MANS_xmls)
diff --git a/src/clients/accerso/man_accerso.cc b/src/clients/accerso/man_accerso.cc
index 2917ce6..3002eba 100644
--- a/src/clients/accerso/man_accerso.cc
+++ b/src/clients/accerso/man_accerso.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2009 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2009, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,6 +19,7 @@
#include "command_line.hh"
#include <paludis/args/man.hh>
+#include <paludis/args/do_help.hh>
#include <iostream>
#include <cstdlib>
@@ -32,10 +33,12 @@ namespace
paludis::args::ArgsHandler
{
paludis::args::ArgsGroup group;
+ paludis::args::SwitchArg a_asciidoc;
paludis::args::SwitchArg a_html;
ManCommandLine() :
group(main_options_section(), "", ""),
+ a_asciidoc(&group, "asciidoc", '\0', "", false),
a_html(&group, "html", '\0', "", false)
{
}
@@ -63,16 +66,15 @@ main(int argc, char * argv[])
ManCommandLine cmdline;
cmdline.run(argc, argv, "", "", "");
- if (cmdline.a_html.specified())
- {
- paludis::args::HtmlWriter hw(cout);
- paludis::args::generate_doc(hw, CommandLine::get_instance());
- }
+ std::shared_ptr<paludis::args::DocWriter> w;
+ if (cmdline.a_asciidoc.specified())
+ w = std::make_shared<paludis::args::AsciidocWriter>(cout);
+ else if (cmdline.a_html.specified())
+ w = std::make_shared<paludis::args::HtmlWriter>(cout);
else
- {
- paludis::args::ManWriter mw(cout);
- paludis::args::generate_doc(mw, CommandLine::get_instance());
- }
+ throw paludis::args::DoHelp("No format specified");
+
+ paludis::args::generate_doc(*w, CommandLine::get_instance());
return EXIT_SUCCESS;
}