The Battle for Wesnoth  1.19.5+dev
Classes | Functions | Variables
markup Namespace Reference

Classes

struct  parse_error
 Thrown when the help system fails to parse something. More...
 

Functions

std::string make_link (const std::string &text, const std::string &dst)
 
std::string img (const std::string &src, const std::string &align, const bool floating)
 
static config parse_entity (std::string::const_iterator &beg, std::string::const_iterator end)
 
static char parse_escape (std::string::const_iterator &beg, std::string::const_iterator end)
 
static config parse_text_until (std::string::const_iterator &beg, std::string::const_iterator end, char close)
 
static std::string parse_name (std::string::const_iterator &beg, std::string::const_iterator end)
 
static std::pair< std::string, std::string > parse_attribute (std::string::const_iterator &beg, std::string::const_iterator end, bool allow_empty)
 
static void check_closing_tag (std::string::const_iterator &beg, std::string::const_iterator end, std::string_view match)
 
static std::pair< std::string, configparse_tag (std::string::const_iterator &beg, std::string::const_iterator end)
 
static config parse_tag_contents (std::string::const_iterator &beg, std::string::const_iterator end, std::string_view match, bool check_for_attributes)
 
config parse_text (const std::string &text)
 Parse a xml style marked up text string. More...
 
template<typename... Args>
std::string tag (const std::string &tag_name, Args &&... contents)
 Returns the contents enclosed inside <tag_name> and </tag_name> More...
 
template<typename... Args>
std::string tag_esc (const std::string &tag_name, Args &&... contents)
 Returns the contents enclosed inside <tag_name> and </tag_name> This version escapes single quotes and backslashes. More...
 
template<typename... Args>
std::string span_color (const color_t &color, Args &&... data)
 Returns a Pango formatting string using the provided color_t object. More...
 
template<typename... Args>
std::string span_color (const std::string &color, Args &&... data)
 Returns a Pango formatting string using the provided hex color string. More...
 
template<typename... Args>
std::string span_size (const std::string &size, Args &&... data)
 Returns a Pango formatting string that set the font size of the enclosed data. More...
 
template<typename... Args>
std::string bold (Args &&... s)
 Returns a Pango formatting string corresponding to bold formatting. More...
 
template<typename... Args>
std::string italic (Args &&... s)
 Returns a Pango formatting string corresponding to italic formatting. More...
 

Variables

static const std::string br = "<br/>"
 

Function Documentation

◆ bold()

template<typename... Args>
std::string markup::bold ( Args &&...  s)

◆ check_closing_tag()

static void markup::check_closing_tag ( std::string::const_iterator &  beg,
std::string::const_iterator  end,
std::string_view  match 
)
static

Definition at line 290 of file markup.cpp.

Referenced by parse_tag_contents().

◆ img()

std::string markup::img ( const std::string &  src,
const std::string &  align,
const bool  floating 
)

◆ italic()

template<typename... Args>
std::string markup::italic ( Args &&...  s)

◆ make_link()

std::string markup::make_link ( const std::string &  text,
const std::string &  dst 
)

◆ parse_attribute()

static std::pair<std::string, std::string> markup::parse_attribute ( std::string::const_iterator &  beg,
std::string::const_iterator  end,
bool  allow_empty 
)
static

◆ parse_entity()

static config markup::parse_entity ( std::string::const_iterator &  beg,
std::string::const_iterator  end 
)
static

Definition at line 90 of file markup.cpp.

References n, and s.

Referenced by parse_attribute(), and parse_text_until().

◆ parse_escape()

static char markup::parse_escape ( std::string::const_iterator &  beg,
std::string::const_iterator  end 
)
static

Definition at line 159 of file markup.cpp.

Referenced by parse_attribute(), and parse_text_until().

◆ parse_name()

static std::string markup::parse_name ( std::string::const_iterator &  beg,
std::string::const_iterator  end 
)
static

Definition at line 219 of file markup.cpp.

References s.

Referenced by parse_attribute(), and parse_tag().

◆ parse_tag()

static std::pair< std::string, config > markup::parse_tag ( std::string::const_iterator &  beg,
std::string::const_iterator  end 
)
static

◆ parse_tag_contents()

static config markup::parse_tag_contents ( std::string::const_iterator &  beg,
std::string::const_iterator  end,
std::string_view  match,
bool  check_for_attributes 
)
static

◆ parse_text()

config markup::parse_text ( const std::string &  text)

Parse a xml style marked up text string.

Return a config with the different parts of the text. Each markup item is a separate part while the text between markups are separate parts.

Definition at line 401 of file markup.cpp.

References config::add_child(), config::append_children(), parse_tag(), parse_text_until(), and tag().

Referenced by BOOST_AUTO_TEST_CASE(), and help::topic_text::parsed_text().

◆ parse_text_until()

static config markup::parse_text_until ( std::string::const_iterator &  beg,
std::string::const_iterator  end,
char  close 
)
static

Definition at line 170 of file markup.cpp.

References config::add_child(), parse_entity(), parse_escape(), and s.

Referenced by parse_attribute(), parse_tag_contents(), and parse_text().

◆ span_color() [1/2]

template<typename... Args>
std::string markup::span_color ( const color_t color,
Args &&...  data 
)

Returns a Pango formatting string using the provided color_t object.

The string returned will be in format: <span foreground=#color>#data</span>

Parameters
colorThe color_t object from which to retrieve the color.
dataThe string to enclose inside the tag. All elements in this list will be concatenated to formatter().

Definition at line 68 of file markup.hpp.

References data, and color_t::to_hex_string().

Referenced by gui2::dialogs::lua_interpreter::lua_model::add_dialog_message(), add_name(), gui2::dialogs::mp_staging::add_side_node(), gui2::dialogs::add_unit_entry(), gui2::dialogs::mp_lobby::adjust_game_row_contents(), gui2::chatbox::append_to_chatbox(), attack_info(), help::best_str(), gui2::dialogs::campaign_selection::campaign_selected(), gui2::addon_list::colorize_addon_state_string(), gui2::dialogs::controller_name(), gui2::dialogs::game_load::evaluate_summary_string(), gui2::dialogs::format_cost_string(), gui2::dialogs::format_if_leader(), gui2::dialogs::format_level_string(), gui2::dialogs::format_movement_string(), help::format_mp_entry(), gui2::dialogs::mp_join_game::generate_side_list(), gui2::get_hp_tooltip(), gui2::get_mp_tooltip(), gui2::dialogs::gray_if_unrecruitable(), gray_inactive(), mp::initial_level_config(), gui2::dialogs::preferences_dialog::initialize_callbacks(), editor::editor_palette< Item >::layout(), gui2::dialogs::mp_lobby::make_game_row_data(), gui2::dialogs::maybe_inactive(), help::unit_topic_generator::operator()(), gui2::dialogs::campaign_difficulty::pre_show(), gui2::dialogs::formula_debugger::pre_show(), gui2::dialogs::game_stats::pre_show(), gui2::dialogs::label_settings::pre_show(), gui2::dialogs::language_selection::pre_show(), gui2::dialogs::mp_change_control::pre_show(), gui2::dialogs::unit_attack::pre_show(), gui2::dialogs::unit_list::pre_show(), gui2::dialogs::unit_recall::pre_show(), gui2::unit_preview_pane::print_attack_details(), REPORT_GENERATOR(), gui2::dialogs::achievements_dialog::set_achievements_row(), gui2::addon_list::set_addons(), gui2::dialogs::attack_predictions::set_data(), gui2::unit_preview_pane::set_displayed_type(), gui2::unit_preview_pane::set_displayed_unit(), gui2::dialogs::preferences_dialog::set_resolution_list(), gui2::dialogs::preferences_dialog::setup_hotkey_list(), gui2::dialogs::tally(), time_of_day_at(), help::time_of_day_bonus_colored(), unit_abilities(), unit_alignment(), unit_box_at(), unit_defense(), unit_hp(), unit_moves(), unit_weapons(), unit_xp(), gui2::lobby_player_list_helper::update(), gui2::dialogs::mp_match_history::update_display(), and attack_type::weapon_specials().

◆ span_color() [2/2]

template<typename... Args>
std::string markup::span_color ( const std::string &  color,
Args &&...  data 
)

Returns a Pango formatting string using the provided hex color string.

The string returned will be in format: <span foreground=#color>#data</span>

Parameters
colorThe hex color string.
dataThe string to enclose inside the tag. All elements in this list will be concatenated to formatter().

Definition at line 83 of file markup.hpp.

References data.

◆ span_size()

template<typename... Args>
std::string markup::span_size ( const std::string &  size,
Args &&...  data 
)

Returns a Pango formatting string that set the font size of the enclosed data.

The string returned will be in format: <span size=#size>#data</span>

Parameters
sizeThe font size. String so values like x-large, large etc could be used.
dataThe string to enclose inside the tag. All elements in this list will be concatenated to formatter().

Definition at line 98 of file markup.hpp.

References data, and utf8::size().

Referenced by gui2::dialogs::mp_lobby::adjust_game_row_contents(), gui2::dialogs::outro::outro(), gui2::dialogs::end_credits::pre_show(), gui2::unit_preview_pane::print_attack_details(), gui2::unit_preview_pane::set_displayed_type(), and gui2::unit_preview_pane::set_displayed_unit().

◆ tag()

template<typename... Args>
std::string markup::tag ( const std::string &  tag_name,
Args &&...  contents 
)

Returns the contents enclosed inside <tag_name> and </tag_name>

Definition at line 35 of file markup.hpp.

Referenced by schema_validation::wml_tag::add_tag(), gui2::dialogs::mp_lobby::adjust_game_row_contents(), carryover_show_gold(), schema_validation::schema_self_validator::check_for_duplicates(), gui2::dialogs::controller_name(), copy_persistent(), gui2::addon_list::display_title_full_shift(), events::console_handler::do_choose_level(), schema_validation::duplicate_key_error(), schema_validation::duplicate_tag_error(), schema_validation::wml_tag::expand_all(), schema_validation::extra_key_error(), schema_validation::schema_validator::find_mandatory_keys(), schema_validation::wml_tag::find_tag(), help::generate_era_topics(), help::generate_faction_topics(), help::generate_time_of_day_topics(), gui2::dialogs::preferences_dialog::get_friends_list_row_data(), gui2::get_hp_tooltip(), gui2::get_mp_tooltip(), schema_validation::inheritance_cycle_error(), schema_validation::inheritance_loop_error(), mp::initial_level_config(), intf_remove_modifications(), schema_validation::link_cycle_error(), config::merge_with(), schema_validation::missing_key_error(), missing_mandatory_wml_tag(), schema_validation::missing_super_error(), schema_validation::schema_validator::open_tag(), help::terrain_topic_generator::operator()(), help::unit_topic_generator::operator()(), parse_tag_contents(), parse_text(), gui2::dialogs::campaign_difficulty::pre_show(), gui2::dialogs::language_selection::pre_show(), schema_validation::wml_tag::printl(), schema_validation::wml_tag::iterator< T, Map >::push_new_tag_conditions(), schema_validation::wml_tag::push_new_tag_conditions(), actions::undo_action::read_event_vector(), schema_validation::wml_tag::remove_keys_by_type(), game_events::filter_dynamic::serialize(), gui2::unit_preview_pane::set_displayed_type(), gui2::unit_preview_pane::set_displayed_unit(), gui2::dialogs::team_mode_controller::show_ai_components(), synced_command::synced_command(), tod_stats_at(), schema_validation::schema_validator::validate(), schema_validation::schema_validator::validate_mandatory_keys(), game_events::wml_action::wml_action(), actions::undo_action::write_event_vector(), schema_validation::wrong_path_error(), schema_validation::wrong_type_error(), and schema_validation::wrong_value_error().

◆ tag_esc()

template<typename... Args>
std::string markup::tag_esc ( const std::string &  tag_name,
Args &&...  contents 
)

Returns the contents enclosed inside <tag_name> and </tag_name> This version escapes single quotes and backslashes.

Definition at line 49 of file markup.hpp.

References utils::escape().

Referenced by bold(), and italic().

Variable Documentation

◆ br

const std::string markup::br = "<br/>"
static