18 if (elements.empty()) {
19 fail(
"Empty-Input is not Writable",
"");
21 auto document = CTML::Document();
24 CTML::Node(name<HtmlTag::META>)
25 .SetAttribute(
"charset",
"utf-8")
29 CTML::Node(name<HtmlTag::META>)
30 .SetAttribute(
"name",
"viewport")
31 .SetAttribute(
"content",
"width=device-width, initial-scale=1, shrink-to-fit=no")
35 CTML::Node(name<HtmlTag::LINK>)
36 .SetAttribute(
"rel",
"stylesheet")
37 .SetAttribute(
"href",
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css")
38 .SetAttribute(
"integrity",
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm")
39 .SetAttribute(
"crossorigin",
"anonymous")
43 CTML::Node(name<HtmlTag::TITLE>,
"Bib-Parser results")
46 auto container = CTML::Node(name<HtmlTag::DIV>).ToggleClass(
"container");
48 fillContainer(container);
51 .AppendChild(container)
53 CTML::Node(name<HtmlTag::SCRIPT>)
54 .SetAttribute(
"src",
"https://code.jquery.com/jquery-3.2.1.slim.min.js")
55 .SetAttribute(
"integrity",
"sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN")
56 .SetAttribute(
"crossorigin",
"anonymous")
59 CTML::Node(name<HtmlTag::SCRIPT>)
60 .SetAttribute(
"src",
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js")
61 .SetAttribute(
"integrity",
"sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q")
62 .SetAttribute(
"crossorigin",
"anonymous")
65 CTML::Node(name<HtmlTag::SCRIPT>)
66 .SetAttribute(
"src",
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js")
67 .SetAttribute(
"integrity",
"sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl")
68 .SetAttribute(
"crossorigin",
"anonymous")
71 return document.ToString();
87 auto accordion = CTML::Node(name<HtmlTag::DIV>).SetAttribute(
"id",
"accordion");
88 for (
const auto &element: elements) {
89 appendCard(accordion, element);
91 parent.AppendChild(accordion);
103 auto card = CTML::Node(name<HtmlTag::DIV>).ToggleClass(
"card");
105 auto cardHeader = CTML::Node(name<HtmlTag::DIV>)
106 .ToggleClass(
"card-header")
107 .SetAttribute(
"id", element.id);
109 auto headerHeading = CTML::Node(name<HtmlTag::H5>).ToggleClass(
"mb-0");
111 auto button = CTML::Node(
112 name<HtmlTag::BUTTON>,
113 element.id +
" - " + element.findAttribute(
"title").value_or<
Field>({
"",
""}).
value
115 .ToggleClass(
"btn btn-link collapsed")
116 .SetAttribute(
"style",
"white-space: normal; text-align: left;")
117 .SetAttribute(
"data-toggle",
"collapse")
118 .SetAttribute(
"data-target",
"#collapse" + element.id)
119 .SetAttribute(
"aria-expanded",
"false")
120 .SetAttribute(
"aria-controls",
"collapse" + element.id);
122 auto cardBodyWrapper = CTML::Node(name<HtmlTag::DIV>)
123 .ToggleClass(
"collapse")
124 .SetAttribute(
"id",
"collapse" + element.id)
125 .SetAttribute(
"aria-labelledby", element.id)
126 .SetAttribute(
"data-parent",
"#accordion");
128 auto cardBody = CTML::Node(name<HtmlTag::DIV>).ToggleClass(
"card-body");
130 appendTable(cardBody, element);
132 cardBodyWrapper.AppendChild(cardBody);
133 headerHeading.AppendChild(button);
134 cardHeader.AppendChild(headerHeading);
135 card.AppendChild(cardHeader);
136 card.AppendChild(cardBodyWrapper);
137 parent.AppendChild(card);
149 auto table = CTML::Node(name<HtmlTag::TABLE>).ToggleClass(
"table");
150 auto tableBody = CTML::Node(name<HtmlTag::TABLE_BODY>);
151 for (
const auto &field : sortedFields(element.attributes)) {
152 auto row = CTML::Node(name<HtmlTag::TABLE_ROW>)
155 name<HtmlTag::TABLE_HEADING>,
157 ).SetAttribute(
"scope",
"row")
159 .AppendChild(CTML::Node(
160 name<HtmlTag::TABLE_ENTRY>,
163 tableBody.AppendChild(row);
166 table.AppendChild(tableBody);
167 parent.AppendChild(table);