aboutsummaryrefslogtreecommitdiff
path: root/paludis/args/man.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-10 09:20:28 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-10 10:13:44 +0100
commit8a4defb4131d3baf2ea9cd2223f0f5e2fd0dda5a (patch)
tree272b3009954138d26ade2c0b2dcad9b3a4227be9 /paludis/args/man.cc
parentb0c920c73203b9a03fb91e16455975515ebdb6c8 (diff)
downloadpaludis-8a4defb4131d3baf2ea9cd2223f0f5e2fd0dda5a.tar.gz
paludis-8a4defb4131d3baf2ea9cd2223f0f5e2fd0dda5a.tar.xz
Support 'see also' in man pages
Diffstat (limited to 'paludis/args/man.cc')
-rw-r--r--paludis/args/man.cc52
1 files changed, 51 insertions, 1 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index eb7937073..cc421e973 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010 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
@@ -171,6 +171,17 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
dw.end_examples();
}
+
+ if (h->begin_see_alsos() != h->end_see_alsos())
+ {
+ dw.start_see_alsos();
+
+ for (ArgsHandler::SeeAlsoConstIterator u(h->begin_see_alsos()),
+ u_end(h->end_see_alsos()) ; u != u_end ; ++u)
+ dw.see_also(u->first, u->second, u == h->begin_see_alsos());
+
+ dw.end_see_alsos();
+ }
}
DocWriter::~DocWriter()
@@ -354,6 +365,25 @@ HtmlWriter::end_examples()
}
void
+HtmlWriter::start_see_alsos()
+{
+ _os << "<h2>See Also</h2>" << endl;
+ _os << "<ul>" << endl;
+}
+
+void
+HtmlWriter::see_also(const std::string & page, const int s, const bool)
+{
+ _os << "<li><strong>" << page << "</strong> (" << s << ")</li>" << endl;
+}
+
+void
+HtmlWriter::end_see_alsos()
+{
+ _os << "</ul>" << endl;
+}
+
+void
HtmlWriter::section(const std::string & title)
{
_os << "<h2>" << title << "</h2>" << endl;
@@ -561,6 +591,26 @@ ManWriter::end_examples()
}
void
+ManWriter::start_see_alsos()
+{
+ _os << ".SH SEE ALSO" << endl;
+ _os << ".sp" << endl;
+}
+
+void
+ManWriter::see_also(const std::string & m, const int s, const bool first)
+{
+ if (! first)
+ _os << ", ";
+ _os << "\\fB" << m << "\\fR(" << s << ")";
+}
+
+void
+ManWriter::end_see_alsos()
+{
+}
+
+void
ManWriter::start_notes()
{
_os << ".SH NOTES" << endl;