25 #include <string_view>
36 constexpr std::string_view
br{
"<br/>"};
50 template<
typename... Args>
54 if(input.empty())
return {};
59 using tag_attributes = std::vector<std::pair<std::string_view, std::string_view>>;
74 template<
typename... Args>
78 if(input.empty())
return {};
80 ss <<
"<" <<
tag <<
" ";
81 for (
const auto& [key, value] : attrs) {
82 ss << key <<
"='" << value <<
"' ";
84 ss <<
">" << input <<
"</" <<
tag <<
">";
97 template<
typename Value,
typename... Args>
100 return tag(
"span", {{ key, value }}, std::forward<Args>(
data)...);
115 template<
typename... Args>
133 template<
typename... Args>
151 template<
typename... Args>
166 template<
typename... Args>
169 return tag(
"b", std::forward<Args>(
data)...);
181 template<
typename... Args>
184 return tag(
"i", std::forward<Args>(
data)...);
198 std::string
img(
const std::string&
src,
const std::string& align =
"left",
bool floating =
false);
211 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.
constexpr std::string_view br
A Help markup tag corresponding to a linebreak.
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)