Klammerset: the @@@klammerset construct, its search path, and const correctness
The @@@klammerset system command formally declares a klammerset — a named, logically related group of klammer definitions — with an operative, idempotent declaration (:requires and :files load in order at the declaration point, relative to the declaring file). A bare symbol given to ktext -k, kdesc --input, or :requires resolves to x/x.k on the search path: the document's directory, then KLAMMERTEXT_KLAMMERSETS, then KLAMMERTEXT_HOME; kdesc --klammerset lists the available sets. sks/sks.k is the first declared klammerset, so `-k sks` loads the SKS by name. The engine's lookup classes were renamed *_set → *_registry to keep the two concepts apart, and the whole C++ tree now follows standard const-correctness conventions. tst/ gains klammerset_test.sh (18 cases). (from dev 64b1abf23e56)
This commit is contained in:
@@ -32,24 +32,24 @@ public:
|
||||
operator std::string() {
|
||||
std::stringstream ss {}; ss << *this; return ss.str(); };
|
||||
|
||||
HTML(std::string tag) :
|
||||
HTML(const std::string& tag) :
|
||||
m_tag(tag) {};
|
||||
|
||||
HTML(std::string tag, std::string text) :
|
||||
HTML(const std::string& tag, const std::string& text) :
|
||||
m_tag(tag), m_text({text}) {};
|
||||
|
||||
HTML(std::string tag, elements_t elements) :
|
||||
HTML(const std::string& tag, elements_t elements) :
|
||||
m_tag(tag), m_elements(elements) {};
|
||||
|
||||
HTML& attr(std::string name, attr_t value);
|
||||
HTML& attrs(std::string s);
|
||||
HTML& attr(const std::string& name, attr_t value);
|
||||
HTML& attrs(const std::string& s);
|
||||
|
||||
HTML& cls(std::string name) { return attr("class", name); };
|
||||
HTML& sty(std::string css) { return attr("style", css); };
|
||||
HTML& id(std::string id) { return attr("id", id); };
|
||||
HTML& cls(const std::string& name) { return attr("class", name); };
|
||||
HTML& sty(const std::string& css) { return attr("style", css); };
|
||||
HTML& id(const std::string& id) { return attr("id", id); };
|
||||
|
||||
bool void_element(std::string tag) const;
|
||||
bool empty_element(std::string tag) const;
|
||||
bool void_element(const std::string& tag) const;
|
||||
bool empty_element(const std::string& tag) const;
|
||||
friend std::ostream& operator<<(std::ostream& os, const HTML& h);
|
||||
friend std::ostream& operator<<(std::ostream& os, const std::vector<HTML>& hv);
|
||||
|
||||
@@ -68,48 +68,48 @@ private:
|
||||
};
|
||||
|
||||
namespace html {
|
||||
HTML elt(std::string tag);
|
||||
HTML elt(std::string tag, std::string text);
|
||||
HTML elt(std::string tag, elements_t elements);
|
||||
HTML elt(std::string tag, HTML e, elements_t elts);
|
||||
HTML elt(const std::string& tag);
|
||||
HTML elt(const std::string& tag, const std::string& text);
|
||||
HTML elt(const std::string& tag, elements_t elements);
|
||||
HTML elt(const std::string& tag, HTML e, elements_t elts);
|
||||
|
||||
//HTML preamble();
|
||||
//HTML head(strings_t css_filenames, strings_t js_filenames);
|
||||
|
||||
elements_t page(
|
||||
std::string title,
|
||||
const std::string& title,
|
||||
std::string page_title,
|
||||
std::string output_dir,
|
||||
std::string nav,
|
||||
const std::string& output_dir,
|
||||
const std::string& nav,
|
||||
int max_level,
|
||||
std::string toc,
|
||||
std::string text,
|
||||
std::string date,
|
||||
std::string version,
|
||||
std::string copyright,
|
||||
std::string css,
|
||||
const std::string& toc,
|
||||
const std::string& text,
|
||||
const std::string& date,
|
||||
const std::string& version,
|
||||
const std::string& copyright,
|
||||
const std::string& css,
|
||||
strings_t css_filenames = {},
|
||||
strings_t js_filenames = {},
|
||||
strings_t local_fonts = {},
|
||||
std::string logo = {});
|
||||
|
||||
void add_title(elements_t& body, std::string title, std::string logo="");
|
||||
void add_title(elements_t& body, std::string title, std::string logo);
|
||||
void add_title(elements_t& body, const std::string& title, const std::string& logo="");
|
||||
void add_title(elements_t& body, const std::string& title, const std::string& logo);
|
||||
void add_nav(elements_t& body, int max_level);
|
||||
void add_text(elements_t& body, std::string text, std::string toc_text, bool text_only);
|
||||
void add_text(elements_t& body, const std::string& text, const std::string& toc_text, bool text_only);
|
||||
void add_bottom_spacer(elements_t& body);
|
||||
void add_status_bar(elements_t& body, std::string date, std::string version, std::string copyright);
|
||||
void add_status_bar(elements_t& body, const std::string& date, const std::string& version, const std::string& copyright);
|
||||
void add_page_cache(elements_t& body);
|
||||
void add_js_links(elements_t& body, std::vector<std::string> js_filenames, std::string output_dir);
|
||||
void add_js_links(elements_t& body, const std::vector<std::string>& js_filenames, const std::string& output_dir);
|
||||
elements_t make_page(
|
||||
elements_t body,
|
||||
std::string page_title, std::string css,
|
||||
std::vector<std::string> css_filenames,
|
||||
std::vector<std::string> local_fonts);
|
||||
std::string page_title, const std::string& css,
|
||||
const std::vector<std::string>& css_filenames,
|
||||
const std::vector<std::string>& local_fonts);
|
||||
|
||||
bool tag_is_block_element(std::string tag);
|
||||
std::string make_paragraphs(std::string html_text);
|
||||
std::string minimize_css(std::string src);
|
||||
std::string minimize_js(std::string src);
|
||||
bool tag_is_block_element(const std::string& tag);
|
||||
std::string make_paragraphs(const std::string& html_text);
|
||||
std::string minimize_css(const std::string& src);
|
||||
std::string minimize_js(const std::string& src);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user