-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXmlGen.cpp
81 lines (73 loc) · 3.4 KB
/
XmlGen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <QtCore>
#include "Markup/Highlight.hpp"
#include "Strings.hpp"
QString entryText(const QString &s)
{
const QHash <QString, const char *> EntryText {
{Strings::BoldFace, "<text:span text:style-name=\"Bold\">"},
{Strings::CodeLine, "<text:p text:style-name=\"CodeLine\">"},
{Strings::Enumerate, "<text:list text:style-name=\"Enumerate\">"},
{Strings::Italic, "<text:span text:style-name=\"Italic\">"},
{Strings::Item, "<text:list-item>"},
{Strings::Itemize, "<text:list>"},
{Strings::Paragraph, "<text:p text:style-name=\"Paragraph\">"},
{Strings::Section, "<text:h text:style-name=\"Section\" text:outline-level=\"2\">"},
{Strings::Subsection, "<text:h text:style-name=\"Subsection\" text:outline-level=\"2\">"},
{Strings::Superscript, "<text:span text:style-name=\"Superscript\">"},
{Strings::Title, "<text:h text:style-name=\"Header_Logo\" text:outline-level=\"1\">"},
{Strings::TextTT, "<text:span text:style-name=\"Monospace\">"},
{Highlight::CommentBlock, "<text:span text:style-name=\"HighlightComment\">"},
{Highlight::CommentCpp, "<text:span text:style-name=\"HighlightComment\">"},
{Highlight::Escape, "<text:span text:style-name=\"HighlightEscape\">"},
{Highlight::KeywordA, "<text:span text:style-name=\"HighlightKeywordA\">"},
{Highlight::KeywordB, "<text:span text:style-name=\"HighlightKeywordB\">"},
{Highlight::KeywordC, "<text:span text:style-name=\"HighlightKeywordC\">"},
{Highlight::IncludeQuote, "<text:span text:style-name=\"HighlightPreprocessor\">"},
{Highlight::LineNumbering, "<text:span text:style-name=\"HighlightLineNumbering\">"},
{Highlight::NumberConstant, "<text:span text:style-name=\"HighlightNumberConstant\">"},
{Highlight::Operator, "<text:span text:style-name=\"HighlightOperator\">"},
{Highlight::Preprocessor, "<text:span text:style-name=\"HighlightPreprocessor\">"},
{Highlight::Standard, "<text:span text:style-name=\"HighlightStandard\">"},
{Highlight::String, "<text:span text:style-name=\"HighlightString\">"},
{Highlight::StringSubstitution, "<text:span text:style-name=\"HighlightStringSubstitution\">"},
{Highlight::Type, "<text:span text:style-name=\"HighlightType\">"},
};
return EntryText.value(s);
}
QString exitText(const QString &s)
{
static const char * HeaderEnd = "</text:h>";
static const char * ListEnd = "</text:list>";
static const char * ParagraphEnd = "</text:p>";
static const char * SpanEnd = "</text:span>";
const QHash <QString, const char *> ExitText {
{Strings::BoldFace, SpanEnd},
{Strings::CodeLine, ParagraphEnd},
{Strings::Italic, SpanEnd},
{Strings::Enumerate, ListEnd},
{Strings::Item, "</text:list-item>"},
{Strings::Itemize, ListEnd},
{Strings::Paragraph, ParagraphEnd},
{Strings::Section, HeaderEnd},
{Strings::Subsection, HeaderEnd},
{Strings::Superscript, SpanEnd},
{Strings::Title, HeaderEnd},
{Strings::TextTT, SpanEnd},
{Highlight::CommentBlock, SpanEnd},
{Highlight::CommentCpp, SpanEnd},
{Highlight::Escape, SpanEnd},
{Highlight::KeywordA, SpanEnd},
{Highlight::KeywordB, SpanEnd},
{Highlight::KeywordC, SpanEnd},
{Highlight::IncludeQuote, SpanEnd},
{Highlight::LineNumbering, SpanEnd},
{Highlight::NumberConstant, SpanEnd},
{Highlight::Operator, SpanEnd},
{Highlight::Preprocessor, SpanEnd},
{Highlight::Standard, SpanEnd},
{Highlight::String, SpanEnd},
{Highlight::StringSubstitution, SpanEnd},
{Highlight::Type, SpanEnd},
};
return ExitText.value(s);
};