hemplate

Simple XML template engine
git clone git://git.dimitrijedobrota.com/hemplate.git
Log | Files | Refs | README | LICENSE

commit ee98b9c229f2c28adaa21872a0b72d1b4869b26b
parent 98d956c2a2f6c96dff5b0aa4f0c7934ed57c9bb6
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Mon, 24 Jun 2024 20:50:29 +0200

Add RSS and Atom classes under namespace

Diffstat:
M.clang-tidy | 2+-
Minclude/hemplate/classes.hpp | 70+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mtest/source/hemplate_test.cpp | 12++++++------
3 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy @@ -147,7 +147,7 @@ CheckOptions: - key: 'readability-identifier-naming.TemplateTemplateParameterCase' value: 'CamelCase' - key: 'readability-identifier-naming.TypeAliasCase' - value: 'lower_case' + value: 'camelBack' - key: 'readability-identifier-naming.TypedefCase' value: 'lower_case' - key: 'readability-identifier-naming.TypeTemplateParameterCase' diff --git a/include/hemplate/classes.hpp b/include/hemplate/classes.hpp @@ -6,6 +6,8 @@ #include "hemplate/elementBoolean.hpp" #include "hemplate/hemplate_export.hpp" +namespace hemplate { + template<std::size_t N> struct string_literal { @@ -27,7 +29,7 @@ struct tag static char const* get_name() { return Name.data(); } }; -namespace hemplate { +namespace html { using a = elementBoolean<tag<"a">>; using abbr = elementBoolean<tag<"abbr">>; @@ -142,4 +144,70 @@ using var = elementBoolean<tag<"var">>; using video = elementBoolean<tag<"video">>; using wbr = elementAtomic<tag<"wbr">>; +} // namespace html + +namespace rss { + +using author = elementBoolean<tag<"author">>; +using category = elementBoolean<tag<"category">>; +using cloud = elementAtomic<tag<"cloud">>; +using comments = elementBoolean<tag<"comments">>; +using copyright = elementBoolean<tag<"copyright">>; +using description = elementBoolean<tag<"description">>; +using docs = elementBoolean<tag<"docs">>; +using enclosure = elementAtomic<tag<"enclosure">>; +using generator = elementBoolean<tag<"generator">>; +using guid = elementBoolean<tag<"guid">>; +using height = elementBoolean<tag<"height">>; +using image = elementBoolean<tag<"image">>; +using language = elementBoolean<tag<"language">>; +using lastBuildDate = elementBoolean<tag<"lastBuildDate">>; +using link = elementBoolean<tag<"link">>; +using managingEditor = elementBoolean<tag<"managingEditor">>; +using name = elementBoolean<tag<"name">>; +using pubDate = elementBoolean<tag<"pubDate">>; +using rating = elementBoolean<tag<"rating">>; +using skipDays = elementBoolean<tag<"skipDays">>; +using skipHours = elementBoolean<tag<"skipHours">>; +using source = elementBoolean<tag<"source">>; +using textinput = elementBoolean<tag<"textinput">>; +using title = elementBoolean<tag<"title">>; +using ttl = elementBoolean<tag<"ttl">>; +using url = elementBoolean<tag<"url">>; +using webMaster = elementBoolean<tag<"webMaster">>; +using width = elementBoolean<tag<"width">>; +using atomLink = elementAtomic<tag<"atom:link">>; + +} // namespace rss + +namespace atom { + +using author = elementBoolean<tag<"author">>; +using category = elementBoolean<tag<"category">>; +using content = elementBoolean<tag<"content">>; +using contributor = elementBoolean<tag<"contributor">>; +using div = elementBoolean<tag<"div">>; +using entry = elementBoolean<tag<"entry">>; +using feed = elementBoolean<tag<"feed">>; +using generator = elementBoolean<tag<"generator">>; +using icon = elementBoolean<tag<"icon">>; +using id = elementBoolean<tag<"id">>; +using intervalBlock = elementBoolean<tag<"intervalBlock">>; +using link = elementBoolean<tag<"link">>; +using logo = elementBoolean<tag<"logo">>; +using meterReading = elementBoolean<tag<"meterReading">>; +using name = elementBoolean<tag<"name">>; +using published = elementBoolean<tag<"published">>; +using readingType = elementBoolean<tag<"readingType">>; +using rights = elementBoolean<tag<"rights">>; +using source = elementBoolean<tag<"source">>; +using subtitle = elementBoolean<tag<"subtitle">>; +using summary = elementBoolean<tag<"summary">>; +using title = elementBoolean<tag<"title">>; +using update = elementBoolean<tag<"update">>; +using updated = elementBoolean<tag<"updated">>; +using usagePoint = elementBoolean<tag<"usagePoint">>; + +} // namespace atom + } // namespace hemplate diff --git a/test/source/hemplate_test.cpp b/test/source/hemplate_test.cpp @@ -11,15 +11,15 @@ int main() {"class", "home_ul"}, {"style", "margin-bottom: 1em"}}); - std::cout << html() << std::endl; - std::cout << ul("Won't see", ul_attrs) + std::cout << html::html() << std::endl; + std::cout << html::ul("Won't see", ul_attrs) .set("style", "margin-top: 1em") .set("class", "center") - .add(li("Item 1", li_attrs).set("class", "item1")) - .add(li("Item 2", li_attrs).set("class", "item2")) + .add(html::li("Item 1", li_attrs).set("class", "item1")) + .add(html::li("Item 2", li_attrs).set("class", "item2")) << std::endl; - std::cout << meta() << std::endl; - std::cout << html() << std::endl; + std::cout << html::meta() << std::endl; + std::cout << html::html() << std::endl; return 0; }