summaryrefslogtreecommitdiffstats
path: root/Source/cmDocumentationFormatterHTML.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-02-19 19:33:43 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2008-02-19 19:33:43 (GMT)
commit969ea3f4491a8c3408bf59744545674b3a647657 (patch)
tree69b48e1c71c000d6723f9047427b69e7c92ee916 /Source/cmDocumentationFormatterHTML.cxx
parentee2a13b11f08efcde4ec3579763ae3236b278693 (diff)
downloadCMake-969ea3f4491a8c3408bf59744545674b3a647657.zip
CMake-969ea3f4491a8c3408bf59744545674b3a647657.tar.gz
CMake-969ea3f4491a8c3408bf59744545674b3a647657.tar.bz2
ENH: add support for creating the documentation in docbook format
(http://www.oasis-open.org/docbook/xml/4.2/), which users can then convert to other formats. Tested with meinproc from KDE, which generates HTML pages which look good. Alex
Diffstat (limited to 'Source/cmDocumentationFormatterHTML.cxx')
-rw-r--r--Source/cmDocumentationFormatterHTML.cxx33
1 files changed, 16 insertions, 17 deletions
diff --git a/Source/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx
index 7422ef4..0c44ed7 100644
--- a/Source/cmDocumentationFormatterHTML.cxx
+++ b/Source/cmDocumentationFormatterHTML.cxx
@@ -32,24 +32,23 @@ static bool cmDocumentationIsHyperlinkChar(char c)
static void cmDocumentationPrintHTMLChar(std::ostream& os, char c)
{
// Use an escape sequence if necessary.
- static std::map<char,std::string> escapes;
- if (escapes.empty())
+ switch (c)
{
- escapes['<'] = "&lt;";
- escapes['>'] = "&gt;";
- escapes['&'] = "&amp;";
- escapes['\n'] = "<br>";
- }
-
- if (escapes.find(c) == escapes.end())
- {
- // No escape sequence is needed.
- os << c;
- return;
- }
-
- os << escapes[c];
- return;
+ case '<':
+ os << "&lt;";
+ break;
+ case '>':
+ os << "&gt;";
+ break;
+ case '&':
+ os << "&amp;";
+ break;
+ case '\n':
+ os << "<br>";
+ break;
+ default:
+ os << c;
+ }
}
//----------------------------------------------------------------------------