aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 17:43:34 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-19 17:43:34 +0000
commit27480026516cd5cc863f8d4115e59c5854cb07e7 (patch)
tree420fd34d6ba5175eee7a572fab8cc6cfffaba34d /src
parent30395fef3fa529fab7645a49b776d3536ab674ce (diff)
downloadpaludis-27480026516cd5cc863f8d4115e59c5854cb07e7.tar.gz
paludis-27480026516cd5cc863f8d4115e59c5854cb07e7.tar.xz
Create cave html pages via asciidoc
Diffstat (limited to 'src')
-rw-r--r--src/clients/cave/Makefile.am20
-rw-r--r--src/clients/cave/man_cave.cc19
2 files changed, 18 insertions, 21 deletions
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index b4aada099..4598e2a4f 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -85,17 +85,19 @@ man_MANS = \
man_MANS_txts = $(man_MANS:.1=.txt)
man_MANS_xmls = $(man_MANS_txts:.txt=.xml)
+man_MANS_html_man_fragments = $(man_MANS_txts:.txt=.html-man-fragment)
command_MANS_txts = $(command_MANS:.1=.txt)
command_MANS_xmls = $(command_MANS_txts:.txt=.xml)
+command_MANS_html_man_fragments = $(command_MANS_txts:.txt=.html-man-fragment)
-SUFFIXES = .1 .txt .xml
+SUFFIXES = .1 .txt .xml .html-man-fragment
$(command_MANS_txts) : man-cave
if ! env \
CAVE_FORMATS_CONF="/dev/null" \
CAVE_COMMANDS_PATH="" \
- ./man-cave --asciidoc `echo $@ | sed -e 's.^cave-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
+ ./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=$@ $<
@@ -103,6 +105,15 @@ $(command_MANS_txts) : man-cave
.xml.1 : $(man_MANS_xmls)
xmlto man $<
+.xml.html-man-fragment : $(man_MANS_xmls)
+ xmlto html $< -o $@-dir
+ sed \
+ -e '1s,^.*\(<div class="refnamediv">\),\1,' \
+ -e '$$s,</body>.*,,' -e '$$s,</div><div class="navfooter"><hr></div>,,' \
+ -e 's,<a name="[^"]*"></a>,,g' \
+ $@-dir/index.html > $@
+ rm -fr $@-dir
+
cave_SOURCES = \
cave.cc
@@ -216,14 +227,17 @@ TESTS = \
EXTRA_DIST = \
cave.txt \
$(man_MANS) \
+ $(man_MANS_html_man_fragments) \
$(TESTS) \
continue_on_failure_TEST_setup.sh continue_on_failure_TEST_cleanup.sh \
moo
+noinst_DATA = $(man_MANS_html_man_fragments)
+
DISTCLEANFILES = \
$(man_MANS) \
- $(noinst_DATA) \
$(command_MANS_txts) \
+ $(man_MANS_html_man_fragments) \
$(man_MANS_xmls)
lib_LTLIBRARIES =
diff --git a/src/clients/cave/man_cave.cc b/src/clients/cave/man_cave.cc
index 3f81b0b97..586d9fcf3 100644
--- a/src/clients/cave/man_cave.cc
+++ b/src/clients/cave/man_cave.cc
@@ -36,17 +36,6 @@ namespace
struct ManCommandLine :
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)
- {
- }
-
virtual std::string app_name() const
{
return "";
@@ -70,13 +59,7 @@ main(int argc, char * argv[])
ManCommandLine cmdline;
cmdline.run(argc, argv, "", "", "");
- 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
- throw paludis::args::DoHelp("No format specified");
+ auto w(std::make_shared<paludis::args::AsciidocWriter>(cout));
if (cmdline.begin_parameters() == cmdline.end_parameters())
{