diff options
author | 2011-03-19 18:59:21 +0000 | |
---|---|---|
committer | 2011-03-19 19:20:24 +0000 | |
commit | 10e4f2dc5fa7dd6fbece9ddfd23680b7458b4f66 (patch) | |
tree | 9b7f8429141bce703f2945624c57fd40da037c1a | |
parent | 3ac3c20af631a7e6c2e666114197797dbeb193fa (diff) | |
download | paludis-10e4f2dc5fa7dd6fbece9ddfd23680b7458b4f66.tar.gz paludis-10e4f2dc5fa7dd6fbece9ddfd23680b7458b4f66.tar.xz |
Kill non-asciidoc writers
-rw-r--r-- | paludis/args/man.cc | 467 | ||||
-rw-r--r-- | paludis/args/man.hh | 127 |
2 files changed, 1 insertions, 593 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc index 7245d24a9..421655ef0 100644 --- a/paludis/args/man.cc +++ b/paludis/args/man.cc @@ -492,470 +492,3 @@ AsciidocWriter::end_see_alsos() _os << endl; } - -HtmlWriter::HtmlWriter(std::ostream & os) : - _os(os) -{ -} - -HtmlWriter::~HtmlWriter() -{ -} - -void -HtmlWriter::heading(const std::string & name, const std::string & section_, const std::string & synopsis) -{ - _os << "<h1>" << name << "(" << section_ << ")" << "</h1>" << endl; - _os << "<h2>Name</h2>" << endl; - _os << "<p>" << name << " - " << synopsis << "</p>" << endl; -} - -void -HtmlWriter::start_usage_lines() -{ - _os << "<h2>Synopsis</h2>" << endl; -} - -void -HtmlWriter::usage_line(const std::string & name, const std::string & line) -{ - _os << "<p>" << name << " " << line << "</p>" << endl; -} - -void -HtmlWriter::start_description(const std::string & description) -{ - _os << "<h2>Description</h2>" << endl; - _os << "<p>" << description << "</p>" << endl; -} - -void -HtmlWriter::start_options(const std::string & s) -{ - _os << "<h2>" << s << "</h2>" << endl; -} - -void -HtmlWriter::start_arg_group(const std::string & name, const std::string & description) -{ - _os << "<h3>" << name << "</h3>" << endl; - _os << "<p>" << description << "</p>" << endl; - _os << "<dl>"; -} - -void -HtmlWriter::arg_group_item(const char & short_name, const std::string & long_name, - const std::string & negated_long_name, const std::string & description) -{ - _os << "<dt>"; - if (short_name) - _os << "-" << escape_html_char(short_name) << ", "; - _os << "--" << long_name; - if (! negated_long_name.empty()) - _os << " (" << "--" << negated_long_name << ")"; - _os << "</dt>" << endl; - _os << "<dd>" << description << endl; -} - -void -HtmlWriter::start_extra_arg() -{ - _os << "<dl>" << endl; -} - -void -HtmlWriter::extra_arg_enum(const AllowedEnumArg & e, const std::string & default_arg) -{ - std::string default_string; - if (e.long_name() == default_arg) - default_string = " (default)"; - - _os << "<dt>" << e.long_name(); - if (e.short_name()) - _os << " (" << escape_html_char(e.short_name()) << ")"; - _os << "</dt>" << endl; - _os << "<dd>" << e.description() << default_string << "</dd>" << endl; -} - -void -HtmlWriter::extra_arg_string_set(const std::string & first, const std::string & second) -{ - _os << "<dt>" << first << "</dt>" << endl; - _os << "<dd>" << second << "</dd>" << endl; -} - -void -HtmlWriter::end_extra_arg() -{ - _os << "</dl>" << endl; -} - -void -HtmlWriter::end_arg_group() -{ - _os << "</dl>" << endl; -} - -void -HtmlWriter::extra_description(const std::string & s) -{ - _os << "<p>" << s << "</p>" << endl; -} - -void -HtmlWriter::end_description() -{ -} - -void -HtmlWriter::end_options() -{ -} - -void -HtmlWriter::start_environment() -{ - _os << "<h2>Environment</h2>" << endl; - _os << "<dl>" << endl; -} - -void -HtmlWriter::environment_line(const std::string & first, const std::string & second) -{ - _os << "<dt>" << first << "</dt>" << endl; - _os << "<dd>" << second << "</dd>" << endl; -} - -void -HtmlWriter::end_environment() -{ - _os << "</dl>" << endl; -} - -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; -} - -void -HtmlWriter::example(const std::string & first, const std::string & second) -{ - _os << "<pre>" << first << "</pre>" << endl; - _os << "<p>" << second << "</p>" << endl; -} - -void -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; -} - -void -HtmlWriter::subsection(const std::string & title) -{ - _os << "<h3>" << title << "</h3>" << endl; -} - -void -HtmlWriter::paragraph(const std::string & text) -{ - _os << "<p>" << text << "</p>" << endl; -} - - -ManWriter::ManWriter(std::ostream & os) : - _os(os) -{ -} - -ManWriter::~ManWriter() -{ -} - -void -ManWriter::heading(const std::string & name, const std::string & section_, const std::string & synopsis) -{ - _os << ".TH \"" << name << "\" " << section_ << endl; - _os << ".SH NAME" << endl; - _os << name << " \\- " << synopsis << endl; -} - -void -ManWriter::start_usage_lines() -{ - _os << ".SH SYNOPSIS" << endl; -} - -void -ManWriter::usage_line(const std::string & name, const std::string & line) -{ - _os << ".B " << name << " " << line << endl << endl; -} - -void -ManWriter::start_description(const std::string & description) -{ - _os << ".SH DESCRIPTION" << endl; - _os << description << endl; -} - -void -ManWriter::start_options(const std::string & s) -{ - std::string upper_s; - std::transform(s.begin(), s.end(), std::back_inserter(upper_s), &::toupper); - _os << ".SH " << upper_s << endl; -} - -void -ManWriter::start_arg_group(const std::string & name, const std::string & description) -{ - _os << ".SS \"" << name << "\"" << endl; - _os << description << endl; -} - -namespace -{ - void escape(std::ostream & stream, const std::string & s) - { - auto t(s.begin()), t_end(s.end()); - - if (t != t_end && *t == '\'') - { - stream << "\\'"; - ++t; - } - - for ( ; t != t_end ; ++t) - { - if ('\\' == *t) - stream << '\\'; - stream << *t; - } - } -} - -void -ManWriter::arg_group_item(const char & short_name, const std::string & long_name, - const std::string & negated_long_name, const std::string & description) -{ - _os << ".TP" << endl; - _os << ".B \""; - if (short_name) - _os << "\\-" << short_name << " , "; - _os << "\\-\\-" << long_name; - if (! negated_long_name.empty()) - _os << " (\\-\\-" << negated_long_name << ")\""; - _os << endl; - escape(_os, description); - _os << endl; -} - -void -ManWriter::start_extra_arg() -{ -} - -void -ManWriter::extra_arg_enum(const AllowedEnumArg & e, const std::string & default_arg) -{ - std::string default_string; - if (e.long_name() == default_arg) - default_string = " (default)"; - - _os << ".RS" << endl; - _os << ".TP" << endl; - _os << ".B \"" << e.long_name(); - if (e.short_name()) - _os << " (" << std::string(1, e.short_name()) << ")"; - _os << "\"" << endl; - _os << e.description() << default_string << endl; - _os << ".RE" << endl; -} - -void -ManWriter::extra_arg_string_set(const std::string & first, const std::string & second) -{ - _os << ".RS" << endl; - _os << ".TP" << endl; - _os << ".B \"" << first << "\"" << endl; - _os << second << endl; - _os << ".RE" << endl; -} - -void -ManWriter::end_extra_arg() -{ -} - -void -ManWriter::end_arg_group() -{ -} - -void -ManWriter::end_description() -{ -} - -void -ManWriter::end_options() -{ -} - -void -ManWriter::start_environment() -{ - _os << ".SH ENVIRONMENT" << endl; -} - -void -ManWriter::environment_line(const std::string & first, const std::string & second) -{ - _os << ".TP" << endl; - _os << ".B \"" << first << "\"" << endl; - _os << second << endl; -} - -void -ManWriter::end_environment() -{ -} - -void -ManWriter::start_examples() -{ - _os << ".SH EXAMPLES" << endl; -} - -namespace -{ - std::string ungroff(const std::string & s) - { - if ((! s.empty() && ('.' == s.at(0)))) - return " " + s; - else - return s; - } -} - -void -ManWriter::example(const std::string & first, const std::string & second) -{ - _os << ".TP" << endl; - escape(_os, first); - _os << endl; - _os << ungroff(second) << endl << endl; -} - -void -ManWriter::extra_description(const std::string & s) -{ - _os << endl << ungroff(s) << endl; -} - -void -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; -} - -void -ManWriter::note(const std::string & s) -{ - escape(_os, s); - _os << endl << endl; -} - -void -ManWriter::end_notes() -{ -} - -void -ManWriter::section(const std::string & title) -{ - _os << ".SH " << title << endl; -} - -void -ManWriter::subsection(const std::string & title) -{ - _os << ".SS \"" << title << "\"" << endl; -} - -void -ManWriter::paragraph(const std::string & text) -{ - _os << text << endl; -} - diff --git a/paludis/args/man.hh b/paludis/args/man.hh index 3ea947a4b..9451c4b5a 100644 --- a/paludis/args/man.hh +++ b/paludis/args/man.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2006, 2007, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2006, 2007, 2009, 2010, 2011 Ciaran McCreesh * Copyright (c) 2011 Ingmar Vanhassel * * This file is part of the Paludis package manager. Paludis is free software; @@ -158,131 +158,6 @@ namespace paludis void see_also(const std::string &, const int, const bool first); void end_see_alsos(); }; - - /** - * Create HTML documentation from args classes. - * - * \ingroup grplibpaludisargs - * \nosubgrouping - */ - class PALUDIS_VISIBLE HtmlWriter : - public DocWriter - { - private: - std::ostream & _os; - - public: - ///\name Basic operations - ///\{ - - HtmlWriter(std::ostream & os); - ~HtmlWriter(); - - ///\} - - void heading(const std::string & name, const std::string & section, - const std::string & synopis); - void start_usage_lines(); - void usage_line(const std::string & name, const std::string & line); - - void start_description(const std::string & description); - void extra_description(const std::string & description); - void end_description(); - - void start_options(const std::string &); - void start_arg_group(const std::string & name, const std::string & description); - void arg_group_item(const char & short_name, const std::string & long_name, - const std::string & negated_long_name, const std::string & description); - void start_extra_arg(); - void extra_arg_enum(const AllowedEnumArg &, const std::string & default_arg); - void extra_arg_string_set(const std::string & first, const std::string & second); - void end_extra_arg(); - void end_arg_group(); - void end_options(); - - void start_environment(); - void environment_line(const std::string & first, const std::string & second); - void end_environment(); - - void start_examples(); - void example(const std::string &, const std::string &); - void end_examples(); - - void start_notes(); - void note(const std::string &); - void end_notes(); - - void section(const std::string & title); - void subsection(const std::string & title); - void paragraph(const std::string & text); - - void start_see_alsos(); - void see_also(const std::string &, const int, const bool first); - void end_see_alsos(); - }; - - /** - * Create man documentation from args classes. - * - * \ingroup grplibpaludisargs - * \nosubgrouping - */ - class PALUDIS_VISIBLE ManWriter : - public DocWriter - { - private: - std::ostream & _os; - - public: - ///\name Basic operations - ///\{ - - ManWriter(std::ostream & os); - ~ManWriter(); - - ///\} - - void heading(const std::string & name, const std::string & section, - const std::string & synopis); - void start_usage_lines(); - void usage_line(const std::string & name, const std::string & line); - - void start_description(const std::string & description); - void extra_description(const std::string & description); - void end_description(); - - void start_options(const std::string &); - void start_arg_group(const std::string & name, const std::string & description); - void arg_group_item(const char & short_name, const std::string & long_name, - const std::string & negated_long_name, const std::string & description); - void start_extra_arg(); - void extra_arg_enum(const AllowedEnumArg &, const std::string & default_arg); - void extra_arg_string_set(const std::string & first, const std::string & second); - void end_extra_arg(); - void end_arg_group(); - void end_options(); - - void start_environment(); - void environment_line(const std::string & first, const std::string & second); - void end_environment(); - - void start_examples(); - void example(const std::string &, const std::string &); - void end_examples(); - - void start_notes(); - void note(const std::string &); - void end_notes(); - - void section(const std::string & title); - void subsection(const std::string & title); - void paragraph(const std::string & text); - - void start_see_alsos(); - void see_also(const std::string &, const int, const bool first); - void end_see_alsos(); - }; - } } |