-
Notifications
You must be signed in to change notification settings - Fork 2
/
XHtml11.h
131 lines (114 loc) · 3.88 KB
/
XHtml11.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/****************************************************************************
**
** Copyright (C) 2015 Jos van den Oever
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 3 as published by the Free Software Foundation and appearing
** in the file lgpl-3.0.txt included in the packaging of this file. Please
** review the following information to ensure the GNU Lesser General Public
** License requirements will be met: https://www.gnu.org/licenses/lgpl.html.
**
****************************************************************************/
#ifndef XHTML11_H
#define XHTML11_H
namespace xhtml11 {
const QString htmlns = QStringLiteral("http://www.w3.org/1999/xhtml");
const QString htmlTag = QStringLiteral("html");
const QString headTag = QStringLiteral("head");
const QString bodyTag = QStringLiteral("body");
const QString titleTag = QStringLiteral("title");
const QString divTag = QStringLiteral("div");
const QString pTag = QStringLiteral("p");
const QString imgTag = QStringLiteral("img");
const QString idTag = QStringLiteral("id");
const QString classTag = QStringLiteral("class");
const QString srcTag = QStringLiteral("src");
const QString altTag = QStringLiteral("alt");
const QString empty;
using HtmlTag = XmlTag<QString,&htmlns, &htmlTag>;
using HeadTag = XmlTag<QString,&htmlns, &headTag>;
using BodyTag = XmlTag<QString,&htmlns, &bodyTag>;
using TitleTag = XmlTag<QString,&htmlns, &titleTag>;
using DivTag = XmlTag<QString,&htmlns, &divTag>;
using PTag = XmlTag<QString,&htmlns, &pTag>;
using ImgTag = XmlTag<QString,&htmlns, &imgTag>;
using IdTag = XmlTag<QString,&empty, &idTag>;
using ClassTag = XmlTag<QString,&empty, &classTag>;
using SrcTag = XmlTag<QString,&empty, &srcTag>;
using AltTag = XmlTag<QString,&empty, &altTag>;
const HtmlTag html;
const HeadTag head;
const TitleTag title;
const BodyTag body;
const DivTag div;
const PTag p;
const ImgTag img;
struct XHtmlDocument {
};
struct HtmlType {
using Tag = HtmlTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
};
struct HeadType {
using Tag = HeadTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
};
struct BodyType {
using Tag = BodyTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
};
struct TitleType {
using Tag = TitleTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
};
struct DivType {
using Tag = DivTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
};
struct PType {
using Tag = PTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
};
struct ImgType {
using Tag = ImgTag;
using allowedAttributes = std::tuple<xhtml11::IdTag,xhtml11::ClassTag>;
using requiredAttributes = std::tuple<xhtml11::SrcTag,xhtml11::AltTag>;
};
}
const xhtml11::IdTag id;
const xhtml11::ClassTag class_;
const xhtml11::SrcTag src;
const xhtml11::AltTag alt;
template <>
struct allowed_child_types<xhtml11::XHtmlDocument> {
using types = std::tuple<xhtml11::HtmlType>;
};
template <>
struct allowed_child_types<xhtml11::HtmlType> {
using types = std::tuple<xhtml11::HeadType, xhtml11::BodyType>;
};
template <>
struct allowed_child_types<xhtml11::HeadType> {
using types = std::tuple<xhtml11::TitleType>;
};
template <>
struct allowed_child_types<xhtml11::TitleType> {
using types = std::tuple<TextType>;
};
template <>
struct allowed_child_types<xhtml11::BodyType> {
using types = std::tuple<xhtml11::DivType,xhtml11::PType,xhtml11::ImgType>;
};
template <>
struct allowed_child_types<xhtml11::DivType> {
using types = std::tuple<xhtml11::DivType,xhtml11::PType,xhtml11::ImgType>;
};
template <>
struct allowed_child_types<xhtml11::PType> {
using types = std::tuple<xhtml11::ImgType,TextType>;
};
template <>
struct allowed_child_types<xhtml11::ImgType> {
using types = std::tuple<>;
};
#endif