aboutsummaryrefslogtreecommitdiff
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
parent30395fef3fa529fab7645a49b776d3536ab674ce (diff)
downloadpaludis-27480026516cd5cc863f8d4115e59c5854cb07e7.tar.gz
paludis-27480026516cd5cc863f8d4115e59c5854cb07e7.tar.xz
Create cave html pages via asciidoc
-rw-r--r--.gitignore1
-rw-r--r--doc/clients/Makefile.am22
-rw-r--r--src/clients/cave/Makefile.am20
-rw-r--r--src/clients/cave/man_cave.cc19
4 files changed, 31 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index 1ac1260..124fb10 100644
--- a/.gitignore
+++ b/.gitignore
@@ -500,6 +500,7 @@ paludis-*.*.*.tar.bz2
/src/clients/cave/*.txt
!/src/clients/cave/cave.txt
/src/clients/cave/*.xml
+/src/clients/cave/*.html-man-fragment
/src/clients/instruo/instruo
/src/clients/instruo/*.txt
/src/clients/instruo/*.xml
diff --git a/doc/clients/Makefile.am b/doc/clients/Makefile.am
index af9353b..3de65d2 100644
--- a/doc/clients/Makefile.am
+++ b/doc/clients/Makefile.am
@@ -119,25 +119,27 @@ appareo.html : header.html.part footer.html.part
cave.html : header.html.part footer.html.part
{ cat header.html.part && { \
- if test -x $(top_builddir)/src/clients/cave/man-cave ; then \
- env CAVE_COMMANDS_PATH="" $(top_builddir)/src/clients/cave/man-cave --html | \
- sed -e '/<h2>See Also<.h2>/,/<.ul>/s#<strong>\(.*\)</strong> (1)#<a href="\1.html">\1</a>#'; \
+ if test -f $(top_builddir)/src/clients/cave/cave.html-man-fragment ; then \
+ cat $(top_builddir)/src/clients/cave/cave.html-man-fragment ; \
+ elif test -f $(top_srcdir)/src/clients/cave/cave.html-man-fragment ; then \
+ cat $(top_srcdir)/src/clients/cave/cave.html-man-fragment ; \
else \
echo "<h1>cave</h1>"; \
echo "<p>Sorry, documentation was generated without support for the cave client.</p>" ; \
- fi ; } && \
- cat footer.html.part ; } > $@
+ fi ; } | sed -e '/<h2>SEE ALSO<.h2>/,/<.div>/s#<span class="strong"><strong>\(.*\)</strong></span>(1)#<a href="\1.html">\1</a>#' \
+ && cat footer.html.part ; } > $@
$(CAVE_COMMANDS_HTML) : header.html.part footer.html.part
{ cat header.html.part && { \
- if test -x $(top_builddir)/src/clients/cave/man-cave ; then \
- basename $@ .html | sed -e 's,^cave-,,' | xargs env CAVE_COMMANDS_PATH="" $(top_builddir)/src/clients/cave/man-cave --html | \
- sed -e '/<h2>See Also<.h2>/,/<.ul>/s#<strong>\(.*\)</strong> (1)#<a href="\1.html">\1</a>#'; \
+ if test -f $(top_builddir)/src/clients/cave/`basename $@ .html `.html-man-fragment ; then \
+ cat $(top_builddir)/src/clients/cave/`basename $@ .html `.html-man-fragment ; \
+ elif test -f $(top_srcdir)/src/clients/cave/`basename $@ .html `.html-man-fragment ; then \
+ cat $(top_srcdir)/src/clients/cave/`basename $@ .html `.html-man-fragment ; \
else \
echo "<h1>cave</h1>"; \
echo "<p>Sorry, documentation was generated without support for the cave client.</p>" ; \
- fi ; } && \
- cat footer.html.part ; } > $@
+ fi ; } | sed -e '/<h2>SEE ALSO<.h2>/,/<.div>/s#<span class="strong"><strong>\(.*\)</strong></span>(1)#<a href="\1.html">\1</a>#' \
+ && cat footer.html.part ; } > $@
instruo.html : header.html.part footer.html.part
{ cat header.html.part && { \
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index b4aada0..4598e2a 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 3f81b0b..586d9fc 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())
{