25 #include <string_view>
44 template<
typename... Args>
48 if(input.empty())
return {};
53 using tag_attributes = std::vector<std::pair<std::string_view, std::string_view>>;
68 template<
typename... Args>
72 if(input.empty())
return {};
74 ss <<
"<" <<
tag <<
" ";
75 for (
const auto& [key, value] : attrs) {
76 ss << key <<
"='" << value <<
"' ";
78 ss <<
">" << input <<
"</" <<
tag <<
">";
91 template<
typename Value,
typename... Args>
94 return tag(
"span", {{ key, value }}, std::forward<Args>(
data)...);
109 template<
typename... Args>
127 template<
typename... Args>
145 template<
typename... Args>
160 template<
typename... Args>
163 return tag(
"b", std::forward<Args>(
data)...);
175 template<
typename... Args>
178 return tag(
"i", std::forward<Args>(
data)...);
192 std::string
img(
const std::string&
src,
const std::string& align =
"left",
bool floating =
false);
205 std::string
make_link(
const std::string& text,
const std::string&
dst);
A config object defines a single node in a WML file, with access to child nodes.
std::vector< std::pair< std::string_view, std::string_view > > tag_attributes
std::string italic(Args &&... data)
Applies italic Pango markup to the input.
std::string span_attribute(std::string_view key, const Value &value, Args &&... data)
Wraps the given data in a span tag with the specified attribute and value.
std::string img(const std::string &src, const std::string &align, bool floating)
Generates a Help markup tag corresponding to an image.
std::string make_link(const std::string &text, const std::string &dst)
Generates a Help markup tag corresponding to a reference or link.
std::string bold(Args &&... data)
Applies bold Pango markup to the input.
std::string span_color(const color_t &color, Args &&... data)
Applies Pango markup to the input specifying its display color.
std::string tag(std::string_view tag, Args &&... data)
Wraps the given data in the specified tag.
config parse_text(const std::string &text)
Parse a xml style marked up text string.
std::string span_size(std::string_view size, Args &&... data)
Applies Pango markup to the input specifying its display size.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
rect dst
Location on the final composed sheet.
rect src
Non-transparent portion of the surface to compose.
The basic class for representing 8-bit RGB or RGBA colour values.
std::string to_hex_string() const
Returns the stored color in rrggbb hex format.
Base class for all the errors encountered by the engine.
Thrown when the help system fails to parse something.
parse_error(const std::string &msg)