- Consider '-' and '_' as part of a word when replacing links, so that
convert-tpr and make_ndx are considered single words, and the
extensions there are not converted into links.
- Do links.dat replacement before program links, so that the URL in the
above program name links is not processed.
Change-Id: I0ce204d3adedc56e57c1e1cd150a63d21c442eab
HelpExportHtml::HelpExportHtml(const CommandLineHelpModuleImpl &helpModule)
: links_(eHelpOutputFormat_Html)
{
- initProgramLinks(&links_, helpModule);
File linksFile("links.dat", "r");
std::string line;
while (linksFile.readLine(&line))
links_.addLink(line, "../online/" + line, line);
}
linksFile.close();
+ initProgramLinks(&links_, helpModule);
setupHeaderAndFooter();
}
namespace
{
+/*! \brief
+ * Helper function to identify word boundaries for replaceAllWords().
+ *
+ * \returns `true` if the character is considered part of a word.
+ *
+ * \ingroup module_utility
+ */
+bool isWordChar(char c)
+{
+ return std::isalnum(c) || c == '-' || c == '_';
+}
+
/*! \brief
* Common implementation for string replacement functions.
*
size_t matchEnd = matchPos + matchLength;
if (bWholeWords)
{
- if (!((matchPos == 0 || !std::isalnum(input[matchPos-1]))
- && (matchEnd == input.length() || !std::isalnum(input[matchEnd]))))
+ if (!((matchPos == 0 || !isWordChar(input[matchPos-1]))
+ && (matchEnd == input.length() || !isWordChar(input[matchEnd]))))
{
matchPos = input.find(from, matchPos + 1);
continue;