/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! List of replacements for console output.
const t_sandr sandrTty[] = {
+ { "\\*", "*" },
+ { "\\=", "=" },
{ "[TT]", "" },
{ "[tt]", "" },
{ "[BB]", "" },
//! List of replacements for man page output.
const t_sandr sandrMan[] = {
+ { "\\*", "*" },
+ { "\\=", "=" },
{ "[TT]", "\\fB" },
{ "[tt]", "\\fR" },
{ "[BB]", "\\fB" },
{ "[grk]", "" }
};
-//! List of replacements for HTML output.
-const t_sandr sandrHtml[] = {
- { "<", "<" },
- { ">", ">" },
- { "[TT]", "<tt>" },
- { "[tt]", "</tt>" },
- { "[BB]", "<b>" },
- { "[bb]", "</b>" },
- { "[IT]", "<it>" },
- { "[it]", "</it>" },
+//! List of replacements for reStructuredText output.
+const t_sandr sandrRst[] = {
+ { "[TT]", "``" },
+ { "[tt]", "``" },
+ { "[BB]", "**" },
+ { "[bb]", "**" },
+ { "[IT]", "*" },
+ { "[it]", "*" },
{ "[MATH]", "" },
{ "[math]", "" },
- { "[CHEVRON]", "<" },
- { "[chevron]", ">" },
- { "[MAG]", "|" },
- { "[mag]", "|" },
+ { "[CHEVRON]", "<" },
+ { "[chevron]", ">" },
+ { "[MAG]", "\\|" },
+ { "[mag]", "\\|" },
{ "[INT]", "integral" },
{ "[FROM]", " from " },
{ "[from]", "" },
{ "[SUB]", "_" },
{ "[sub]", "" },
{ "[SQRT]", "sqrt(" },
- { "[sqrt]", ")", },
+ { "[sqrt]", ")" },
{ "[EXP]", "exp(" },
{ "[exp]", ")" },
{ "[LN]", "ln(" },
{ "[sinh]", ")" },
{ "[TANH]", "tanh(" },
{ "[tanh]", ")" },
- { "[PAR]", "<p>" },
- { "[BR]", "<br>" },
- { "[UL]", "<ul>" },
- { "[LI]", "<li>" },
- { "[ul]", "</ul>" },
- { "[GRK]", "&" },
- { "[grk]", ";" }
+ { "[PAR]", "\n\n" },
+ // [BR] is fundamentally incompatible with rst
+ { "[BR]", "\n\n"},
+ { "[GRK]", "" },
+ { "[grk]", "" }
};
/*! \brief
case eHelpOutputFormat_Man:
replacement = repall(displayName, sandrMan);
break;
- case eHelpOutputFormat_Html:
+ case eHelpOutputFormat_Rst:
replacement = formatString(
- "<a href=\"%s.html\">%s</a>", targetName.c_str(),
- repall(displayName, sandrHtml).c_str());
+ ":doc:`%s <%s>`", repall(displayName, sandrTty).c_str(),
+ targetName.c_str());
break;
default:
GMX_RELEASE_ASSERT(false, "Output format not implemented for links");
result = repall(result, sandrMan);
return wrapper->wrap(result);
}
- case eHelpOutputFormat_Html:
+ case eHelpOutputFormat_Rst:
{
- result = repall(result, sandrHtml);
+ result = repall(result, sandrRst);
result = replaceLinks(result);
return wrapper->wrap(result);
}
case eHelpOutputFormat_Man:
file.writeLine(formatString(".SH %s", toUpperCase(title).c_str()));
break;
- case eHelpOutputFormat_Html:
- file.writeLine(formatString("<H3>%s</H3>", title.c_str()));
+ case eHelpOutputFormat_Rst:
+ file.writeLine(title);
+ file.writeLine(std::string(title.length(), '-'));
break;
default:
GMX_THROW(NotImplementedError(
void HelpWriterContext::writeOptionListStart() const
{
- if (outputFormat() == eHelpOutputFormat_Html)
- {
- outputFile().writeLine("<dl>");
- }
}
void HelpWriterContext::writeOptionItem(const std::string &name,
writeTextBlock(description);
file.writeLine();
break;
- case eHelpOutputFormat_Html:
+ case eHelpOutputFormat_Rst:
{
- std::string substArgs =
- substituteMarkupAndWrapToString(TextLineWrapperSettings(), args);
- file.writeLine(formatString("<dt><b><tt>%s</tt></b> %s</dt>", name.c_str(),
- substArgs.c_str()));
- file.writeLine("<dd>");
- writeTextBlock(description);
- file.writeLine("</dd>");
+ file.writeLine(formatString("``%s`` %s", name.c_str(), args.c_str()));
+ TextLineWrapperSettings settings;
+ settings.setIndent(4);
+ file.writeLine(substituteMarkupAndWrapToString(settings, description));
break;
}
default:
void HelpWriterContext::writeOptionListEnd() const
{
- if (outputFormat() == eHelpOutputFormat_Html)
- {
- outputFile().writeLine("</dl>");
- }
}
} // namespace gmx