aboutsummaryrefslogtreecommitdiff
path: root/paludis/args/man.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-26 06:21:55 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-26 06:21:55 +0000
commitc26a020654b3bd13a8719b85420a86244a43dab6 (patch)
tree6d602f24a1a9ad7d0bdba69521212a33abdb42e7 /paludis/args/man.cc
parentd68ac062d7db4c56ad144008aeb5a1ac668e7930 (diff)
downloadpaludis-c26a020654b3bd13a8719b85420a86244a43dab6.tar.gz
paludis-c26a020654b3bd13a8719b85420a86244a43dab6.tar.xz
Allow notes in client docs
Diffstat (limited to 'paludis/args/man.cc')
-rw-r--r--paludis/args/man.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index 68f7f7457..c71ccb398 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -19,8 +19,10 @@
#include "man.hh"
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/tr1_functional.hh>
#include <ostream>
#include <sstream>
+#include <algorithm>
using namespace paludis;
using namespace paludis::args;
@@ -96,6 +98,8 @@ namespace
void
paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
{
+ using namespace tr1::placeholders;
+
dw.heading(h->app_name(), h->man_section(), h->app_synopsis());
for (ArgsHandler::UsageLineConstIterator u(h->begin_usage_lines()),
@@ -138,6 +142,13 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
dw.end_environment();
}
+ if (h->begin_notes() != h->end_notes())
+ {
+ dw.start_notes();
+ std::for_each(h->begin_notes(), h->end_notes(), tr1::bind(&DocWriter::note, &dw, _1));
+ dw.end_notes();
+ }
+
if (h->begin_examples() != h->end_examples())
{
dw.start_examples();
@@ -267,6 +278,25 @@ HtmlWriter::end_environment()
}
void
+HtmlWriter::start_notes()
+{
+ _os << "<h2>Notes</h2>" << endl;
+ _os << "<ul>" << endl;
+}
+
+void
+HtmlWriter::end_notes()
+{
+ _os << "</ul>" << endl;
+}
+
+void
+HtmlWriter::note(const std::string & s)
+{
+ _os << "<li>" << s << "</li>" << endl;
+}
+
+void
HtmlWriter::start_examples()
{
_os << "<h2>Examples</h2>" << endl;
@@ -448,6 +478,23 @@ ManWriter::end_examples()
}
void
+ManWriter::start_notes()
+{
+ _os << ".SH NOTES" << endl;
+}
+
+void
+ManWriter::note(const std::string & s)
+{
+ _os << s << endl << endl;
+}
+
+void
+ManWriter::end_notes()
+{
+}
+
+void
ManWriter::section(const std::string & title)
{
_os << ".SH " << title << endl;