Use underscores instead of spaces for all internal names. And renamed some script functions at the same time.

* cannocial_name_form now outputs "_", where it used to use " "
* this simplifies reflectio and scripting code, because now C++ names are also MSE internal names
* added 'caption' property to fields. This is used instead of the name in NativeLookEditor, since the latter will now contain underscores.
* renamed text related script functions for consistency, since we were touching that part of the code anyway.
This commit is contained in:
Twan van Laarhoven
2020-04-22 23:33:06 +02:00
parent be4bb8d8ed
commit 713a9e4a40
33 changed files with 240 additions and 197 deletions
+11 -11
View File
@@ -278,11 +278,11 @@ SCRIPT_FUNCTION(to_html) {
SCRIPT_PARAM_C(String, input);
// symbol font?
SymbolFontP symbol_font;
SCRIPT_OPTIONAL_PARAM_N(String, _("symbol font"), font_name) {
SCRIPT_OPTIONAL_PARAM_N(String, _("symbol_font"), font_name) {
symbol_font = SymbolFont::byName(font_name);
symbol_font->update(ctx);
}
SCRIPT_OPTIONAL_PARAM_N_(double, _("symbol font size"), symbol_font_size);
SCRIPT_OPTIONAL_PARAM_(double, symbol_font_size);
if (symbol_font_size <= 0) symbol_font_size = 12; // a default
SCRIPT_RETURN(to_html(input, symbol_font, symbol_font_size));
}
@@ -290,8 +290,8 @@ SCRIPT_FUNCTION(to_html) {
// convert a symbol string to html
SCRIPT_FUNCTION(symbols_to_html) {
SCRIPT_PARAM_C(String, input);
SCRIPT_PARAM_N(String, _("symbol font"), font_name);
SCRIPT_OPTIONAL_PARAM_N_(double, _("symbol font size"), symbol_font_size);
SCRIPT_PARAM_N(String, _("symbol_font"), font_name);
SCRIPT_OPTIONAL_PARAM_(double, symbol_font_size);
SymbolFontP symbol_font = SymbolFont::byName(font_name);
symbol_font->update(ctx);
if (symbol_font_size <= 0) symbol_font_size = 12; // a default
@@ -451,12 +451,12 @@ SCRIPT_FUNCTION(sanitize) {
// ----------------------------------------------------------------------------- : Init
void init_script_export_functions(Context& ctx) {
ctx.setVariable(_("to html"), script_to_html);
ctx.setVariable(_("symbols to html"), script_symbols_to_html);
ctx.setVariable(_("to text"), script_to_text);
ctx.setVariable(_("copy file"), script_copy_file);
ctx.setVariable(_("write text file"), script_write_text_file);
ctx.setVariable(_("write image file"), script_write_image_file);
ctx.setVariable(_("write set file"), script_write_set_file);
ctx.setVariable(_("to_html"), script_to_html);
ctx.setVariable(_("symbols_to_html"), script_symbols_to_html);
ctx.setVariable(_("to_text"), script_to_text);
ctx.setVariable(_("copy_file"), script_copy_file);
ctx.setVariable(_("write_text_file"), script_write_text_file);
ctx.setVariable(_("write_image_file"), script_write_image_file);
ctx.setVariable(_("write_set_file"), script_write_set_file);
ctx.setVariable(_("sanitize"), script_sanitize);
}