void HelpWriterContext::Impl::processMarkup(const std::string &text, WrapperInterface *wrapper) const { std::string result(text); for (ReplaceList::const_iterator i = replacements_.begin(); i != replacements_.end(); ++i) { result = replaceAll(result, i->search, i->replace); } switch (state_->format_) { case eHelpOutputFormat_Console: { result = repall(result, sandrTty); result = replaceLinks(result); return wrapper->wrap(result); } case eHelpOutputFormat_Man: { // Needs to be done first to avoid '-' -> '\-' messing up the links. result = replaceLinks(result); result = repall(result, sandrMan); return wrapper->wrap(result); } case eHelpOutputFormat_Html: { result = repall(result, sandrHtml); result = replaceLinks(result); return wrapper->wrap(result); } default: GMX_THROW(InternalError("Invalid help output format")); } }
void HelpWriterContext::Impl::processMarkup(const std::string &text, IWrapper *wrapper) const { std::string result(text); for (ReplaceList::const_iterator i = replacements_.begin(); i != replacements_.end(); ++i) { result = replaceAll(result, i->search, i->replace); } switch (state_->format_) { case eHelpOutputFormat_Console: { const int baseFirstLineIndent = wrapper->settings().firstLineIndent(); const int baseIndent = wrapper->settings().indent(); result = repall(result, sandrTty); result = replaceLinks(result); std::string paragraph; paragraph.reserve(result.length()); RstParagraphIterator iter(result); while (iter.nextParagraph()) { iter.getParagraphText(¶graph); wrapper->settings().setFirstLineIndent(baseFirstLineIndent + iter.firstLineIndent()); wrapper->settings().setIndent(baseIndent + iter.indent()); wrapper->wrap(paragraph); } wrapper->settings().setFirstLineIndent(baseFirstLineIndent); wrapper->settings().setIndent(baseIndent); break; } case eHelpOutputFormat_Rst: { result = repall(result, sandrRst); result = replaceLinks(result); result = replaceAll(result, "[REF]", ""); result = replaceAll(result, "[ref]", ""); result = removeExtraNewlinesRst(result); wrapper->wrap(result); break; } default: GMX_THROW(InternalError("Invalid help output format")); } }