", contents: {""})
+> f("text, reminder italic") == "text, reminder "
+
+--See also--
+| [[fun:remove_tag]] Remove a tag, keep the contents.
diff --git a/doc/function/to_boolean.txt b/doc/function/to_boolean.txt
index c14eb604..49ce2954 100644
--- a/doc/function/to_boolean.txt
+++ b/doc/function/to_boolean.txt
@@ -1,20 +1,20 @@
-Function: to_boolean
-
-DOC_MSE_VERSION: since 0.3.7
-
---Usage--
-> to_boolean(any value)
-
-Convert any value to a [[type:boolean]] representation.
-
-Normally numbers are not converted to booleans automatically, with the to_boolean function @0@ is converted to @false@ while any other number is converted to @true@.
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to a boolean.
-
---Examples--
-> to_boolean(true) == true
-> to_boolean("true") == true
-> to_boolean(1) == true
-> to_boolean(0) == false
+Function: to_boolean
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Usage--
+> to_boolean(any value)
+
+Convert any value to a [[type:boolean]] representation.
+
+Normally numbers are not converted to booleans automatically, with the to_boolean function @0@ is converted to @false@ while any other number is converted to @true@.
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to a boolean.
+
+--Examples--
+> to_boolean(true) == true
+> to_boolean("true") == true
+> to_boolean(1) == true
+> to_boolean(0) == false
diff --git a/doc/function/to_color.txt b/doc/function/to_color.txt
index bdfd2655..ef4af37e 100644
--- a/doc/function/to_color.txt
+++ b/doc/function/to_color.txt
@@ -1,16 +1,16 @@
-Function: to_color
-
-DOC_MSE_VERSION: since 0.3.7
-
---Usage--
-> to_color(any value)
-
-Convert any value to a [[type:color]].
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to a color
-
---Examples--
-> to_color("red") == rgb(255,0,0)
-
+Function: to_color
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Usage--
+> to_color(any value)
+
+Convert any value to a [[type:color]].
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to a color
+
+--Examples--
+> to_color("red") == rgb(255,0,0)
+
diff --git a/doc/function/to_date.txt b/doc/function/to_date.txt
index 8b29d7b9..076eeeb7 100644
--- a/doc/function/to_date.txt
+++ b/doc/function/to_date.txt
@@ -1,19 +1,19 @@
-Function: to_date
-
-DOC_MSE_VERSION: since 0.3.8
-
---Usage--
-> to_date(any value)
-
-Convert a string value to a [[type:date]].
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] Value to convert to a date.
-
---Examples--
-> to_date("2008-12-31 23:59:59")
-> to_date("today midnight")
-
---See also--
-| [[fun:to_string]] Convert dates to strings
+Function: to_date
+
+DOC_MSE_VERSION: since 0.3.8
+
+--Usage--
+> to_date(any value)
+
+Convert a string value to a [[type:date]].
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] Value to convert to a date.
+
+--Examples--
+> to_date("2008-12-31 23:59:59")
+> to_date("today midnight")
+
+--See also--
+| [[fun:to_string]] Convert dates to strings
diff --git a/doc/function/to_html.txt b/doc/function/to_html.txt
index 11af6504..cee9f73c 100644
--- a/doc/function/to_html.txt
+++ b/doc/function/to_html.txt
@@ -1,30 +1,30 @@
-Function: to_html
-
---Usage--
-> to_html(some_tagged_text)
-
-Convert a [[type:tagged string]] to HTML code for use in web pages.
-Characters are correctly escaped for HTML code.
-
-The following tags are converted to html:
-! Tag Description
-| <b> Bold
-| <i> Italic
-| <sym> Symbols, if the @symbol_font@ parameter is set.
-
-Symbol fonts can only be used in an [[type:export template]], when create directory is true, as the images
-of the font are written to the output directory.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:tagged string]] String to convert to html
-| @symbol_font@ [[type:string]] (optional) Name of a symbol font to use for images.
-| @symbol_font_size@ [[type:double]] (optional) Size in points to use for the symbol font, default 12
-
---Examples--
-> to_html("bold text") == "bold text"
-> to_html("WU") == "
"
-
---See also--
-| [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]].
-| [[fun:to_text]] Remove all tags from tagged text, and convert it to a [[type:string]].
+Function: to_html
+
+--Usage--
+> to_html(some_tagged_text)
+
+Convert a [[type:tagged string]] to HTML code for use in web pages.
+Characters are correctly escaped for HTML code.
+
+The following tags are converted to html:
+! Tag Description
+| <b> Bold
+| <i> Italic
+| <sym> Symbols, if the @symbol_font@ parameter is set.
+
+Symbol fonts can only be used in an [[type:export template]], when create directory is true, as the images
+of the font are written to the output directory.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:tagged string]] String to convert to html
+| @symbol_font@ [[type:string]] (optional) Name of a symbol font to use for images.
+| @symbol_font_size@ [[type:double]] (optional) Size in points to use for the symbol font, default 12
+
+--Examples--
+> to_html("bold text") == "bold text"
+> to_html("WU") == "
"
+
+--See also--
+| [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]].
+| [[fun:to_text]] Remove all tags from tagged text, and convert it to a [[type:string]].
diff --git a/doc/function/to_image.txt b/doc/function/to_image.txt
index 2947c05a..9de1d8bf 100644
--- a/doc/function/to_image.txt
+++ b/doc/function/to_image.txt
@@ -1,17 +1,17 @@
-Function: to_image
-
-DOC_MSE_VERSION: since 0.3.8
-
---Usage--
-> to_image(any value)
-
-Convert any value to a [[type:image]].
-
-A string is interpreted as a [[type:filename]].
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to an image
-
---Examples--
->>> to_image("image1.png") ==
+Function: to_image
+
+DOC_MSE_VERSION: since 0.3.8
+
+--Usage--
+> to_image(any value)
+
+Convert any value to a [[type:image]].
+
+A string is interpreted as a [[type:filename]].
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to an image
+
+--Examples--
+>>> to_image("image1.png") ==
diff --git a/doc/function/to_int.txt b/doc/function/to_int.txt
index 0956ee5c..bf2556db 100644
--- a/doc/function/to_int.txt
+++ b/doc/function/to_int.txt
@@ -1,30 +1,30 @@
-Function: to_int
-
-DOC_MSE_VERSION: since 0.3.7
-
---Usage--
-> to_int(any value)
-
-Convert any value to a [[type:int]].
-
-* Real numbers are rounded towards zero when converted to integer numbers.
-* The boolean value @true@ becomes @1@, while @false@ is converted to @0@.
-* For colors the grayscale value between @0@ and @255@ is returned.
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to an integer number
-
---Examples--
-> to_int(1.5) == "1"
-> to_int("15") == "15"
-> to_int(true) == 1
-> to_int(rgb(255,255,255)) == 255
-
-Use @or else@ to recover from errors:
-> to_number("not a number") or else 0 == 0
-> to_number("123") or else 0 == 123
-
---See also--
-| [[fun:to_real]] Convert any value to a [[type:double]]
-| [[fun:to_number]] Convert any value to a number
+Function: to_int
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Usage--
+> to_int(any value)
+
+Convert any value to a [[type:int]].
+
+* Real numbers are rounded towards zero when converted to integer numbers.
+* The boolean value @true@ becomes @1@, while @false@ is converted to @0@.
+* For colors the grayscale value between @0@ and @255@ is returned.
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to an integer number
+
+--Examples--
+> to_int(1.5) == "1"
+> to_int("15") == "15"
+> to_int(true) == 1
+> to_int(rgb(255,255,255)) == 255
+
+Use @or else@ to recover from errors:
+> to_number("not a number") or else 0 == 0
+> to_number("123") or else 0 == 123
+
+--See also--
+| [[fun:to_real]] Convert any value to a [[type:double]]
+| [[fun:to_number]] Convert any value to a number
diff --git a/doc/function/to_lower.txt b/doc/function/to_lower.txt
index 35ad5d49..400d96ef 100644
--- a/doc/function/to_lower.txt
+++ b/doc/function/to_lower.txt
@@ -1,18 +1,18 @@
-Function: to_lower
-
---Usage--
-> to_lower(some_string)
-
-Convert a string to lower case.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] String to convert.
-
---Examples--
-> to_lower("ABC") == "abc"
-> to_lower("123 aBc") == "123 abc"
-
---See also--
-| [[fun:to_upper]] Convert a string to upper case, @"aBc" -> "ABC"@.
-| [[fun:to_title]] Convert a string to title case, @"aBc" -> "Abc"@.
+Function: to_lower
+
+--Usage--
+> to_lower(some_string)
+
+Convert a string to lower case.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] String to convert.
+
+--Examples--
+> to_lower("ABC") == "abc"
+> to_lower("123 aBc") == "123 abc"
+
+--See also--
+| [[fun:to_upper]] Convert a string to upper case, @"aBc" -> "ABC"@.
+| [[fun:to_title]] Convert a string to title case, @"aBc" -> "Abc"@.
diff --git a/doc/function/to_number.txt b/doc/function/to_number.txt
index 7b48a9b6..019073ec 100644
--- a/doc/function/to_number.txt
+++ b/doc/function/to_number.txt
@@ -1,29 +1,29 @@
-Function: to_number
-
-DOC_MSE_VERSION: since 0.3.7
-
---Usage--
-> to_number(any value)
-
-Convert any value to a number.
-If the number can be represented as an [[type:int|integer number]] that is done.
-Otherwise it is converted to a [[type:double]].
-
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to a number
-
---Examples--
-> to_number(1) == 1
-> to_number(1.5) == 1.5
-> to_number("1") == 1
-> to_number("1.5") == 1.5
-
-Use @or else@ to recover from errors:
-> to_number("not a number") or else 0 == 0
-> to_number("123") or else 0 == 123
-
---See also--
-| [[fun:to_int]] Convert any value to a [[type:int]]
-| [[fun:to_real]] Convert any value to a [[type:double]]
+Function: to_number
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Usage--
+> to_number(any value)
+
+Convert any value to a number.
+If the number can be represented as an [[type:int|integer number]] that is done.
+Otherwise it is converted to a [[type:double]].
+
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to a number
+
+--Examples--
+> to_number(1) == 1
+> to_number(1.5) == 1.5
+> to_number("1") == 1
+> to_number("1.5") == 1.5
+
+Use @or else@ to recover from errors:
+> to_number("not a number") or else 0 == 0
+> to_number("123") or else 0 == 123
+
+--See also--
+| [[fun:to_int]] Convert any value to a [[type:int]]
+| [[fun:to_real]] Convert any value to a [[type:double]]
diff --git a/doc/function/to_real.txt b/doc/function/to_real.txt
index 7b3a74fb..78985a51 100644
--- a/doc/function/to_real.txt
+++ b/doc/function/to_real.txt
@@ -1,25 +1,25 @@
-Function: to_real
-
-DOC_MSE_VERSION: since 0.3.7
-
---Usage--
-> to_real(any value)
-
-Convert any value to a [[type:double]].
-
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to a real number
-
---Examples--
-> to_real(1) == 1.0
-> to_real("1.5") == 1.5
-
-Use @or else@ to recover from errors:
-> to_number("not a number") or else 0.0 == 0.0
-> to_number("123") or else 0.0 == 123.0
-
---See also--
-| [[fun:to_int]] Convert any value to a [[type:int]]
-| [[fun:to_number]] Convert any value to a number
+Function: to_real
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Usage--
+> to_real(any value)
+
+Convert any value to a [[type:double]].
+
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to a real number
+
+--Examples--
+> to_real(1) == 1.0
+> to_real("1.5") == 1.5
+
+Use @or else@ to recover from errors:
+> to_number("not a number") or else 0.0 == 0.0
+> to_number("123") or else 0.0 == 123.0
+
+--See also--
+| [[fun:to_int]] Convert any value to a [[type:int]]
+| [[fun:to_number]] Convert any value to a number
diff --git a/doc/function/to_string.txt b/doc/function/to_string.txt
index caff65de..c506e630 100644
--- a/doc/function/to_string.txt
+++ b/doc/function/to_string.txt
@@ -1,27 +1,27 @@
-Function: to_string
-
-DOC_MSE_VERSION: since 0.3.7
-
---Usage--
-> to_string(any value)
-
-Convert any value to a [[type:string]] representation.
-
-
-The @to_string@ function should not be confused with @to_text@.
-The former converts things like number to string, while the latter removes tags from a [[type:tagged string]].
-
---Parameters--
-! Parameter Type Description
-| @input@ ''any type'' Value to convert to a string
-| @format@ ''optional'' Formatting to apply.
- This takes the same form as [[http://www.cplusplus.com/reference/clibrary/cstdio/printf.html|printf format specifiers]].
- When formating a date, the format string takes the same form as [[http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html|strftime format specifiers]].
-
---Examples--
-> to_string(to_color("blue")) == "rgb(0,0,255)"
-> to_string(10 + 20) == "30"
-> to_string(10 + 20, format: ".3f") == "30.000"
-> to_string(10 + 20, format: "x") == "1e" # hexadecimal notation
-> to_string("xy", format: "3s") == " xy"
-> to_string(to_date("2008-12-31 23:59:59"), format:"%d/%m/%y") == "31/12/08"
+Function: to_string
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Usage--
+> to_string(any value)
+
+Convert any value to a [[type:string]] representation.
+
+
+The @to_string@ function should not be confused with @to_text@.
+The former converts things like number to string, while the latter removes tags from a [[type:tagged string]].
+
+--Parameters--
+! Parameter Type Description
+| @input@ ''any type'' Value to convert to a string
+| @format@ ''optional'' Formatting to apply.
+ This takes the same form as [[http://www.cplusplus.com/reference/clibrary/cstdio/printf.html|printf format specifiers]].
+ When formating a date, the format string takes the same form as [[http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html|strftime format specifiers]].
+
+--Examples--
+> to_string(to_color("blue")) == "rgb(0,0,255)"
+> to_string(10 + 20) == "30"
+> to_string(10 + 20, format: ".3f") == "30.000"
+> to_string(10 + 20, format: "x") == "1e" # hexadecimal notation
+> to_string("xy", format: "3s") == " xy"
+> to_string(to_date("2008-12-31 23:59:59"), format:"%d/%m/%y") == "31/12/08"
diff --git a/doc/function/to_text.txt b/doc/function/to_text.txt
index 2dd9c47a..97a2c0cb 100644
--- a/doc/function/to_text.txt
+++ b/doc/function/to_text.txt
@@ -1,19 +1,19 @@
-Function: to_text
-
---Usage--
-> to_text(some_tagged_text)
-
-Convert a [[type:tagged string]] to a normal string by removing all tags and restoring escaped < characters.
-
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:tagged string]] String to convert to text
-
---Examples--
-> to_text("bold text") == "bold text"
-> to_text("1 \< 2") == "1 < 2"
-
---See also--
-| [[fun:to_html]] Convert [[type:tagged text]] to html.
-| [[fun:remove_tags]] Remove all tags from tagged text.
+Function: to_text
+
+--Usage--
+> to_text(some_tagged_text)
+
+Convert a [[type:tagged string]] to a normal string by removing all tags and restoring escaped < characters.
+
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:tagged string]] String to convert to text
+
+--Examples--
+> to_text("bold text") == "bold text"
+> to_text("1 \< 2") == "1 < 2"
+
+--See also--
+| [[fun:to_html]] Convert [[type:tagged text]] to html.
+| [[fun:remove_tags]] Remove all tags from tagged text.
diff --git a/doc/function/to_title.txt b/doc/function/to_title.txt
index 345b500a..06b44b87 100644
--- a/doc/function/to_title.txt
+++ b/doc/function/to_title.txt
@@ -1,18 +1,18 @@
-Function: to_title
-
---Usage--
-> to_title(some_string)
-
-Convert a string to title case, where each words starts with an upper case leter.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] String to convert.
-
---Examples--
-> to_title("ABC") == "Abc"
-> to_title("123 aBc") == "123 Abc"
-
---See also--
-| [[fun:to_lower]] Convert a string to lower case, @"aBc" -> "abc"@.
-| [[fun:to_upper]] Convert a string to upper case, @"aBc" -> "ABC"@.
+Function: to_title
+
+--Usage--
+> to_title(some_string)
+
+Convert a string to title case, where each words starts with an upper case leter.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] String to convert.
+
+--Examples--
+> to_title("ABC") == "Abc"
+> to_title("123 aBc") == "123 Abc"
+
+--See also--
+| [[fun:to_lower]] Convert a string to lower case, @"aBc" -> "abc"@.
+| [[fun:to_upper]] Convert a string to upper case, @"aBc" -> "ABC"@.
diff --git a/doc/function/to_upper.txt b/doc/function/to_upper.txt
index 7ad35e40..33d7460c 100644
--- a/doc/function/to_upper.txt
+++ b/doc/function/to_upper.txt
@@ -1,18 +1,18 @@
-Function: to_upper
-
---Usage--
-> to_upper(some_string)
-
-Convert a string to upper case.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] String to convert.
-
---Examples--
-> to_upper("abc") == "ABC"
-> to_upper("123 aBc") == "123 ABC"
-
---See also--
-| [[fun:to_lower]] Convert a string to lower case, @"aBc" -> "abc"@.
-| [[fun:to_title]] Convert a string to title case, @"aBc" -> "Abc"@.
+Function: to_upper
+
+--Usage--
+> to_upper(some_string)
+
+Convert a string to upper case.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] String to convert.
+
+--Examples--
+> to_upper("abc") == "ABC"
+> to_upper("123 aBc") == "123 ABC"
+
+--See also--
+| [[fun:to_lower]] Convert a string to lower case, @"aBc" -> "abc"@.
+| [[fun:to_title]] Convert a string to title case, @"aBc" -> "Abc"@.
diff --git a/doc/function/trace.txt b/doc/function/trace.txt
index 084ce294..9020212b 100644
--- a/doc/function/trace.txt
+++ b/doc/function/trace.txt
@@ -1,17 +1,17 @@
-Function: trace
-
---Usage--
-> trace(some_string)
-
-Output a message for debugging purposes, for example to investigate what is going on in some function.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] Message
-
---Examples--
-> trace("message") == "message" # the message is shown in the console panel
-
---See also--
-| [[fun:warning]] Output a warning message.
-| [[fun:error]] Output an error message.
+Function: trace
+
+--Usage--
+> trace(some_string)
+
+Output a message for debugging purposes, for example to investigate what is going on in some function.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] Message
+
+--Examples--
+> trace("message") == "message" # the message is shown in the console panel
+
+--See also--
+| [[fun:warning]] Output a warning message.
+| [[fun:error]] Output an error message.
diff --git a/doc/function/trim.txt b/doc/function/trim.txt
index e366e7eb..bb85a085 100644
--- a/doc/function/trim.txt
+++ b/doc/function/trim.txt
@@ -1,14 +1,14 @@
-Function: trim
-
---Usage--
-> trim(some_string)
-
-Remove leading and trailing whitespace from a string.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] String to remove whitespace from.
-
---Examples--
-> trim(" abc ") == "abc"
-> trim(" one two three ") == "one two three"
+Function: trim
+
+--Usage--
+> trim(some_string)
+
+Remove leading and trailing whitespace from a string.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] String to remove whitespace from.
+
+--Examples--
+> trim(" abc ") == "abc"
+> trim(" one two three ") == "one two three"
diff --git a/doc/function/warning.txt b/doc/function/warning.txt
index 5ade4d84..30d6c164 100644
--- a/doc/function/warning.txt
+++ b/doc/function/warning.txt
@@ -1,21 +1,21 @@
-Function: warning
-
-DOC_MSE_VERSION: since 2.0.1
-
---Usage--
-> warning(some_string)
-
-Output a warning message.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] Message
-| @condition@ [[type:boolean]] (optional) Only show the message if this condition holds.
-
---Examples--
-> warning("message")" # the message is shown in the console panel
-> warning("message", condition: false) # shows no message
-
---See also--
-| [[fun:assert]] Check that the condition is @true@. Shows a warning message if it is not.
-| [[fun:error]] Output an error message.
+Function: warning
+
+DOC_MSE_VERSION: since 2.0.1
+
+--Usage--
+> warning(some_string)
+
+Output a warning message.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] Message
+| @condition@ [[type:boolean]] (optional) Only show the message if this condition holds.
+
+--Examples--
+> warning("message")" # the message is shown in the console panel
+> warning("message", condition: false) # shows no message
+
+--See also--
+| [[fun:assert]] Check that the condition is @true@. Shows a warning message if it is not.
+| [[fun:error]] Output an error message.
diff --git a/doc/function/write_image_file.txt b/doc/function/write_image_file.txt
index 19de6c8d..ea89e91b 100644
--- a/doc/function/write_image_file.txt
+++ b/doc/function/write_image_file.txt
@@ -1,24 +1,24 @@
-Function: write_image_file
-
---Usage--
-> write_image_file(some_image, file: filename)
-
-Write an image to a file in the output directory.
-If a file with the given name already exists it is overwritten.
-
-Returns the name of the file written.
-
-This function can only be used in an [[type:export template]], when create directory is true.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:image]] Image to write to the file.
-| @file@ [[type:string]] Name of the file to write to
-| @width@ [[type:int]] Width in pixels to use for the image, by default the size of the image is used if available.
-| @height@ [[type:int]] Height in pixels to use for the image, by default the size of the image is used if available.
-
---Examples--
-> write_image_file(file:"image_out.png", linear_blend(...)) == "image_out.png" # image_out.png now contains the given image
-
---See also--
-| [[fun:write_text_file]] Write a text file to the output directory.
+Function: write_image_file
+
+--Usage--
+> write_image_file(some_image, file: filename)
+
+Write an image to a file in the output directory.
+If a file with the given name already exists it is overwritten.
+
+Returns the name of the file written.
+
+This function can only be used in an [[type:export template]], when create directory is true.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:image]] Image to write to the file.
+| @file@ [[type:string]] Name of the file to write to
+| @width@ [[type:int]] Width in pixels to use for the image, by default the size of the image is used if available.
+| @height@ [[type:int]] Height in pixels to use for the image, by default the size of the image is used if available.
+
+--Examples--
+> write_image_file(file:"image_out.png", linear_blend(...)) == "image_out.png" # image_out.png now contains the given image
+
+--See also--
+| [[fun:write_text_file]] Write a text file to the output directory.
diff --git a/doc/function/write_set_file.txt b/doc/function/write_set_file.txt
index 6c08c967..99ab5ae7 100644
--- a/doc/function/write_set_file.txt
+++ b/doc/function/write_set_file.txt
@@ -1,25 +1,25 @@
-Function: write_set_file
-
-DOC_MSE_VERSION: since 0.3.8
-
---Usage--
-> write_set_file(set:the_set, file: filename)
-
-Write the current set to a file in the output directory.
-If a file with the given name already exists it is overwritten.
-
-Returns the name of the file written.
-
-This function can only be used in an [[type:export template]], when create directory is true.
-
---Parameters--
-! Parameter Type Description
-| @set@ [[type:set]] Set to write to the file.
-| @file@ [[type:string]] Name of the file to write to
-
---Examples--
-> write_set_file(file:"the-set.mse-set") == "the-set.mse-set" # the-set.mse-set now contains the set
-
---See also--
-| [[fun:write_image_file]] Write an image file to the output directory.
-| [[fun:write_text_file]] Write a text file to the output directory.
+Function: write_set_file
+
+DOC_MSE_VERSION: since 0.3.8
+
+--Usage--
+> write_set_file(set:the_set, file: filename)
+
+Write the current set to a file in the output directory.
+If a file with the given name already exists it is overwritten.
+
+Returns the name of the file written.
+
+This function can only be used in an [[type:export template]], when create directory is true.
+
+--Parameters--
+! Parameter Type Description
+| @set@ [[type:set]] Set to write to the file.
+| @file@ [[type:string]] Name of the file to write to
+
+--Examples--
+> write_set_file(file:"the-set.mse-set") == "the-set.mse-set" # the-set.mse-set now contains the set
+
+--See also--
+| [[fun:write_image_file]] Write an image file to the output directory.
+| [[fun:write_text_file]] Write a text file to the output directory.
diff --git a/doc/function/write_text_file.txt b/doc/function/write_text_file.txt
index de2c7d0b..8ad822ac 100644
--- a/doc/function/write_text_file.txt
+++ b/doc/function/write_text_file.txt
@@ -1,22 +1,22 @@
-Function: write_text_file
-
---Usage--
-> write_text_file(some_string, file: filename)
-
-Write a string to a file in the output directory.
-If a file with the given name already exists it is overwritten.
-
-Returns the name of the file written.
-
-This function can only be used in an [[type:export template]], when create directory is true.
-
---Parameters--
-! Parameter Type Description
-| @input@ [[type:string]] Text to write to the file.
-| @file@ [[type:string]] Name of the file to write to
-
---Examples--
-> write_text_file(file:"index.html", lots_of_html_code) == "index.html" # index.html now contains the given text
-
---See also--
-| [[fun:write_image_file]] Write an image file to the output directory.
+Function: write_text_file
+
+--Usage--
+> write_text_file(some_string, file: filename)
+
+Write a string to a file in the output directory.
+If a file with the given name already exists it is overwritten.
+
+Returns the name of the file written.
+
+This function can only be used in an [[type:export template]], when create directory is true.
+
+--Parameters--
+! Parameter Type Description
+| @input@ [[type:string]] Text to write to the file.
+| @file@ [[type:string]] Name of the file to write to
+
+--Examples--
+> write_text_file(file:"index.html", lots_of_html_code) == "index.html" # index.html now contains the given text
+
+--See also--
+| [[fun:write_image_file]] Write an image file to the output directory.
diff --git a/doc/index.txt b/doc/index.txt
index 77fc333f..b68fd21e 100644
--- a/doc/index.txt
+++ b/doc/index.txt
@@ -1,20 +1,20 @@
-Documentation
-
-Welcome to the Magic Set Editor technical documentation.
-These documents describe the file formats and scirpting language used by the program.
-
-There is currently no information on how to ''use'' the program for making cards.
-
---Topics--
-Using the program:
-* [[doc/cli|Invoking MSE from the command line]]
-Templates:
-* [[doc/tutorial|Templating tutorial]] (comming soon)
-* [[doc/file|File formats]]
-* [[doc/type|Data types used in the files]]
-* [[doc/script|Scripting language overview]]
-* [[doc/function|Script function reference]]
-
---Other information--
-* [[doc/about|MSE credits]]
-* [[doc/about/license|License]]
+Documentation
+
+Welcome to the Magic Set Editor technical documentation.
+These documents describe the file formats and scirpting language used by the program.
+
+There is currently no information on how to ''use'' the program for making cards.
+
+--Topics--
+Using the program:
+* [[doc/cli|Invoking MSE from the command line]]
+Templates:
+* [[doc/tutorial|Templating tutorial]] (comming soon)
+* [[doc/file|File formats]]
+* [[doc/type|Data types used in the files]]
+* [[doc/script|Scripting language overview]]
+* [[doc/function|Script function reference]]
+
+--Other information--
+* [[doc/about|MSE credits]]
+* [[doc/about/license|License]]
diff --git a/doc/script/best_practices.txt b/doc/script/best_practices.txt
index bbef82b3..fad512df 100644
--- a/doc/script/best_practices.txt
+++ b/doc/script/best_practices.txt
@@ -1,116 +1,116 @@
-Best practices
-
-Here are some best practices and tricks for using scripts, try to follow this as much as possible.
-
---Use comments--
-Put comments before function definitions to describe what the function does:
-> # Transmogrifies a flubble value for in grunk costs
-> flubble_script := { ... }
-
---Use short scripts--
-Try to put as little as possible in [[type:field]] scripts.
-Instead define a function in the init script.
-
-'''bad''':
->field:
-> name: flubble
-> script:
-> some very complicted expression
-'''good''':
->init script:
-> ...
-> flubble_script := { some very complicted expression }
->field:
-> script: flubble_script()
-
---Use default arguments--
-
-Many functions can be chained together using the @+@ operator.
-For these functions [[script:default arguments]] can be given.
-Have a look at @text_filter@ in the magic game file for an example.
-
-Using default arguments is especially important for functions that work on [[type:regex|regular expressions]],
-since it allows MSE to compile the regular expressions just once instead of for every call.
-
---Don't be afraid to nest--
-Don't be afraid to nest complex things like @if@ expressions inside other expressions.
-For example the blend scripts for magic use:
-> colors := sort_text( order: "(wubrg)"
-> , (if chosen(choice:"white") then "w")
-> + (if chosen(choice:"blue") then "u")
-> + (if chosen(choice:"black") then "b")
-> + (if chosen(choice:"red") then "r")
-> + (if chosen(choice:"green") then "g"))
-and:
-> font_color_positions
-> [ if chosen(choice:"horizontal") then "horizontal"
-> else if chosen(choice:"vertical") then "vertical"
-> else if chosen(choice:"overlay") then "overlay"
-> else "radial"
-> ][number_of_items(in: colors)]
-
---Re-use functions--
-If two scripts or functions are very similair put the common part into another function.
-The differences can be passed in parameters.
-
-A good example is in the @something 2@ fields used for Magic split and flip cards.
-They behave exactly the same as the non-2 variants.
-Don't use:
->init script:
-> automatic_card_color_based_on_casting_cost := { ... card.casting_cost ... }
-> automatic_card_color_based_on_casting_cost_2 := { ... card.casting_cost_2 ... }
->field:
-> name: card color
-> default: automatic_card_color_based_on_casting_cost()
->field:
-> name: card color
-> default: automatic_card_color_based_on_casting_cost_2()
-Instead use:
->init script:
-> automatic_card_color := { ... input ... }
->field:
-> name: card color
-> default: automatic_card_color(card.casting_cost)
->field:
-> name: card color
-> default: automatic_card_color(card.casting_cost_2)
-
---Trick: hooks--
-Use this trick when defining a large function that might be overridden by stylesheets.
-
-For example things like the blend scripts for Magic cards are very large, and they are shared by all stylesheets.
-Some stylesheets need to do something special, or they don't support a particular template.
-This can be handled using hooks.
-
-What this means is that you don't do:
-> blend := { large and complicated function bla bla, use "template.png" bla bla }
-But instead
-> template := "template.png"
-> blend := { large and complicated function bla bla, use template bla bla }
-Now a stylesheet can override this template by just changing that variable.
-
-Another option is splitting up the template
-> blend := { large and complicated function bla bla, continue_blend() }
-> continue_blend := { use template bla bla, etc. }
-
-A stylesheet can override just a part of this, or even put something in between:
-> really_continue_blend := continue_blend
-> continue_blend := { do_this_first; really_continue_blend() }
-
---Trick: lookup tables--
-Sometimes the behaviour of a function depends on a particular value.
-A good example of this are (again) the magic blend scripts.
-What way cards are blended depends on the number of colors and on the 'style' of blending.
-
-Instead of using a lot of @if@ statements it can be cleaner to use a [[type:map]] as a lookup table.
-So, instead of:
-> if style == "horizontal" then lots of code
-> else if style == "vertical" then lots of code
-> # etc.
-use:
-> blends := [
-> horizontal: { lots of code }
-> vertical: { lots of code }
-> ]
-> ...
-> blends(style)() # lookup and call the function
+Best practices
+
+Here are some best practices and tricks for using scripts, try to follow this as much as possible.
+
+--Use comments--
+Put comments before function definitions to describe what the function does:
+> # Transmogrifies a flubble value for in grunk costs
+> flubble_script := { ... }
+
+--Use short scripts--
+Try to put as little as possible in [[type:field]] scripts.
+Instead define a function in the init script.
+
+'''bad''':
+>field:
+> name: flubble
+> script:
+> some very complicted expression
+'''good''':
+>init script:
+> ...
+> flubble_script := { some very complicted expression }
+>field:
+> script: flubble_script()
+
+--Use default arguments--
+
+Many functions can be chained together using the @+@ operator.
+For these functions [[script:default arguments]] can be given.
+Have a look at @text_filter@ in the magic game file for an example.
+
+Using default arguments is especially important for functions that work on [[type:regex|regular expressions]],
+since it allows MSE to compile the regular expressions just once instead of for every call.
+
+--Don't be afraid to nest--
+Don't be afraid to nest complex things like @if@ expressions inside other expressions.
+For example the blend scripts for magic use:
+> colors := sort_text( order: "(wubrg)"
+> , (if chosen(choice:"white") then "w")
+> + (if chosen(choice:"blue") then "u")
+> + (if chosen(choice:"black") then "b")
+> + (if chosen(choice:"red") then "r")
+> + (if chosen(choice:"green") then "g"))
+and:
+> font_color_positions
+> [ if chosen(choice:"horizontal") then "horizontal"
+> else if chosen(choice:"vertical") then "vertical"
+> else if chosen(choice:"overlay") then "overlay"
+> else "radial"
+> ][number_of_items(in: colors)]
+
+--Re-use functions--
+If two scripts or functions are very similair put the common part into another function.
+The differences can be passed in parameters.
+
+A good example is in the @something 2@ fields used for Magic split and flip cards.
+They behave exactly the same as the non-2 variants.
+Don't use:
+>init script:
+> automatic_card_color_based_on_casting_cost := { ... card.casting_cost ... }
+> automatic_card_color_based_on_casting_cost_2 := { ... card.casting_cost_2 ... }
+>field:
+> name: card color
+> default: automatic_card_color_based_on_casting_cost()
+>field:
+> name: card color
+> default: automatic_card_color_based_on_casting_cost_2()
+Instead use:
+>init script:
+> automatic_card_color := { ... input ... }
+>field:
+> name: card color
+> default: automatic_card_color(card.casting_cost)
+>field:
+> name: card color
+> default: automatic_card_color(card.casting_cost_2)
+
+--Trick: hooks--
+Use this trick when defining a large function that might be overridden by stylesheets.
+
+For example things like the blend scripts for Magic cards are very large, and they are shared by all stylesheets.
+Some stylesheets need to do something special, or they don't support a particular template.
+This can be handled using hooks.
+
+What this means is that you don't do:
+> blend := { large and complicated function bla bla, use "template.png" bla bla }
+But instead
+> template := "template.png"
+> blend := { large and complicated function bla bla, use template bla bla }
+Now a stylesheet can override this template by just changing that variable.
+
+Another option is splitting up the template
+> blend := { large and complicated function bla bla, continue_blend() }
+> continue_blend := { use template bla bla, etc. }
+
+A stylesheet can override just a part of this, or even put something in between:
+> really_continue_blend := continue_blend
+> continue_blend := { do_this_first; really_continue_blend() }
+
+--Trick: lookup tables--
+Sometimes the behaviour of a function depends on a particular value.
+A good example of this are (again) the magic blend scripts.
+What way cards are blended depends on the number of colors and on the 'style' of blending.
+
+Instead of using a lot of @if@ statements it can be cleaner to use a [[type:map]] as a lookup table.
+So, instead of:
+> if style == "horizontal" then lots of code
+> else if style == "vertical" then lots of code
+> # etc.
+use:
+> blends := [
+> horizontal: { lots of code }
+> vertical: { lots of code }
+> ]
+> ...
+> blends(style)() # lookup and call the function
diff --git a/doc/script/control_structures.txt b/doc/script/control_structures.txt
index fbca32c0..aba3aae3 100644
--- a/doc/script/control_structures.txt
+++ b/doc/script/control_structures.txt
@@ -1,87 +1,87 @@
-Control structures
-
-MSE Script has two types of control structures.
-
---Conditional statement (@if then else@)--
-
-To switch between two options use:
-
-> if condition then a else b
-
-If the condition evaluates to @true@,
-then the expression evaluates to @a@, otherwise it evaluates to @b@.
-The else part is optional.
-
-For example:
-> if 1 + 1 == 2 then "yes sir!" else "something is wrong"
-Will evaluate to @"yes sir!"@.
-
-Note that if-then-else is an ''expression'', it can be used almost everywhere:
-> 1 + (if card.color == "red" then 1 else 2)
-> color := (if card.color == "red" then "r") +
-> (if card.color == "green" then "g")
-
-Multiple conditions can be checked by using @else if@:
-> if card.color == "white" then "W"
-> else if card.color == "red" then "R"
-> else if card.color == "blue" then "U"
-> else "something else"
-
-The @then@ and @else@ parts can also contain assignments and other control structures.
-> if card.color == "red" then
-> filter := filter + "r"
-
-To use multiple statements in the then or else branches you must use parentheses:
-> # WRONG
-> if 1 + 1 == 2 then
-> x := y
-> y := z
-> # RIGHT
-> if 1 + 1 == 2 then (
-> x := y
-> y := z
-> )
-
---Loop statement (@for each@)--
-
-To iterate over all elements in a [[type:list]] the @for each@ construct can be used
-
-> for each variable in list do expression
-
-If list is a list of items, for example set.cards, the expression is evaluated for each item in that list.
-The variable becomes set to that each item in succession.
-The results of the expression are combined using the @+@ [[script:operators|operator]]:
-
-> for each x in ["a","b","c"] do x == "abc"
-> for each x in ["a","b","c"] do [x+x] == ["aa","bb","cc"]
-
-
-When iterating over a [[type:map]] the key is also available:
-
->> for each key:variable in list do expression
-
-For example:
-
-> (for each k:v in [name:"Thing", rank:"High"] do
-> "Its {k} is {v}. "
-> ) == "Its name is Thing. Its rank is High. "
-
-When iterating over a list, the key is the index in the list, starting with @0@:
-> (for each k:v in ["a","b","c"] do
-> ["element {k} is {v}"]
-> ) == ["element 0 is a","element 1 is b","element 2 is c"]
-
-
-It is also possible to iterate over a range of values:
-
-> for variable from begin to end do expression
-
-The expression is evaluated for each number from begin to end (including begin, not including end). The variable becomes set to that each number in succession. Again, the results of the expression are combined using +.
-
---Summary--
-
-! Syntax Description
-| @if a then b else c@ If @a@ is @true@ evaluates to @b@, otherwise evaluates to @c@.
-| @for each x in list do something@ Does @something@ for each element in a list, adding the results
-| @for each k:v in list do something@ Does @something@ for each element in a map using the key/index in the map.
-| @for x from 1 to 100 do something@ Does @something@ for all numbers from 1 to 100.
+Control structures
+
+MSE Script has two types of control structures.
+
+--Conditional statement (@if then else@)--
+
+To switch between two options use:
+
+> if condition then a else b
+
+If the condition evaluates to @true@,
+then the expression evaluates to @a@, otherwise it evaluates to @b@.
+The else part is optional.
+
+For example:
+> if 1 + 1 == 2 then "yes sir!" else "something is wrong"
+Will evaluate to @"yes sir!"@.
+
+Note that if-then-else is an ''expression'', it can be used almost everywhere:
+> 1 + (if card.color == "red" then 1 else 2)
+> color := (if card.color == "red" then "r") +
+> (if card.color == "green" then "g")
+
+Multiple conditions can be checked by using @else if@:
+> if card.color == "white" then "W"
+> else if card.color == "red" then "R"
+> else if card.color == "blue" then "U"
+> else "something else"
+
+The @then@ and @else@ parts can also contain assignments and other control structures.
+> if card.color == "red" then
+> filter := filter + "r"
+
+To use multiple statements in the then or else branches you must use parentheses:
+> # WRONG
+> if 1 + 1 == 2 then
+> x := y
+> y := z
+> # RIGHT
+> if 1 + 1 == 2 then (
+> x := y
+> y := z
+> )
+
+--Loop statement (@for each@)--
+
+To iterate over all elements in a [[type:list]] the @for each@ construct can be used
+
+> for each variable in list do expression
+
+If list is a list of items, for example set.cards, the expression is evaluated for each item in that list.
+The variable becomes set to that each item in succession.
+The results of the expression are combined using the @+@ [[script:operators|operator]]:
+
+> for each x in ["a","b","c"] do x == "abc"
+> for each x in ["a","b","c"] do [x+x] == ["aa","bb","cc"]
+
+
+When iterating over a [[type:map]] the key is also available:
+
+>> for each key:variable in list do expression
+
+For example:
+
+> (for each k:v in [name:"Thing", rank:"High"] do
+> "Its {k} is {v}. "
+> ) == "Its name is Thing. Its rank is High. "
+
+When iterating over a list, the key is the index in the list, starting with @0@:
+> (for each k:v in ["a","b","c"] do
+> ["element {k} is {v}"]
+> ) == ["element 0 is a","element 1 is b","element 2 is c"]
+
+
+It is also possible to iterate over a range of values:
+
+> for variable from begin to end do expression
+
+The expression is evaluated for each number from begin to end (including begin, not including end). The variable becomes set to that each number in succession. Again, the results of the expression are combined using +.
+
+--Summary--
+
+! Syntax Description
+| @if a then b else c@ If @a@ is @true@ evaluates to @b@, otherwise evaluates to @c@.
+| @for each x in list do something@ Does @something@ for each element in a list, adding the results
+| @for each k:v in list do something@ Does @something@ for each element in a map using the key/index in the map.
+| @for x from 1 to 100 do something@ Does @something@ for all numbers from 1 to 100.
diff --git a/doc/script/default_arguments.txt b/doc/script/default_arguments.txt
index 3e64715e..3f039bc9 100644
--- a/doc/script/default_arguments.txt
+++ b/doc/script/default_arguments.txt
@@ -1,41 +1,41 @@
-Default arguments
-
-DOC_MSE_VERSION: since 0.3.7
-
-It is possible to declare default arguments for functions using the @@@@ operator.
-> function := { "argument was: " + arg }@(arg:"default")
-If this function is called without the @arg@ argument, then the default value @"default"@ is used instead.
-For example:
-> function() == "argument was: default"
-> function(arg: "something else") == "argument was: something else"
-
-For determining whether the argument is set only explicit arguments count, not everything in scope, so
-> arg := "something else"
-> function() == "argument was: default"
-
-Defaults are evaluated at the time the @@@@ operator is evaluated, they will not be overriden later
-> default := "old default"
-> function := { "argument was: " + arg }@(arg: default)
-> default := "new default"
-> function() == "argument was: old default"
-
---Rule functions--
-
-DOC_MSE_VERSION: until 0.3.6
-
-In earlier versions of MSE some functions were available in a special ''rule form''.
-A call to for example @replace_rule(match:"abc",replace:"xyz")@ is equivalent to @replace@@(match:"abc",replace:"xyz")@ .
-For backwards compatability these functions are still available, but they should not be used for new templates.
-
-Programming in a ''rule style'' is still very useful.
-A rule is like a normal function with all parameters given, except for the @input@.
-These rules can then be combined using the @+@ operator, for example:
-> # First all "a"s are replaced, then all "b"s.
-> remove_as_and_bs := replace@(match: "a", replace: "") +
-> replace@(match: "b", replace: "")
->
-> text_with_as_and_bs := "bla bla bla"
-> text_without_as_and_bs := remove_as_and_bs(text_with_as_and_bs)
-
-
-
+Default arguments
+
+DOC_MSE_VERSION: since 0.3.7
+
+It is possible to declare default arguments for functions using the @@@@ operator.
+> function := { "argument was: " + arg }@(arg:"default")
+If this function is called without the @arg@ argument, then the default value @"default"@ is used instead.
+For example:
+> function() == "argument was: default"
+> function(arg: "something else") == "argument was: something else"
+
+For determining whether the argument is set only explicit arguments count, not everything in scope, so
+> arg := "something else"
+> function() == "argument was: default"
+
+Defaults are evaluated at the time the @@@@ operator is evaluated, they will not be overriden later
+> default := "old default"
+> function := { "argument was: " + arg }@(arg: default)
+> default := "new default"
+> function() == "argument was: old default"
+
+--Rule functions--
+
+DOC_MSE_VERSION: until 0.3.6
+
+In earlier versions of MSE some functions were available in a special ''rule form''.
+A call to for example @replace_rule(match:"abc",replace:"xyz")@ is equivalent to @replace@@(match:"abc",replace:"xyz")@ .
+For backwards compatability these functions are still available, but they should not be used for new templates.
+
+Programming in a ''rule style'' is still very useful.
+A rule is like a normal function with all parameters given, except for the @input@.
+These rules can then be combined using the @+@ operator, for example:
+> # First all "a"s are replaced, then all "b"s.
+> remove_as_and_bs := replace@(match: "a", replace: "") +
+> replace@(match: "b", replace: "")
+>
+> text_with_as_and_bs := "bla bla bla"
+> text_without_as_and_bs := remove_as_and_bs(text_with_as_and_bs)
+
+
+
diff --git a/doc/script/functions.txt b/doc/script/functions.txt
index 834fb513..d5ed46d6 100644
--- a/doc/script/functions.txt
+++ b/doc/script/functions.txt
@@ -1,32 +1,32 @@
-Functions
-
-It is possible to define your own functions in MSE script.
-The syntax for this is very simple, code in curly braces defines a function:
-> { code goes here }
-
-To be able to refer to the function it is usually assigned to a variable:
-> function := { code goes here }
-
-Calling a function is done using parentheses:
-> { code }()
-> function()
-this has the effect of evaluating the code inside the curly braces.
-
---Parameters--
-
-When calling a function, parameters can be specified inside the parentheses of the function call:
-> fun := { "xyz is {xyz}" }
-> fun(xyz: "a parameter") == "xyz is a parameter"
-These assignments are ''only'' visible to the called function.
-> xyz := "outside"
-> fun(xyz: "a parameter")
-> # xyz is still "outside"
-
-The syntax for parameters is @name: value@.
-Multiple parameters are separated by commas.
-
-The special syntax @value@ (without a name) means that the variable @input@ is used:
-> fun := { input + var2 }
-> fun(var2: "yes", "no") == "noyes"
-
-
+Functions
+
+It is possible to define your own functions in MSE script.
+The syntax for this is very simple, code in curly braces defines a function:
+> { code goes here }
+
+To be able to refer to the function it is usually assigned to a variable:
+> function := { code goes here }
+
+Calling a function is done using parentheses:
+> { code }()
+> function()
+this has the effect of evaluating the code inside the curly braces.
+
+--Parameters--
+
+When calling a function, parameters can be specified inside the parentheses of the function call:
+> fun := { "xyz is {xyz}" }
+> fun(xyz: "a parameter") == "xyz is a parameter"
+These assignments are ''only'' visible to the called function.
+> xyz := "outside"
+> fun(xyz: "a parameter")
+> # xyz is still "outside"
+
+The syntax for parameters is @name: value@.
+Multiple parameters are separated by commas.
+
+The special syntax @value@ (without a name) means that the variable @input@ is used:
+> fun := { input + var2 }
+> fun(var2: "yes", "no") == "noyes"
+
+
diff --git a/doc/script/index.txt b/doc/script/index.txt
index e36e22a8..513cd887 100644
--- a/doc/script/index.txt
+++ b/doc/script/index.txt
@@ -1,56 +1,56 @@
-Scripting language
-
-MSE uses a custom scripting language to add complicated behaviour to [[type:field]]s and [[type:style]]s.
-
---Topics--
-* [[script:introduction|Introduction to scripting]]
-* [[script:Operators]]
-* [[script:Variables]]
-* [[script:Functions]]
-* [[script:Default arguments]]
-* [[script:Control structures]]
-* [[script:Predefined variables]]
-* [[script:Best practices]]
-See also:
-* [[type:index|Data types used]]
-* [[fun:index|Built in functions]]
-
---Syntax index--
-| @#comment@ Comments ignored by the parser
-| @123@ [[type:int|A literal number]]
-| @"stuff"@ [[type:string|A literal string]]
-| @[a,b,c]@ [[type:list|A literal list]]
-| @[a:b, c:d]@ [[type:map|A literal map]]
-| @{ expr }@ [[script:functions|Function definition]]
-| @fun(a:b, c:d)@ [[script:functions|Function call]]
-| @fun(value)@ [[script:functions|Function call with '@input@' argument]]
-| @fun@@(a:b)@ [[script:default_arguments|Default arguments]]
-| @a.b@ [[script:operators|Property 'b' of 'a']]
-| @a[b]@ [[script:operators|Property 'value of b' of 'a']]
-| @-a@ [[script:operators|Negation]]
-| @a + b@ [[script:operators|Addition / concatenation]]
-| @a - b@ [[script:operators|Subtraction]]
-| @a * b@ [[script:operators|Multiplication]]
-| @a / b@ [[script:operators|Floating point division]]
-| @a div b@ [[script:operators|Integer division]]
-| @a mod b@ [[script:operators|Remainder]]
-| @a ^ b@ [[script:operators|Exponentiation]]
-| @not a@ [[type:boolean|Boolean not]]
-| @a and b@ [[type:boolean|Boolean conjunction]]
-| @a or b@ [[type:boolean|Boolean disjunction]]
-| @a xor b@ [[type:boolean|Boolean xor]]
-| @a == b@ [[script:operators|Comparison for equality]]
-| @a != b@ [[script:operators|Comparison for inequality]]
-| @a < b@ [[script:operators|Comparison]]
-| @a > b@ [[script:operators|Comparison]]
-| @a <= b@ [[script:operators|Comparison]]
-| @a >= b@ [[script:operators|Comparison]]
-| @a or else b@ Use @a@ unless it is an error, then use @b@ instead.
-| @min(a,b,c,...)@ [[script:operators|Smallest of the values]]
-| @max(a,b,c,...)@ [[script:operators|Largest of the values]]
-| @rgb(r,g,b)@ [[type:color|A color value]]
-| @rgba(r,g,b)@ [[type:color|A color value with transparency]]
-| @if x then y@ [[script:control structures|Conditional expresion]]
-| @if x then y else z@ [[script:control structures|Conditional expresion]]
-| @for x in list do y@ [[script:control structures|Loop over elements in a list]]
-| @for x from a to b do y@ [[script:control structures|Loop over numbers from a to b]]
+Scripting language
+
+MSE uses a custom scripting language to add complicated behaviour to [[type:field]]s and [[type:style]]s.
+
+--Topics--
+* [[script:introduction|Introduction to scripting]]
+* [[script:Operators]]
+* [[script:Variables]]
+* [[script:Functions]]
+* [[script:Default arguments]]
+* [[script:Control structures]]
+* [[script:Predefined variables]]
+* [[script:Best practices]]
+See also:
+* [[type:index|Data types used]]
+* [[fun:index|Built in functions]]
+
+--Syntax index--
+| @#comment@ Comments ignored by the parser
+| @123@ [[type:int|A literal number]]
+| @"stuff"@ [[type:string|A literal string]]
+| @[a,b,c]@ [[type:list|A literal list]]
+| @[a:b, c:d]@ [[type:map|A literal map]]
+| @{ expr }@ [[script:functions|Function definition]]
+| @fun(a:b, c:d)@ [[script:functions|Function call]]
+| @fun(value)@ [[script:functions|Function call with '@input@' argument]]
+| @fun@@(a:b)@ [[script:default_arguments|Default arguments]]
+| @a.b@ [[script:operators|Property 'b' of 'a']]
+| @a[b]@ [[script:operators|Property 'value of b' of 'a']]
+| @-a@ [[script:operators|Negation]]
+| @a + b@ [[script:operators|Addition / concatenation]]
+| @a - b@ [[script:operators|Subtraction]]
+| @a * b@ [[script:operators|Multiplication]]
+| @a / b@ [[script:operators|Floating point division]]
+| @a div b@ [[script:operators|Integer division]]
+| @a mod b@ [[script:operators|Remainder]]
+| @a ^ b@ [[script:operators|Exponentiation]]
+| @not a@ [[type:boolean|Boolean not]]
+| @a and b@ [[type:boolean|Boolean conjunction]]
+| @a or b@ [[type:boolean|Boolean disjunction]]
+| @a xor b@ [[type:boolean|Boolean xor]]
+| @a == b@ [[script:operators|Comparison for equality]]
+| @a != b@ [[script:operators|Comparison for inequality]]
+| @a < b@ [[script:operators|Comparison]]
+| @a > b@ [[script:operators|Comparison]]
+| @a <= b@ [[script:operators|Comparison]]
+| @a >= b@ [[script:operators|Comparison]]
+| @a or else b@ Use @a@ unless it is an error, then use @b@ instead.
+| @min(a,b,c,...)@ [[script:operators|Smallest of the values]]
+| @max(a,b,c,...)@ [[script:operators|Largest of the values]]
+| @rgb(r,g,b)@ [[type:color|A color value]]
+| @rgba(r,g,b)@ [[type:color|A color value with transparency]]
+| @if x then y@ [[script:control structures|Conditional expresion]]
+| @if x then y else z@ [[script:control structures|Conditional expresion]]
+| @for x in list do y@ [[script:control structures|Loop over elements in a list]]
+| @for x from a to b do y@ [[script:control structures|Loop over numbers from a to b]]
diff --git a/doc/script/introduction.txt b/doc/script/introduction.txt
index 4ec20585..40d7e0f3 100644
--- a/doc/script/introduction.txt
+++ b/doc/script/introduction.txt
@@ -1,34 +1,34 @@
-Scripting introduction
-
-MSE uses a custom scripting language to add complicated behaviour to [[type:field]]s and [[type:style]]s.
-
-This documentation assumes that the reader has some programming experience.
-In particular it is assumed that you know what 'functions', 'variables' and 'operators' are.
-
-Scripts in MSE are usually small, just a few lines.
-A piece of script code is also called an ''expression''.
-Expressions can be ''evaluated'' to give a result.
-For example the expression @1 + 1@ will evaluate to @2@.
-
-An important idea behind MSE is that it tries to be ''pure'',
-there are no global variables and there is no way to change properties of objects.
-This means that when you evaluate an expression the result is always the same (unless it contains variable assignments).
-
-Basic elements of scripts are ''constants''.
-A constant is something with a fixed value.
-Possible constants are:
-! Syntax Type
-| @nil@ Nothing
-| @true@, @false@ [[type:boolean]]
-| @123@ [[type:int]]
-| @123.5@ [[type:double]]
-| @"abc"@ [[type:string]]
-| @rgb(255,0,0)@ [[type:color]]
-| @rgba(0,0,0,0)@ [[type:color]]
-| @[a,b,c]@ [[type:list]]
-Note: Strings, list and colors don't have to be constants, they can contain other code.
-
-The @nil@ value has a special meaning, it is 'nothing'.
-Adding @nil@ to something has no effect (it returns 'something'), calling @nil@ as a function just returns the input, etc.
-
-
+Scripting introduction
+
+MSE uses a custom scripting language to add complicated behaviour to [[type:field]]s and [[type:style]]s.
+
+This documentation assumes that the reader has some programming experience.
+In particular it is assumed that you know what 'functions', 'variables' and 'operators' are.
+
+Scripts in MSE are usually small, just a few lines.
+A piece of script code is also called an ''expression''.
+Expressions can be ''evaluated'' to give a result.
+For example the expression @1 + 1@ will evaluate to @2@.
+
+An important idea behind MSE is that it tries to be ''pure'',
+there are no global variables and there is no way to change properties of objects.
+This means that when you evaluate an expression the result is always the same (unless it contains variable assignments).
+
+Basic elements of scripts are ''constants''.
+A constant is something with a fixed value.
+Possible constants are:
+! Syntax Type
+| @nil@ Nothing
+| @true@, @false@ [[type:boolean]]
+| @123@ [[type:int]]
+| @123.5@ [[type:double]]
+| @"abc"@ [[type:string]]
+| @rgb(255,0,0)@ [[type:color]]
+| @rgba(0,0,0,0)@ [[type:color]]
+| @[a,b,c]@ [[type:list]]
+Note: Strings, list and colors don't have to be constants, they can contain other code.
+
+The @nil@ value has a special meaning, it is 'nothing'.
+Adding @nil@ to something has no effect (it returns 'something'), calling @nil@ as a function just returns the input, etc.
+
+
diff --git a/doc/script/operators.txt b/doc/script/operators.txt
index 7c121717..9fe5ed65 100644
--- a/doc/script/operators.txt
+++ b/doc/script/operators.txt
@@ -1,114 +1,114 @@
-Operators
-
-To get more complicated expressions you combine them using operators.
-
---Basic mathematics--
-MSE script supports most basic mathamatical operators:
-! Operator Example Description
-| @a + b@ @3 + 2 == 5@
Add two numbers,
- @"3" + "2" == "32"@ concatenate two strings or compose two functions (see below)
-| @a - b@ @3 - 2 == 1@ Substract two numbers
-| @a * b@ @3 * 2 == 6@ Multiply two numbers
-| @a / b@ @3 / 2 == 1.5@ Divide two numbers. Does not round, always produces a [[type:double]].
-| @a div b@ @3 div 2 == 1@ DOC_MSE_VERSION: since 0.3.7
- Divide two numbers. Rounds towards zero, producing an [[type:int]].
-| @a mod b@ @3 mod 2 == 1@ Take the remainder after integer division (modulo)
-| @a ^ b@ @3 ^ 2 == 9@ DOC_MSE_VERSION: since 0.3.7
- Exponentation, raise a to the power b.
The numbers can be [[type:double]]s, so to calculate a square root use @2^0.5 == 1.41421356237@.
-| @-a@ @-(3 + 2) == -5@ Negate a number (make it negative if positive and vice versa)
-
-===The + operator===
-The @+@ operator has four functions
-* It adds [[type:int]]s (also [[type:double]]s), @1+1 == 2@
-* It concatenates strings, @"1" + "1" == "11"@
-* It concatenates lists, @[1] + [1] == [1,1]@
-* It composes [[type:function]]s @(f + g) () == g( input: f() )@
-
---Comparison--
-It is also possible to compare values. All comparisons evaluate to either @true@ or @false@.
-! Operator Example Description
-| @a == b@ @1 + 1 == 2@
- @"x" == "x"@
- @1 + 1 == "2"@ Are two numbers or strings the same? @=@ can also be used instead.
-| @a != b@ @1 + 1 != 3@
- @"x" != "y"@ Are two numbers or strings different?
-| @a < b@ @1 < 2@
- @"x" < "y"@ Is a less than b? Uses [[http://en.wikipedia.org/wiki/Lexicographical_order|lexicographic order]] for strings.
-| @a > b@ @2 > 1@
- @"y" > "x"@ Is a greater than b?
-| @a <= b@ @1 <= 1@
- @"x" <= "y"@ Is a less than b or are they equal?
-| @a >= b@ @2 >= 1@
- @"x" >= "x"@ Is a greater than b or are they equal?
-| @min(a,b)@ @min(1,2) == 1@ Returns the smallest of two or more values.
-| @max(a,b)@ @max(1,2) == 2@ Returns the largest of two or more values.
-
---Booleans--
-[[type:Boolean]]s (for example from comparisons) can be combined using:
-| @a and b@ Are both @a@ and @b@ true?
-| @a or b@ Is at least one of @a@ and @b@ true?
-| @a xor b@ Is exactly one of @a@ and @b@ true?
-| @not a@ Is @a@ false?
-In a table:
-! @a@ @b@ a or b a and b a xor b
-| @false@ @false@ @false@ @false@ @false@
-| @false@ @true@ @true@ @false@ @true@
-| @true@ @false@ @true@ @false@ @true@
-| @true@ @true@ @true@ @true@ @false@
-
-The @and@ and @or@ operators use [[http://en.wikipedia.org/wiki/Short-circuit_evaluation|short-circuit evaluation]], which means that the second argument is only evaluated if the first argument does not suffice to determine the value of the expression.
-For example
-> true or card.field_that_does_not_exist
-evaluates to @true@ instead of giving an error.
-
---Grouping and order--
-
-Operators are ordered as usual, so
-> 1 + 2 * 3 == 1 + (2 * 3) == 7
-Operators can be grouped differently using parentheses.
-> (1 + 2) * 3 == 3 * 3 == 9
-
-The exact order of precedence is given in the following table,
-higher in the table means that this operator binds tighter to its arguments, @*@ binds tighter then @+@.
-| @a(...)@, @a.b@, @a[b]@ Function calls, property access, see below
-| @-a@, @not@ Unary operators
-| @^@ Exponentiation
-| @*@, @/@, @div@, @mod@ Multiplication and division
-| @+@, @-@ Addition and substraction
-| @==@, @!=@, @<@, @>@, @<=@, @>=@ Comparisons
-| @and@, @or@, @xor@ Boolean operators
-| @:=@ Assignement, see below
-| @;@ Sequence, see below
-
---Properties--
-Properties of types, as described in the [[type:index|data type section]] of the documentation, can be accessed using the @.@ operator:
-> set.cards # retrieve the 'cards' property of a set
-The @[]@ operator has a similair purpose, only the property retrieved is determined by a string, so it can be changed:
-> set["cards"] # same as above
-> c := "cards"
-> set[c] # again, the same
-
-Multiple uses of these operators can be combined, for example:
-> set.cards[0].card_color # the card color of the first card in the set
-
-Note that a property named @card color@ is refered to as @card_color@ when using the @.@ operator, all spaces become underscores.
-> style.padding left # syntax error
-> style.padding_left # use this instead
-
---Assignment and sequence--
-Values can be assigned to [[script:variables]] using the @:=@ operator:
-> variable := 1 + 1
-The result of this expression is the value assigned, this can be used to assign to multiple variables:
-> var1 := var2 := 1 + 1
-> # now var1 == 2 and var2 == 2
-
-To combine multiple assignments into a single expression the ''sequencing operator'', @;@ can be used.
-This first executes an expression, discards the result and then evaluates another one:
-> var1 := 1 + 1 # assign
-> ; # discard the result (i.e. 2)
-> var1 * 2 # retrieve the value again, returns 4
-Semicolons at the end of a line can be omitted, so the above can also be written simply as:
-> var1 := 1 + 1
-> var1 * 2
-
-
+Operators
+
+To get more complicated expressions you combine them using operators.
+
+--Basic mathematics--
+MSE script supports most basic mathamatical operators:
+! Operator Example Description
+| @a + b@ @3 + 2 == 5@
Add two numbers,
+ @"3" + "2" == "32"@ concatenate two strings or compose two functions (see below)
+| @a - b@ @3 - 2 == 1@ Substract two numbers
+| @a * b@ @3 * 2 == 6@ Multiply two numbers
+| @a / b@ @3 / 2 == 1.5@ Divide two numbers. Does not round, always produces a [[type:double]].
+| @a div b@ @3 div 2 == 1@ DOC_MSE_VERSION: since 0.3.7
+ Divide two numbers. Rounds towards zero, producing an [[type:int]].
+| @a mod b@ @3 mod 2 == 1@ Take the remainder after integer division (modulo)
+| @a ^ b@ @3 ^ 2 == 9@ DOC_MSE_VERSION: since 0.3.7
+ Exponentation, raise a to the power b.
The numbers can be [[type:double]]s, so to calculate a square root use @2^0.5 == 1.41421356237@.
+| @-a@ @-(3 + 2) == -5@ Negate a number (make it negative if positive and vice versa)
+
+===The + operator===
+The @+@ operator has four functions
+* It adds [[type:int]]s (also [[type:double]]s), @1+1 == 2@
+* It concatenates strings, @"1" + "1" == "11"@
+* It concatenates lists, @[1] + [1] == [1,1]@
+* It composes [[type:function]]s @(f + g) () == g( input: f() )@
+
+--Comparison--
+It is also possible to compare values. All comparisons evaluate to either @true@ or @false@.
+! Operator Example Description
+| @a == b@ @1 + 1 == 2@
+ @"x" == "x"@
+ @1 + 1 == "2"@ Are two numbers or strings the same? @=@ can also be used instead.
+| @a != b@ @1 + 1 != 3@
+ @"x" != "y"@ Are two numbers or strings different?
+| @a < b@ @1 < 2@
+ @"x" < "y"@ Is a less than b? Uses [[http://en.wikipedia.org/wiki/Lexicographical_order|lexicographic order]] for strings.
+| @a > b@ @2 > 1@
+ @"y" > "x"@ Is a greater than b?
+| @a <= b@ @1 <= 1@
+ @"x" <= "y"@ Is a less than b or are they equal?
+| @a >= b@ @2 >= 1@
+ @"x" >= "x"@ Is a greater than b or are they equal?
+| @min(a,b)@ @min(1,2) == 1@ Returns the smallest of two or more values.
+| @max(a,b)@ @max(1,2) == 2@ Returns the largest of two or more values.
+
+--Booleans--
+[[type:Boolean]]s (for example from comparisons) can be combined using:
+| @a and b@ Are both @a@ and @b@ true?
+| @a or b@ Is at least one of @a@ and @b@ true?
+| @a xor b@ Is exactly one of @a@ and @b@ true?
+| @not a@ Is @a@ false?
+In a table:
+! @a@ @b@ a or b a and b a xor b
+| @false@ @false@ @false@ @false@ @false@
+| @false@ @true@ @true@ @false@ @true@
+| @true@ @false@ @true@ @false@ @true@
+| @true@ @true@ @true@ @true@ @false@
+
+The @and@ and @or@ operators use [[http://en.wikipedia.org/wiki/Short-circuit_evaluation|short-circuit evaluation]], which means that the second argument is only evaluated if the first argument does not suffice to determine the value of the expression.
+For example
+> true or card.field_that_does_not_exist
+evaluates to @true@ instead of giving an error.
+
+--Grouping and order--
+
+Operators are ordered as usual, so
+> 1 + 2 * 3 == 1 + (2 * 3) == 7
+Operators can be grouped differently using parentheses.
+> (1 + 2) * 3 == 3 * 3 == 9
+
+The exact order of precedence is given in the following table,
+higher in the table means that this operator binds tighter to its arguments, @*@ binds tighter then @+@.
+| @a(...)@, @a.b@, @a[b]@ Function calls, property access, see below
+| @-a@, @not@ Unary operators
+| @^@ Exponentiation
+| @*@, @/@, @div@, @mod@ Multiplication and division
+| @+@, @-@ Addition and substraction
+| @==@, @!=@, @<@, @>@, @<=@, @>=@ Comparisons
+| @and@, @or@, @xor@ Boolean operators
+| @:=@ Assignement, see below
+| @;@ Sequence, see below
+
+--Properties--
+Properties of types, as described in the [[type:index|data type section]] of the documentation, can be accessed using the @.@ operator:
+> set.cards # retrieve the 'cards' property of a set
+The @[]@ operator has a similair purpose, only the property retrieved is determined by a string, so it can be changed:
+> set["cards"] # same as above
+> c := "cards"
+> set[c] # again, the same
+
+Multiple uses of these operators can be combined, for example:
+> set.cards[0].card_color # the card color of the first card in the set
+
+Note that a property named @card color@ is refered to as @card_color@ when using the @.@ operator, all spaces become underscores.
+> style.padding left # syntax error
+> style.padding_left # use this instead
+
+--Assignment and sequence--
+Values can be assigned to [[script:variables]] using the @:=@ operator:
+> variable := 1 + 1
+The result of this expression is the value assigned, this can be used to assign to multiple variables:
+> var1 := var2 := 1 + 1
+> # now var1 == 2 and var2 == 2
+
+To combine multiple assignments into a single expression the ''sequencing operator'', @;@ can be used.
+This first executes an expression, discards the result and then evaluates another one:
+> var1 := 1 + 1 # assign
+> ; # discard the result (i.e. 2)
+> var1 * 2 # retrieve the value again, returns 4
+Semicolons at the end of a line can be omitted, so the above can also be written simply as:
+> var1 := 1 + 1
+> var1 * 2
+
+
diff --git a/doc/script/predefined_variables.txt b/doc/script/predefined_variables.txt
index 3134a656..af3c545a 100644
--- a/doc/script/predefined_variables.txt
+++ b/doc/script/predefined_variables.txt
@@ -1,16 +1,16 @@
-Predefined variables
-
-When evaluating scripts several variables are predefined containing useful information.
-Aside from the [[fun:index|built in functions]] the following variables are provided:
-! Variable Type When available? Description
-| @game@ [[type:game]] always The current game, the same as @set.game@
-| @set@ [[type:set]] always The current set.
-| @stylesheet@ [[type:stylesheet]] not in the @init script@ of the game
- The current stylesheet
-| @card@ [[type:card]] not in @init script@s or when exporting
- The current card.
-| @card_style@ [[type:indexmap]] of [[type:style]]s where @card@ is available Style properties for the current card, the same as @stylesheet.card_style@.
-| @styling@ [[type:indexmap]] of [[type:value]]s where @card@ is available Styling options for the stylesheet/card.
-| @value@ [[type:value]] when evaluating a [[type:field]]'s @script@ or @default@ script Current value in the field.
-| @options@ [[type:indexmap]] of [[type:value]]s when exporting Options of the [[type:export template]].
-Variables are only available where they make sense.
+Predefined variables
+
+When evaluating scripts several variables are predefined containing useful information.
+Aside from the [[fun:index|built in functions]] the following variables are provided:
+! Variable Type When available? Description
+| @game@ [[type:game]] always The current game, the same as @set.game@
+| @set@ [[type:set]] always The current set.
+| @stylesheet@ [[type:stylesheet]] not in the @init script@ of the game
+ The current stylesheet
+| @card@ [[type:card]] not in @init script@s or when exporting
+ The current card.
+| @card_style@ [[type:indexmap]] of [[type:style]]s where @card@ is available Style properties for the current card, the same as @stylesheet.card_style@.
+| @styling@ [[type:indexmap]] of [[type:value]]s where @card@ is available Styling options for the stylesheet/card.
+| @value@ [[type:value]] when evaluating a [[type:field]]'s @script@ or @default@ script Current value in the field.
+| @options@ [[type:indexmap]] of [[type:value]]s when exporting Options of the [[type:export template]].
+Variables are only available where they make sense.
diff --git a/doc/script/variables.txt b/doc/script/variables.txt
index 343e99fd..cd4e816c 100644
--- a/doc/script/variables.txt
+++ b/doc/script/variables.txt
@@ -1,49 +1,49 @@
-Variables
-
-MSE script has the notion of ''variables''.
-A variable is a name holding a value, assigned using the @:=@ operator:
-> variable := 1 + 1
-From now on (until another value is assigned) @variable@ evaluates to @2@ in the rest of the script.
-
---Scope--
-
-Assignments to variables are ''local'' to the current function.
-Consider:
-> function := {
-> x := "something else"
-> # here x is something else
-> }
-> x := 1
-> function()
-> # here x is still 1
-
-Unlike most programming languages MSE script uses [[http://en.wikipedia.org/wiki/Dynamic_scoping#Dynamic_scoping|dynamic scoping]].
-This means that assignments done in the calling function are visible in the called function:
-> fun := { "xyz is {xyz}" }
-> one := {
-> xyz := 1
-> fun()
-> }
-> two := {
-> xyz := "two"
-> fun()
-> }
-> one() == "xyz is 1"
-> two() == "xyz is two"
-
-This can be very useful for variables like @card@, which are used by many functions.
-
---Overriding functions--
-Like custom functions, the [[fun:index|built in functions]] are also stored in variables.
-It is possible to overwrite them:
-> to_upper := { input }
-> to_upper("xyz") == "xyz" # Not what it used to do
-
-A neat trick is adding 'extra' behaviour to functions.
-This can be done by first making a copy, and calling that:
-> real_to_upper := to_upper
-> to_upper := { "upper case: " + real_to_upper() }
-> to_upper("xyz") == "upper case: XYZ"
-Note that @real_to_upper@ is called without extra parameters, the @input@ variable is still set from the outer call to the new @to_upper@ itself.
-
-
+Variables
+
+MSE script has the notion of ''variables''.
+A variable is a name holding a value, assigned using the @:=@ operator:
+> variable := 1 + 1
+From now on (until another value is assigned) @variable@ evaluates to @2@ in the rest of the script.
+
+--Scope--
+
+Assignments to variables are ''local'' to the current function.
+Consider:
+> function := {
+> x := "something else"
+> # here x is something else
+> }
+> x := 1
+> function()
+> # here x is still 1
+
+Unlike most programming languages MSE script uses [[http://en.wikipedia.org/wiki/Dynamic_scoping#Dynamic_scoping|dynamic scoping]].
+This means that assignments done in the calling function are visible in the called function:
+> fun := { "xyz is {xyz}" }
+> one := {
+> xyz := 1
+> fun()
+> }
+> two := {
+> xyz := "two"
+> fun()
+> }
+> one() == "xyz is 1"
+> two() == "xyz is two"
+
+This can be very useful for variables like @card@, which are used by many functions.
+
+--Overriding functions--
+Like custom functions, the [[fun:index|built in functions]] are also stored in variables.
+It is possible to overwrite them:
+> to_upper := { input }
+> to_upper("xyz") == "xyz" # Not what it used to do
+
+A neat trick is adding 'extra' behaviour to functions.
+This can be done by first making a copy, and calling that:
+> real_to_upper := to_upper
+> to_upper := { "upper case: " + real_to_upper() }
+> to_upper("xyz") == "upper case: XYZ"
+Note that @real_to_upper@ is called without extra parameters, the @input@ variable is still set from the outer call to the new @to_upper@ itself.
+
+
diff --git a/doc/tutorial/index.txt b/doc/tutorial/index.txt
index 179fd993..2311f303 100644
--- a/doc/tutorial/index.txt
+++ b/doc/tutorial/index.txt
@@ -1,4 +1,4 @@
-Templating tutorial
-
-This space is reserved for a tutorial on making new templates for MSE.
-An announcement will be posted in the forum when the tutorial becomes available.
+Templating tutorial
+
+This space is reserved for a tutorial on making new templates for MSE.
+An announcement will be posted in the forum when the tutorial becomes available.
diff --git a/doc/type/add_cards_script.txt b/doc/type/add_cards_script.txt
index 93aaad1a..170f725c 100644
--- a/doc/type/add_cards_script.txt
+++ b/doc/type/add_cards_script.txt
@@ -1,31 +1,31 @@
-Data type: add cards script
-
-DOC_MSE_VERSION: since 0.3.7
-
---Overview--
-
-A script to add multiple cards to the set at once.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] Name of this script; appears in the menu.
-| @description@ [[type:string]] @""@ Description of this script; appears in the status bar.
-| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this script enabled?
-| @script@ [[type:script]] Script that produces the cards.
- This script should return a [[type:list]] of [[type:card]]s.
- The [[fun:new_card]] function can be used to make new cards.
-
---Example--
->add cards script:
-> name: &Basic Lands
-> description: Adds 5 basic lands to the set.
-> script:
-> [ new_card([name: "Plains", super_type: "Basic Land", sub_type: "Plains"])
-> , new_card([name: "Island", super_type: "Basic Land", sub_type: "Island"])
-> , new_card([name: "Swamp", super_type: "Basic Land", sub_type: "Swamp"])
-> , new_card([name: "Mountain", super_type: "Basic Land", sub_type: "Mountain"])
-> , new_card([name: "Forest", super_type: "Basic Land", sub_type: "Forest"])
-> ]
-
-When invoked, this script will add the five basic lands to the set.
-
+Data type: add cards script
+
+DOC_MSE_VERSION: since 0.3.7
+
+--Overview--
+
+A script to add multiple cards to the set at once.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] Name of this script; appears in the menu.
+| @description@ [[type:string]] @""@ Description of this script; appears in the status bar.
+| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this script enabled?
+| @script@ [[type:script]] Script that produces the cards.
+ This script should return a [[type:list]] of [[type:card]]s.
+ The [[fun:new_card]] function can be used to make new cards.
+
+--Example--
+>add cards script:
+> name: &Basic Lands
+> description: Adds 5 basic lands to the set.
+> script:
+> [ new_card([name: "Plains", super_type: "Basic Land", sub_type: "Plains"])
+> , new_card([name: "Island", super_type: "Basic Land", sub_type: "Island"])
+> , new_card([name: "Swamp", super_type: "Basic Land", sub_type: "Swamp"])
+> , new_card([name: "Mountain", super_type: "Basic Land", sub_type: "Mountain"])
+> , new_card([name: "Forest", super_type: "Basic Land", sub_type: "Forest"])
+> ]
+
+When invoked, this script will add the five basic lands to the set.
+
diff --git a/doc/type/alignment.txt b/doc/type/alignment.txt
index 02a5a462..e4277892 100644
--- a/doc/type/alignment.txt
+++ b/doc/type/alignment.txt
@@ -1,37 +1,37 @@
-Enumeration: alignment
-
-DOC_MSE_VERSION: changed in 0.3.8
-
-Specifies how text and images are aligned in boxes.
-An alignment consists of:
-* horizontal alignment
-* vertical alignment
-* (optional) how to fill the text box
-* (optional) when to fill the text box
-
---Script syntax--
-In scripts, alignment is passed around as a string.
-
---Possible values--
-The value is a combination of one or more flags, separated by spaces.
-These flags can appear in any order.
-! Value Description
-| @left@ Horizontally, align at the left
-| @center@ Horizontally, align in the middle
-| @right@ Horizontally, align at the right
-| @top@ Vertically, align at the top
-| @middle@ Vertically, align in the middle
-| @bottom@ Vertically, align at the bottom
-| @justify@ Fill the box exactly, by moving words apart/together.
-| @justify-all@ Fill the box exactly, by moving individual characters apart/together.
-| @stretch@ Fill the box exactly, by stretching the text.
- For images: stretch them, but preserve the aspect ratio.
-| @if-overflow@ Only apply @justify@, @justify-all@ and @stretch@ when the box is overfull.
-| @force@ Also justify text at the end of a line in a multiline text field.
- Normally only lines ending in a soft line break are justified.
-
---Examples--
-> alignment: top left
-> alignment: middle center
-> alignment: top left force justify if-overflow
-> alignment: { "middle" + " " + "left" }
+Enumeration: alignment
+
+DOC_MSE_VERSION: changed in 0.3.8
+
+Specifies how text and images are aligned in boxes.
+An alignment consists of:
+* horizontal alignment
+* vertical alignment
+* (optional) how to fill the text box
+* (optional) when to fill the text box
+
+--Script syntax--
+In scripts, alignment is passed around as a string.
+
+--Possible values--
+The value is a combination of one or more flags, separated by spaces.
+These flags can appear in any order.
+! Value Description
+| @left@ Horizontally, align at the left
+| @center@ Horizontally, align in the middle
+| @right@ Horizontally, align at the right
+| @top@ Vertically, align at the top
+| @middle@ Vertically, align in the middle
+| @bottom@ Vertically, align at the bottom
+| @justify@ Fill the box exactly, by moving words apart/together.
+| @justify-all@ Fill the box exactly, by moving individual characters apart/together.
+| @stretch@ Fill the box exactly, by stretching the text.
+ For images: stretch them, but preserve the aspect ratio.
+| @if-overflow@ Only apply @justify@, @justify-all@ and @stretch@ when the box is overfull.
+| @force@ Also justify text at the end of a line in a multiline text field.
+ Normally only lines ending in a soft line break are justified.
+
+--Examples--
+> alignment: top left
+> alignment: middle center
+> alignment: top left force justify if-overflow
+> alignment: { "middle" + " " + "left" }
diff --git a/doc/type/boolean.txt b/doc/type/boolean.txt
index c3e2f849..21f7d0cc 100644
--- a/doc/type/boolean.txt
+++ b/doc/type/boolean.txt
@@ -1,26 +1,26 @@
-Primitive type: boolean
-
-A boolean is either @true@ or @false@.
-
-In a script, numbers are implicitly converted to booleans, a non-zero number is @true@, 0 is @false@.
-
-When converted to a number, @true@ becomes @1@ and @false@ becomes @0@.
-
-The strings @"yes"@ and @"no"@ can also be converted to booleans.
-
---File syntax--
-> boolean: true
-> boolean: false
-
---Script syntax--
-> true or false
-
-The operators @or@, @and@ and @xor@ combine two booleans:
-! @a@ @b@ a or b a and b a xor b
-| @false@ @false@ @false@ @false@ @false@
-| @false@ @true@ @true@ @false@ @true@
-| @true@ @false@ @true@ @false@ @true@
-| @true@ @true@ @true@ @true@ @false@
-
---See also--
-| [[fun:to_boolean]] Convert a value to a boolean
+Primitive type: boolean
+
+A boolean is either @true@ or @false@.
+
+In a script, numbers are implicitly converted to booleans, a non-zero number is @true@, 0 is @false@.
+
+When converted to a number, @true@ becomes @1@ and @false@ becomes @0@.
+
+The strings @"yes"@ and @"no"@ can also be converted to booleans.
+
+--File syntax--
+> boolean: true
+> boolean: false
+
+--Script syntax--
+> true or false
+
+The operators @or@, @and@ and @xor@ combine two booleans:
+! @a@ @b@ a or b a and b a xor b
+| @false@ @false@ @false@ @false@ @false@
+| @false@ @true@ @true@ @false@ @true@
+| @true@ @false@ @true@ @false@ @true@
+| @true@ @true@ @true@ @true@ @false@
+
+--See also--
+| [[fun:to_boolean]] Convert a value to a boolean
diff --git a/doc/type/card.txt b/doc/type/card.txt
index c2b55e1d..5469a1ad 100644
--- a/doc/type/card.txt
+++ b/doc/type/card.txt
@@ -1,39 +1,39 @@
-Data type: card
-
---Overview--
-
-A '''card''' in a [[type:set]].
-
---Properties--
-! Property Type Default Description
-| @stylesheet@ Name of a [[type:stylesheet]] ''none'' Use a different stylesheet for this card than the [[type:set]]'s default.
-| @has styling@ [[type:boolean]] false This card has styling data different from the set's default.
-| @styling data@ [[type:indexmap]] of [[type:value]]s false Styling data, based on the [[type:stylesheet]]'s @style fields@.
-| @notes@ [[type:tagged string]] @""@ Notes for this card.
-| @time created@ [[type:date]] ''now'' Time at which the card was created.
-| @time modified@ [[type:date]] ''now'' Time at which the card was last modified.
-| @extra data@ [[type:map]] of [[type:indexmap]]s of [[type:value]]s
- Data for the 'extra card fields' of the stylesheet.
- This is first indexed by stylesheet name, then by field name.
-| ''remaining keys'' [[type:indexmap]] of [[type:value]]s The remaining keys contain the data for the game's @card fields@.
- So for example @card.some_field@ corresponds to the value of the card field @some field@.
-
---Examples--
-
-With the following game:
->card field:
-> type: text
-> name: title
->card field:
-> type: color
-> name: card color
-
-A card could look like:
->card:
-> stylesheet: new
-> has styling: false
-> notes: This card is not finished yet!
-> styling data:
-> extra large cards: true
-> title: My Card
-> card color: rgb(0,128,255)
+Data type: card
+
+--Overview--
+
+A '''card''' in a [[type:set]].
+
+--Properties--
+! Property Type Default Description
+| @stylesheet@ Name of a [[type:stylesheet]] ''none'' Use a different stylesheet for this card than the [[type:set]]'s default.
+| @has styling@ [[type:boolean]] false This card has styling data different from the set's default.
+| @styling data@ [[type:indexmap]] of [[type:value]]s false Styling data, based on the [[type:stylesheet]]'s @style fields@.
+| @notes@ [[type:tagged string]] @""@ Notes for this card.
+| @time created@ [[type:date]] ''now'' Time at which the card was created.
+| @time modified@ [[type:date]] ''now'' Time at which the card was last modified.
+| @extra data@ [[type:map]] of [[type:indexmap]]s of [[type:value]]s
+ Data for the 'extra card fields' of the stylesheet.
+ This is first indexed by stylesheet name, then by field name.
+| ''remaining keys'' [[type:indexmap]] of [[type:value]]s The remaining keys contain the data for the game's @card fields@.
+ So for example @card.some_field@ corresponds to the value of the card field @some field@.
+
+--Examples--
+
+With the following game:
+>card field:
+> type: text
+> name: title
+>card field:
+> type: color
+> name: card color
+
+A card could look like:
+>card:
+> stylesheet: new
+> has styling: false
+> notes: This card is not finished yet!
+> styling data:
+> extra large cards: true
+> title: My Card
+> card color: rgb(0,128,255)
diff --git a/doc/type/choice.txt b/doc/type/choice.txt
index 21be8b29..266d7bbf 100644
--- a/doc/type/choice.txt
+++ b/doc/type/choice.txt
@@ -1,43 +1,43 @@
-Data type: choice for a choice field
-
-A possible choice for a choice [[type:field]].
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''Required'' Name of this choice, displayed in the drop down list.
-| @line below@ [[type:boolean]] @false@ Display a line below this item?
-| @group choice@ [[type:string]] ''no'' Can this submenu of choices itself be selected?
-| @choices@ [[type:list]] of [[type:choice]]s Submenu of choices.
-| @enabled@ [[type:scriptable]] [[type:boolean]] Is this choice selectable?
-| @type@ @"check"@ or @"radio"@ @"check"@ How should this choice be displayed? As a checkbox or a radio box?
- Only applies to multiple choice fields.
-
-A choice can also be given in a short form, in that case only the name is specified.
-
---Names--
-
-The full name of a choice is that of the choice and its parents, separated by spaces.
-This is the value actually stored in values and manipulated by scripts.
-
-For example
->field:
-> type: choice
-> choice:
-> name: large
-> choice: red
-> choice: blue
-> choice:
-> name: small
-> group choice: just small
-> choice: green
-> choice: yellow
-
-The choice red is called @"large red"@, while green is @"small green"@.
-The group choice 'just small' gets the name of the group, @"small"@.
-
---Example--
-In short form:
->choice: apples
-Is the same as:
->choice:
-> name: apples
+Data type: choice for a choice field
+
+A possible choice for a choice [[type:field]].
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''Required'' Name of this choice, displayed in the drop down list.
+| @line below@ [[type:boolean]] @false@ Display a line below this item?
+| @group choice@ [[type:string]] ''no'' Can this submenu of choices itself be selected?
+| @choices@ [[type:list]] of [[type:choice]]s Submenu of choices.
+| @enabled@ [[type:scriptable]] [[type:boolean]] Is this choice selectable?
+| @type@ @"check"@ or @"radio"@ @"check"@ How should this choice be displayed? As a checkbox or a radio box?
+ Only applies to multiple choice fields.
+
+A choice can also be given in a short form, in that case only the name is specified.
+
+--Names--
+
+The full name of a choice is that of the choice and its parents, separated by spaces.
+This is the value actually stored in values and manipulated by scripts.
+
+For example
+>field:
+> type: choice
+> choice:
+> name: large
+> choice: red
+> choice: blue
+> choice:
+> name: small
+> group choice: just small
+> choice: green
+> choice: yellow
+
+The choice red is called @"large red"@, while green is @"small green"@.
+The group choice 'just small' gets the name of the group, @"small"@.
+
+--Example--
+In short form:
+>choice: apples
+Is the same as:
+>choice:
+> name: apples
diff --git a/doc/type/choice_render_style.txt b/doc/type/choice_render_style.txt
index 6a0e174b..c07d6bca 100644
--- a/doc/type/choice_render_style.txt
+++ b/doc/type/choice_render_style.txt
@@ -1,31 +1,31 @@
-Enumeration: render style
-
-A way to render a choice [[type:field]], see [[type:style]].
-
---Possible values--
-! Value Sketch Description
-| @text@
- Rendered as text
-| @image@
- Rendered as an image
-| @both@
- Both an image and text
-| @hidden@
- The box is hidden, but the value can still be edited.
-| @image hidden@
- The box is hidden, but the value can still be edited.
-| @checklist@
- A list of checkboxes, for multiple choice styles.
-| @image checklist@
- A list of checkboxes with images instead of text.
-| @both checklist@
- A list of checkboxes with both images and text.
-| @text list@
- A list of the selected items, for multiple choice styles.
-| @image list@
- A list of the selected items with images instead of text.
-| @both list@
- A list of the selected items with both images and text.
-
---Examples--
-> render style: image
+Enumeration: render style
+
+A way to render a choice [[type:field]], see [[type:style]].
+
+--Possible values--
+! Value Sketch Description
+| @text@
+ Rendered as text
+| @image@
+ Rendered as an image
+| @both@
+ Both an image and text
+| @hidden@
+ The box is hidden, but the value can still be edited.
+| @image hidden@
+ The box is hidden, but the value can still be edited.
+| @checklist@
+ A list of checkboxes, for multiple choice styles.
+| @image checklist@
+ A list of checkboxes with images instead of text.
+| @both checklist@
+ A list of checkboxes with both images and text.
+| @text list@
+ A list of the selected items, for multiple choice styles.
+| @image list@
+ A list of the selected items with images instead of text.
+| @both list@
+ A list of the selected items with both images and text.
+
+--Examples--
+> render style: image
diff --git a/doc/type/color.txt b/doc/type/color.txt
index 908a0c0c..5b23f310 100644
--- a/doc/type/color.txt
+++ b/doc/type/color.txt
@@ -1,32 +1,32 @@
-Primitive type: color
-
---Syntax--
-In files and scritps a color can be represented as
-rgb(red_component, green_component, blue_component)
-where red_component, green_component and blue_component are numbers between 0 and 255 (inclusive).
-
-In some places MSE also supports colors with a transparency value, notated as
-rgba(red_component, green_component, blue_component, alpha_component)
-An alpha value of @0@ indicates a transparent color, an alpha value of @255@ is completely opaque.
-
---Named colors--
-MSE also supports named colors, for instance @"white"@ is the same as @rgb(255,255,255)@.
-For a full list of supported colors, see [[http://www.wxwidgets.org/manuals/stable/wx_wxcolourdatabase.html|the wxWidgets documentation]].
-In addition, the named color @"transparent"@ stands for the completely transparent color, @rgba(0,0,0,0)@.
-
-In scripts named colors are represented as [[type:string]]s.
-
---Examples--
-For example:
-! Code Represents <<<
-| @rgb(255,255,255)@ white
-| @rgb(0,0,0)@ black
-| @rgb(255,0,0)@ red
-| @rgb(0,255,0)@ green
-| @rgb(0,0,255)@ blue
-| @rgba(0,0,0,0)@ transparent over
-| @rgba(255,0,0,128)@ transparent red over
-| @rgba(0,0,255,192)@ transparent blue over
-
---See also--
-| [[fun:to_color]] Convert any value to a color
+Primitive type: color
+
+--Syntax--
+In files and scritps a color can be represented as
+rgb(red_component, green_component, blue_component)
+where red_component, green_component and blue_component are numbers between 0 and 255 (inclusive).
+
+In some places MSE also supports colors with a transparency value, notated as
+rgba(red_component, green_component, blue_component, alpha_component)
+An alpha value of @0@ indicates a transparent color, an alpha value of @255@ is completely opaque.
+
+--Named colors--
+MSE also supports named colors, for instance @"white"@ is the same as @rgb(255,255,255)@.
+For a full list of supported colors, see [[http://www.wxwidgets.org/manuals/stable/wx_wxcolourdatabase.html|the wxWidgets documentation]].
+In addition, the named color @"transparent"@ stands for the completely transparent color, @rgba(0,0,0,0)@.
+
+In scripts named colors are represented as [[type:string]]s.
+
+--Examples--
+For example:
+! Code Represents <<<
+| @rgb(255,255,255)@ white
+| @rgb(0,0,0)@ black
+| @rgb(255,0,0)@ red
+| @rgb(0,255,0)@ green
+| @rgb(0,0,255)@ blue
+| @rgba(0,0,0,0)@ transparent over
+| @rgba(255,0,0,128)@ transparent red over
+| @rgba(0,0,255,192)@ transparent blue over
+
+--See also--
+| [[fun:to_color]] Convert any value to a color
diff --git a/doc/type/color_choice.txt b/doc/type/color_choice.txt
index d5742a9c..93005957 100644
--- a/doc/type/color_choice.txt
+++ b/doc/type/color_choice.txt
@@ -1,13 +1,13 @@
-Data type: choice for a color field
-
-A possible choice for a color [[type:field]].
-
---Properties--
-! Property Type Description
-| @name@ [[type:string]] Name of this choice, displayed in the drop down list.
-| @color@ opaque [[type:color]] Color this choice corresponds with.
-
---Example--
->choice:
-> name: red
-> color: rgb(255,0,0)
+Data type: choice for a color field
+
+A possible choice for a color [[type:field]].
+
+--Properties--
+! Property Type Description
+| @name@ [[type:string]] Name of this choice, displayed in the drop down list.
+| @color@ opaque [[type:color]] Color this choice corresponds with.
+
+--Example--
+>choice:
+> name: red
+> color: rgb(255,0,0)
diff --git a/doc/type/combine.txt b/doc/type/combine.txt
index 4994475c..436d12e4 100644
--- a/doc/type/combine.txt
+++ b/doc/type/combine.txt
@@ -1,41 +1,41 @@
-Enumeration: image combine type
-
-This specifies how an image is to be combined with the background.
-This is similair to the feature found in more advanced drawing programs.
-
-The formula's are from [[http://www.pegtop.net/delphi/articles/blendmodes/]].
-
---Script syntax--
-In scripts, combine modes are stored as a string.
-
---Possible values--
-! Value Description
-| @normal@ Normal behaviour, don't combine.
-| @add@
-| @subtract@
-| @stamp@
-| @difference@
-| @negation@
-| @multiply@
-| @darken@
-| @lighten@
-| @color dodge@
-| @color burn@
-| @screen@
-| @overlay@
-| @hard light@
-| @soft light@
-| @reflect@
-| @glow@
-| @freeze@
-| @heat@
-| and Bitwise and
-| or Bitwise or
-| xor Bitwise xot
-| @shadow@ Dark colors normally, white colors darken the background.
-| @symmetric overlay@ @(overlay(a,b) + overlay(b,a)) / 2@
-
---Examples--
-> combine: overlay
-> combine_image(image1: ..., image2: ..., combine: "shadow")
-
+Enumeration: image combine type
+
+This specifies how an image is to be combined with the background.
+This is similair to the feature found in more advanced drawing programs.
+
+The formula's are from [[http://www.pegtop.net/delphi/articles/blendmodes/]].
+
+--Script syntax--
+In scripts, combine modes are stored as a string.
+
+--Possible values--
+! Value Description
+| @normal@ Normal behaviour, don't combine.
+| @add@
+| @subtract@
+| @stamp@
+| @difference@
+| @negation@
+| @multiply@
+| @darken@
+| @lighten@
+| @color dodge@
+| @color burn@
+| @screen@
+| @overlay@
+| @hard light@
+| @soft light@
+| @reflect@
+| @glow@
+| @freeze@
+| @heat@
+| and Bitwise and
+| or Bitwise or
+| xor Bitwise xot
+| @shadow@ Dark colors normally, white colors darken the background.
+| @symmetric overlay@ @(overlay(a,b) + overlay(b,a)) / 2@
+
+--Examples--
+> combine: overlay
+> combine_image(image1: ..., image2: ..., combine: "shadow")
+
diff --git a/doc/type/control_point.txt b/doc/type/control_point.txt
index 4a81bf52..4e0a7d2c 100644
--- a/doc/type/control_point.txt
+++ b/doc/type/control_point.txt
@@ -1,24 +1,24 @@
-Data type: symbol control point
-
---Overview--
-
-A single [[http://en.wikipedia.org/wiki/Bezier_curve|Bézier curve]] control point in a [[type:symbol part|symbol shape]].
-
-A control point is a point on the polygon.
-It also optionally has two 'handles' corresponding to the boxes attached with dotted lines in the editor.
-
-The control points of a shape are circular, the point after the last point in the list is the first point.
-
---Properties--
-! Property Type Default Description
-| @position@ [[type:vector2d]] Position of the control point.
-| @lock@ @free@, @direction@ or @size@ @"free"@
- Is this point 'locked', i.e. is the relation between the two handles fixed?
- If @lock@ is @"direction"@ then the two handles must lie on a line.
- If @lock@ is @"direction"@ then the two handles must lie exactly oppisite each other on the same distance from the point.
-| @line after@ @line@ or @curve@ @"line"@ Is the segment between this control point and the next one in the list a straight line or a cubic Bézier curve?
-| @handle before@ [[type:vector2d]] Position of the handle for the segment between this point and the previous one, relative to the point's @position@.
Only when that point's @line after == "curve"@.
-| @handle after@ [[type:vector2d]] Position of the handle for the segment between this point and the next one, relative to the point's @position@.
Only when @line after == "curve"@.
-
---Example--
-Look at a symbol file made with the program.
+Data type: symbol control point
+
+--Overview--
+
+A single [[http://en.wikipedia.org/wiki/Bezier_curve|Bézier curve]] control point in a [[type:symbol part|symbol shape]].
+
+A control point is a point on the polygon.
+It also optionally has two 'handles' corresponding to the boxes attached with dotted lines in the editor.
+
+The control points of a shape are circular, the point after the last point in the list is the first point.
+
+--Properties--
+! Property Type Default Description
+| @position@ [[type:vector2d]] Position of the control point.
+| @lock@ @free@, @direction@ or @size@ @"free"@
+ Is this point 'locked', i.e. is the relation between the two handles fixed?
+ If @lock@ is @"direction"@ then the two handles must lie on a line.
+ If @lock@ is @"direction"@ then the two handles must lie exactly oppisite each other on the same distance from the point.
+| @line after@ @line@ or @curve@ @"line"@ Is the segment between this control point and the next one in the list a straight line or a cubic Bézier curve?
+| @handle before@ [[type:vector2d]] Position of the handle for the segment between this point and the previous one, relative to the point's @position@.
Only when that point's @line after == "curve"@.
+| @handle after@ [[type:vector2d]] Position of the handle for the segment between this point and the next one, relative to the point's @position@.
Only when @line after == "curve"@.
+
+--Example--
+Look at a symbol file made with the program.
diff --git a/doc/type/date.txt b/doc/type/date.txt
index 09056472..4f292d65 100644
--- a/doc/type/date.txt
+++ b/doc/type/date.txt
@@ -1,13 +1,13 @@
-Primitive type: date and time
-
-DOC_MSE_VERSION: since 0.3.8
-
-A point in time, consisting of a date and a time.
-The file syntax uses [[http://en.wikipedia.org/wiki/ISO_8601|ISO 8601]] notation.
-
---File syntax--
-> something: 2008-12-31 23:59:59
-
---See also--
-| [[fun:to_date]] Convert a value to a date
-| [[fun:to_string]] Convert dates to strings
+Primitive type: date and time
+
+DOC_MSE_VERSION: since 0.3.8
+
+A point in time, consisting of a date and a time.
+The file syntax uses [[http://en.wikipedia.org/wiki/ISO_8601|ISO 8601]] notation.
+
+--File syntax--
+> something: 2008-12-31 23:59:59
+
+--See also--
+| [[fun:to_date]] Convert a value to a date
+| [[fun:to_string]] Convert dates to strings
diff --git a/doc/type/dependency.txt b/doc/type/dependency.txt
index 774570aa..6f7c803b 100644
--- a/doc/type/dependency.txt
+++ b/doc/type/dependency.txt
@@ -1,21 +1,21 @@
-Data type: dependency
-
---Overview--
-
-[[type:Package]]s can depend on other packages.
-For example a [[type:stylesheet]] needs a particular version of the corresponding [[type:game]] package, and maybe some additional [[type:include]]s.
-
---Properties--
-! Property Type Description
-| @package@ [[type:string]] Filename of the package this package depends on.
-| @version@ [[type:version]] Minimal version of that package that is required.
-
-The two properties can also be written on a single line, separated by a space (see the examples).
-
---Example--
-The magic-new stylesheet depends on a particular version of the game file:
->depends on:
-> package: magic.mse-game
-> version: 2007-06-06
-This can be written more compactly as
->depends on: magic.mse-game 2007-06-06
+Data type: dependency
+
+--Overview--
+
+[[type:Package]]s can depend on other packages.
+For example a [[type:stylesheet]] needs a particular version of the corresponding [[type:game]] package, and maybe some additional [[type:include]]s.
+
+--Properties--
+! Property Type Description
+| @package@ [[type:string]] Filename of the package this package depends on.
+| @version@ [[type:version]] Minimal version of that package that is required.
+
+The two properties can also be written on a single line, separated by a space (see the examples).
+
+--Example--
+The magic-new stylesheet depends on a particular version of the game file:
+>depends on:
+> package: magic.mse-game
+> version: 2007-06-06
+This can be written more compactly as
+>depends on: magic.mse-game 2007-06-06
diff --git a/doc/type/direction.txt b/doc/type/direction.txt
index 5a3e1c9f..3375ba58 100644
--- a/doc/type/direction.txt
+++ b/doc/type/direction.txt
@@ -1,20 +1,20 @@
-Enumeration: direction
-
-Specifies the direction of text flow in a text box.
-
---Script syntax--
-In scripts, direction is passed around as a string.
-
---Possible values--
-! Value Description
-| @left to right@ Text starts at the left.
-| @right to left@ Text starts at the right ''(currently not implemented)''
-| @top to bottom@ Text starts at the top, each character is on a new line.
-| @bottom to top@ Text starts at the bottom ''(currently not implemented)''
-| @horizontal@ Same as @left to right@.
-| @vertical@ Same as @top to bottom@.
-
---Examples--
-> direction: horizontal
-> direction: top to bottom
-
+Enumeration: direction
+
+Specifies the direction of text flow in a text box.
+
+--Script syntax--
+In scripts, direction is passed around as a string.
+
+--Possible values--
+! Value Description
+| @left to right@ Text starts at the left.
+| @right to left@ Text starts at the right ''(currently not implemented)''
+| @top to bottom@ Text starts at the top, each character is on a new line.
+| @bottom to top@ Text starts at the bottom ''(currently not implemented)''
+| @horizontal@ Same as @left to right@.
+| @vertical@ Same as @top to bottom@.
+
+--Examples--
+> direction: horizontal
+> direction: top to bottom
+
diff --git a/doc/type/double.txt b/doc/type/double.txt
index 5a7c16ec..3bdcb107 100644
--- a/doc/type/double.txt
+++ b/doc/type/double.txt
@@ -1,16 +1,16 @@
-Primitive type: real number
-
-Real or floating point numbers are numbers with a decimal point.
-
-Conversion from integer to real numbers happens automatically in scripting.
-
---File syntax--
-> something: 123
-> something: 0.5
-
---Script syntax--
-> 123.1 + 456 * -1
-
---See also--
-| [[type:int]] Integer numbers
-| [[fun:to_real]] Convert a value to a real number
+Primitive type: real number
+
+Real or floating point numbers are numbers with a decimal point.
+
+Conversion from integer to real numbers happens automatically in scripting.
+
+--File syntax--
+> something: 123
+> something: 0.5
+
+--Script syntax--
+> 123.1 + 456 * -1
+
+--See also--
+| [[type:int]] Integer numbers
+| [[fun:to_real]] Convert a value to a real number
diff --git a/doc/type/export_template.txt b/doc/type/export_template.txt
index aafcae3d..ff186b54 100644
--- a/doc/type/export_template.txt
+++ b/doc/type/export_template.txt
@@ -1,52 +1,52 @@
-File type: Export template
-
---Overview--
-
-An export template describes a way for a set to be exported to a HTML or other text files.
-
---Package format--
-An export template is described in a [[file:package]] with the .mse-export-template file extension.
-Its name should begin with game- where game is the name of the game the template is made for.
-It should contain a [[file:format|data file]] called export-template with the following properties.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this export template is made for.
-| @short name@ [[type:string]] file name A short name of this export template, for the 'new set' and style panel lists.
-| @full name@ [[type:string]] file name A longer name of this export template.
-| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this export template, for the 'export to HTML' dialog.
-| @position hint@ [[type:int]] ∞ Where to place this item in the list? Lower numbers come first.
-| @version@ [[type:version]] @0.0.0@ Version number of this package.
-| @depends on@ [[type:list]] of [[type:dependency]]s
- Packages this package depends on.
-
-| '''Specific to export template''' <<< <<< <<<
-| @game@ Name of a [[type:game]] ''required'' Game this export template is made for
-| @file type@ [[type:string]] @"HTML files (*.html)|*.html"@
- File type to use, this is a list separated by @|@ characters.
- Alternatingly, a human description and a file pattern to match are given.
-| @create directory@ [[type:boolean]] @false@ Should a directory for data files be created? This is required for some script function.
-| @option fields@ [[type:list]] of [[type:field]]s Fields for additional options to show.
-| @option style@ [[type:indexmap]] of [[type:style]]s Styling for the @option fields@.
-| @script@ [[type:script]] Script that generates the text that will be written to the exported file.
-
-During the evaluation of the script the following variables are available:
-| @game@ The current game.
-| @style@ The current stylesheet.
-| @set@ The set being exported.
-| @cards@ The cards selected by the user.
-| @options@ The values of the @option fields@.
-| @directory@ Name of the directory created (if @create directory@ is set).
-
---See also--
-The following functions are made specifically for exporting to html:
-| [[fun:to_html]] Convert [[type:tagged text]] to html.
-| [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]].
-| [[fun:to_text]] Remove all tags from tagged text.
-| [[fun:copy_file]] Copy a file from the [[type:export template]] to the output directory.
-| [[fun:write_text_file]] Write a text file to the output directory.
-| [[fun:write_image_file]] Write an image file to the output directory.
-
---Example--
-Look at the @"magic-spoiler.mse-export-template"@ for an example.
+File type: Export template
+
+--Overview--
+
+An export template describes a way for a set to be exported to a HTML or other text files.
+
+--Package format--
+An export template is described in a [[file:package]] with the .mse-export-template file extension.
+Its name should begin with game- where game is the name of the game the template is made for.
+It should contain a [[file:format|data file]] called export-template with the following properties.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this export template is made for.
+| @short name@ [[type:string]] file name A short name of this export template, for the 'new set' and style panel lists.
+| @full name@ [[type:string]] file name A longer name of this export template.
+| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this export template, for the 'export to HTML' dialog.
+| @position hint@ [[type:int]] ∞ Where to place this item in the list? Lower numbers come first.
+| @version@ [[type:version]] @0.0.0@ Version number of this package.
+| @depends on@ [[type:list]] of [[type:dependency]]s
+ Packages this package depends on.
+
+| '''Specific to export template''' <<< <<< <<<
+| @game@ Name of a [[type:game]] ''required'' Game this export template is made for
+| @file type@ [[type:string]] @"HTML files (*.html)|*.html"@
+ File type to use, this is a list separated by @|@ characters.
+ Alternatingly, a human description and a file pattern to match are given.
+| @create directory@ [[type:boolean]] @false@ Should a directory for data files be created? This is required for some script function.
+| @option fields@ [[type:list]] of [[type:field]]s Fields for additional options to show.
+| @option style@ [[type:indexmap]] of [[type:style]]s Styling for the @option fields@.
+| @script@ [[type:script]] Script that generates the text that will be written to the exported file.
+
+During the evaluation of the script the following variables are available:
+| @game@ The current game.
+| @style@ The current stylesheet.
+| @set@ The set being exported.
+| @cards@ The cards selected by the user.
+| @options@ The values of the @option fields@.
+| @directory@ Name of the directory created (if @create directory@ is set).
+
+--See also--
+The following functions are made specifically for exporting to html:
+| [[fun:to_html]] Convert [[type:tagged text]] to html.
+| [[fun:symbols_to_html]] Convert text to html using a [[type:symbol font]].
+| [[fun:to_text]] Remove all tags from tagged text.
+| [[fun:copy_file]] Copy a file from the [[type:export template]] to the output directory.
+| [[fun:write_text_file]] Write a text file to the output directory.
+| [[fun:write_image_file]] Write an image file to the output directory.
+
+--Example--
+Look at the @"magic-spoiler.mse-export-template"@ for an example.
diff --git a/doc/type/field.txt b/doc/type/field.txt
index 4ea22878..5d319061 100644
--- a/doc/type/field.txt
+++ b/doc/type/field.txt
@@ -1,129 +1,129 @@
-Data type: field
-
---Overview--
-
-A field is a description of a kind of 'container' to hold a value.
-
-For example the [[type:value]] of a 'text field' is a piece of text, that of a 'color field' a [[type:color]], etc.
-
-Things that are fields are, "card color" and "card name".
-Not a particular color or name, but a description of what a card color and a card name are for a particular [[type:game]].
-
-Fields are part of the [[file:style triangle]]:
-| Description Looks Data
-| [[type:Game]] [[type:Stylesheet]] [[type:Set]]
-| '''Field''' [[type:Style]] [[type:Value]]
-
---Properties--
-! Property Type Default Description
-| @type@ One of: ''required'' Type of field.
- * @text@
- * @choice@
- * @multiple choice@
- * @package choice@
- * @boolean@
- * @image@
- * @symbol@
- * @color@
- * @info@
-| @name@ [[type:string]] ''required'' Name of the field.
-| @description@ [[type:string]] @""@ Description of the field, shown in the status bar when the mouse is over the field.
-| @icon@ [[type:filename]] Filename of an icon for this field, used for automatically generated [[type:statistics category]]s.
-| @editable@ [[type:boolean]] @true@ Can values of this field be edited?
-| @save value@ [[type:boolean]] @true@ Should values of this field be saved to files? Should be disabled for values that are generated by scripts.
-| @show statistics@ [[type:boolean]] @true@ Should a [[type:statistics dimension]] and [[type:statistics category|category]] be made for this field,
- causing it to be listed on the statistics panel?
-| @identifying@ [[type:boolean]] @false@ Does this field give the name of the [[type:card]] or [[type:set]]?
-| @card list column@ [[type:int]] @0@ On what position in the card list should this field be put?
-| @card list width@ [[type:int]] @100@ Width of the card list column in pixels.
-| @card list visible@ [[type:boolean]] @false@ Should this field be shown in the card list by default?
-| @card list allow@ [[type:boolean]] @true@ Should this field be allowed in the card list at all?
-| @card list name@ [[type:string]] field name Alternate name to use for the card list, for example an abbreviation.
-| @card list alignment@ [[type:alignment]] @left@ Alignment of the card list column.
-| @sort script@ [[type:script]] Alternate way to sort the card list when using this column to sort the list.
-
-The @type@ determines what values of this field contain:
-! Type Values contain Displayed as
-| @text@ Text with markup (a [[type:tagged string]]) Text
-| @choice@ A choice from a list Text or an image
-| @multiple choice@ Zero or more choices from a list A single image or multiple images
-| @package choice@ A choice from a list of installed [[type:package]]s Text and/or an image
-| @boolean@ @yes@ or @no@ Text or an image or both
-| @color@ Any color or a restricted selection from a list A box filled with the color
-| @image@ Any image The image
-| @symbol@ A [[type:symbol]] edited with the symbol editor The image
-| @info@ An informational message, for example to group fields together. A box containing the label
-
-Additional properties are available, depending on the type of field:
-
-! Type Property Type Default Description
-| @"text"@ @script@ [[type:script]] Script to apply to values of this field after each change.
- If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
-| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
-| ^^^ @default name@ [[type:string]] @"Default"@ Name of the default state, currently not used.
-| ^^^ @multi line@ [[type:boolean]] @false@ Can values of this field contain line breaks?
-
-| @"choice"@ @script@ [[type:script]] Script to apply to values of this field after each change.
- If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
-| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
-| ^^^ @initial@ [[type:string]] Initial value for new values for this field.
-| ^^^ @default name@ [[type:string]] @"Default"@ Name of the default state.
-| ^^^ @choices@ [[type:list]] of [[type:choice]]s Possible values for this field.
-| ^^^ @choice colors@ [[type:map]] of opaque [[type:color]]s Colors of the choices for statistics graphs.
-| ^^^ @choice colors cardlist@ [[type:map]] of opaque [[type:color]]s Colors of the choices for lines in the card list,
see also the @card list color script@ property of [[type:game]]s.
-
-| @"multiple choice"@ <<< <<< <<<
- '' Multiple choice fields have the same attributes as normal choice fields.''
- To refer to a combination of values in the initial attribute use @choice1, choice2, choice3@.
- These choices must appear in the same order as they do in the @choices@ property.
-
-| @"boolean"@ ''A boolean field is a choice field with the choices @"yes"@ and @"no"@.'' <<< <<< <<<
-
-| @"package choice"@
- @script@ [[type:script]] Script to apply to values of this field after each change.
- If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
-| ^^^ @match@ [[type:string]] ''required'' Filenames of the packages to match, can include wildcards @"*"@. For example @"magic-mana-*.mse-symbol-font"@.
-| ^^^ @initial@ [[type:string]] ''required'' Initial package for new values for this field.
-| ^^^ @reqired@ [[type:boolean]] @true@ Must a package always be selected? Or is it allowed to select nothing?
-| ^^^ @empty name@ [[type:string]] @"None"@ Name of the empty state. Applies only if @required: false@.
-
-| @"color"@ @script@ [[type:script]] Script to apply to values of this field after each change.
- If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
-| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
-| ^^^ @initial@ [[type:string]] Initial color for new values for this field.
-| ^^^ @default name@ [[type:string]] @"Default"@ Name of the default state.
-| ^^^ @allow custom@ [[type:boolean]] @true@ Are colors other then those from the choices allowed?
-| ^^^ @choices@ [[type:list]] of [[type:color choice]]s Possible values for this field.
-
-| @"image"@ ''no extra properties'' <<< <<< <<<
-
-| @"symbol"@ ''no extra properties'' <<< <<< <<<
-
-| @"info"@ @script@ [[type:script]] Script to determine the value to show.
-
---Example--
-The @title@ field gives the title of a set:
->set field:
-> type: text
-> name: title
-> identifying: true
-
-The border color of cards can be selected from a list of choices, but other values are also possible.
-The default is based on a set field. Statistics don't make much sense for the border color.
->card field:
-> type: color
-> name: border color
-> default: set.border_color
-> choice:
-> name: black
-> color: rgb(0,0,0)
-> choice:
-> name: white
-> color: rgb(255,255,255)
-> choice:
-> name: silver
-> color: rgb(128,128,128)
-> choice:
-> name: gold
-> color: rgb(200,180,0)
-> show statistics: false
+Data type: field
+
+--Overview--
+
+A field is a description of a kind of 'container' to hold a value.
+
+For example the [[type:value]] of a 'text field' is a piece of text, that of a 'color field' a [[type:color]], etc.
+
+Things that are fields are, "card color" and "card name".
+Not a particular color or name, but a description of what a card color and a card name are for a particular [[type:game]].
+
+Fields are part of the [[file:style triangle]]:
+| Description Looks Data
+| [[type:Game]] [[type:Stylesheet]] [[type:Set]]
+| '''Field''' [[type:Style]] [[type:Value]]
+
+--Properties--
+! Property Type Default Description
+| @type@ One of: ''required'' Type of field.
+ * @text@
+ * @choice@
+ * @multiple choice@
+ * @package choice@
+ * @boolean@
+ * @image@
+ * @symbol@
+ * @color@
+ * @info@
+| @name@ [[type:string]] ''required'' Name of the field.
+| @description@ [[type:string]] @""@ Description of the field, shown in the status bar when the mouse is over the field.
+| @icon@ [[type:filename]] Filename of an icon for this field, used for automatically generated [[type:statistics category]]s.
+| @editable@ [[type:boolean]] @true@ Can values of this field be edited?
+| @save value@ [[type:boolean]] @true@ Should values of this field be saved to files? Should be disabled for values that are generated by scripts.
+| @show statistics@ [[type:boolean]] @true@ Should a [[type:statistics dimension]] and [[type:statistics category|category]] be made for this field,
+ causing it to be listed on the statistics panel?
+| @identifying@ [[type:boolean]] @false@ Does this field give the name of the [[type:card]] or [[type:set]]?
+| @card list column@ [[type:int]] @0@ On what position in the card list should this field be put?
+| @card list width@ [[type:int]] @100@ Width of the card list column in pixels.
+| @card list visible@ [[type:boolean]] @false@ Should this field be shown in the card list by default?
+| @card list allow@ [[type:boolean]] @true@ Should this field be allowed in the card list at all?
+| @card list name@ [[type:string]] field name Alternate name to use for the card list, for example an abbreviation.
+| @card list alignment@ [[type:alignment]] @left@ Alignment of the card list column.
+| @sort script@ [[type:script]] Alternate way to sort the card list when using this column to sort the list.
+
+The @type@ determines what values of this field contain:
+! Type Values contain Displayed as
+| @text@ Text with markup (a [[type:tagged string]]) Text
+| @choice@ A choice from a list Text or an image
+| @multiple choice@ Zero or more choices from a list A single image or multiple images
+| @package choice@ A choice from a list of installed [[type:package]]s Text and/or an image
+| @boolean@ @yes@ or @no@ Text or an image or both
+| @color@ Any color or a restricted selection from a list A box filled with the color
+| @image@ Any image The image
+| @symbol@ A [[type:symbol]] edited with the symbol editor The image
+| @info@ An informational message, for example to group fields together. A box containing the label
+
+Additional properties are available, depending on the type of field:
+
+! Type Property Type Default Description
+| @"text"@ @script@ [[type:script]] Script to apply to values of this field after each change.
+ If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
+| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
+| ^^^ @default name@ [[type:string]] @"Default"@ Name of the default state, currently not used.
+| ^^^ @multi line@ [[type:boolean]] @false@ Can values of this field contain line breaks?
+
+| @"choice"@ @script@ [[type:script]] Script to apply to values of this field after each change.
+ If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
+| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
+| ^^^ @initial@ [[type:string]] Initial value for new values for this field.
+| ^^^ @default name@ [[type:string]] @"Default"@ Name of the default state.
+| ^^^ @choices@ [[type:list]] of [[type:choice]]s Possible values for this field.
+| ^^^ @choice colors@ [[type:map]] of opaque [[type:color]]s Colors of the choices for statistics graphs.
+| ^^^ @choice colors cardlist@ [[type:map]] of opaque [[type:color]]s Colors of the choices for lines in the card list,
see also the @card list color script@ property of [[type:game]]s.
+
+| @"multiple choice"@ <<< <<< <<<
+ '' Multiple choice fields have the same attributes as normal choice fields.''
+ To refer to a combination of values in the initial attribute use @choice1, choice2, choice3@.
+ These choices must appear in the same order as they do in the @choices@ property.
+
+| @"boolean"@ ''A boolean field is a choice field with the choices @"yes"@ and @"no"@.'' <<< <<< <<<
+
+| @"package choice"@
+ @script@ [[type:script]] Script to apply to values of this field after each change.
+ If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
+| ^^^ @match@ [[type:string]] ''required'' Filenames of the packages to match, can include wildcards @"*"@. For example @"magic-mana-*.mse-symbol-font"@.
+| ^^^ @initial@ [[type:string]] ''required'' Initial package for new values for this field.
+| ^^^ @reqired@ [[type:boolean]] @true@ Must a package always be selected? Or is it allowed to select nothing?
+| ^^^ @empty name@ [[type:string]] @"None"@ Name of the empty state. Applies only if @required: false@.
+
+| @"color"@ @script@ [[type:script]] Script to apply to values of this field after each change.
+ If the script evaluates to a constant (i.e. doesn't use @value@) then values in this field can effectively not be edited.
+| ^^^ @default@ [[type:script]] Script to determine the value when it is in the default state (not edited).
+| ^^^ @initial@ [[type:string]] Initial color for new values for this field.
+| ^^^ @default name@ [[type:string]] @"Default"@ Name of the default state.
+| ^^^ @allow custom@ [[type:boolean]] @true@ Are colors other then those from the choices allowed?
+| ^^^ @choices@ [[type:list]] of [[type:color choice]]s Possible values for this field.
+
+| @"image"@ ''no extra properties'' <<< <<< <<<
+
+| @"symbol"@ ''no extra properties'' <<< <<< <<<
+
+| @"info"@ @script@ [[type:script]] Script to determine the value to show.
+
+--Example--
+The @title@ field gives the title of a set:
+>set field:
+> type: text
+> name: title
+> identifying: true
+
+The border color of cards can be selected from a list of choices, but other values are also possible.
+The default is based on a set field. Statistics don't make much sense for the border color.
+>card field:
+> type: color
+> name: border color
+> default: set.border_color
+> choice:
+> name: black
+> color: rgb(0,0,0)
+> choice:
+> name: white
+> color: rgb(255,255,255)
+> choice:
+> name: silver
+> color: rgb(128,128,128)
+> choice:
+> name: gold
+> color: rgb(200,180,0)
+> show statistics: false
diff --git a/doc/type/filename.txt b/doc/type/filename.txt
index bb0942b5..b40f3bc1 100644
--- a/doc/type/filename.txt
+++ b/doc/type/filename.txt
@@ -1,20 +1,20 @@
-Primitve type: filename
-
-Filenames are regular [[type:string]]s, pointing to a file.
-There are two types of filenames, relative and absolute:
-! Syntax Description
-| path/to/file A relative file, this is retrieved from the current package.
- i.e. for a filename in a stylesheet, the file is retrieved from that stylesheet.
-| /package/path/to/file An absolute filename includes the name of the package. This is a package somewhere in the MSE data directory.
-
-Don't forget the double quotes (@""@) in scripts.
-
---Dependencies--
-When using an absolute filename to refer to a file from another [[file:package]],
-the [[type:dependency]] on that package must be declared.
-For example,
->include file: /common.mse-include/something
-Will give a warning message, unless the file also lists
->depends on:
-> package: common.mse-include
-> version: 2007-01-01
+Primitve type: filename
+
+Filenames are regular [[type:string]]s, pointing to a file.
+There are two types of filenames, relative and absolute:
+! Syntax Description
+| path/to/file A relative file, this is retrieved from the current package.
+ i.e. for a filename in a stylesheet, the file is retrieved from that stylesheet.
+| /package/path/to/file An absolute filename includes the name of the package. This is a package somewhere in the MSE data directory.
+
+Don't forget the double quotes (@""@) in scripts.
+
+--Dependencies--
+When using an absolute filename to refer to a file from another [[file:package]],
+the [[type:dependency]] on that package must be declared.
+For example,
+>include file: /common.mse-include/something
+Will give a warning message, unless the file also lists
+>depends on:
+> package: common.mse-include
+> version: 2007-01-01
diff --git a/doc/type/font.txt b/doc/type/font.txt
index ea3c24f3..2492d065 100644
--- a/doc/type/font.txt
+++ b/doc/type/font.txt
@@ -1,29 +1,29 @@
-Data type: font
-
---Overview--
-
-A reference to a normal [[type:font]] for drawing text.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:scriptable]] [[type:string]] ''required'' Name of the font as it appears in most text programs.
-| @italic name@ [[type:scriptable]] [[type:string]] Optionally, a different font to use for italic text instead of the normal italic version of the font.
-| @size@ [[type:scriptable]] [[type:double]] ''required'' Size of the font in points on a 96 DPI display.
-| @scale down to@ [[type:double]] ∞ Minimum size in points to scale the size down to.
-| @max stretch@ [[type:double]] @1.0@ Maximum multiplier by which the width of the text is compressed, so @max width: 0.5@ means the text can be compressed to half the normal width.
-| @weight@ [[type:scriptable]] font weight @"normal"@ Weight of the font, one of @"normal"@ or @"bold"@. This can be changed locally by [[type:tagged string|tags]].
-| @style@ [[type:scriptable]] font style @"normal"@ Style of the font, one of @"normal"@ or @"italic"@. This can be changed locally by [[type:tagged string|tags]].
-| @underline@ [[type:scriptable]] [[type:boolean]] @false@ Should the font be underlined?
-| @color@ [[type:scriptable]] [[type:color]] @rgb(0,0,0)@ What color should text be drawn in?
-| @shadow color@ [[type:scriptable]] [[type:color]] @"transparent"@ Color for a shadow below the text.
-| @shadow displacement x@ [[type:double]] @0@ Relative position of the shadow in pixels.
-| @shadow displacement y@ [[type:double]] @0@ ^^^
-| @shadow blur@ [[type:double]] @0@ How much should the shadow be blurred?
-| @separator color@ [[type:color]] @rgba(0,0,0,128)@ Color for @@ tags inserted by the [[fun:combined_editor]] function.
-
---Example--
->font:
-> name: Times new Roman
-> size: 17
-> weight: bold
-> color: rgb(0,0,0)
+Data type: font
+
+--Overview--
+
+A reference to a normal [[type:font]] for drawing text.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:scriptable]] [[type:string]] ''required'' Name of the font as it appears in most text programs.
+| @italic name@ [[type:scriptable]] [[type:string]] Optionally, a different font to use for italic text instead of the normal italic version of the font.
+| @size@ [[type:scriptable]] [[type:double]] ''required'' Size of the font in points on a 96 DPI display.
+| @scale down to@ [[type:double]] ∞ Minimum size in points to scale the size down to.
+| @max stretch@ [[type:double]] @1.0@ Maximum multiplier by which the width of the text is compressed, so @max width: 0.5@ means the text can be compressed to half the normal width.
+| @weight@ [[type:scriptable]] font weight @"normal"@ Weight of the font, one of @"normal"@ or @"bold"@. This can be changed locally by [[type:tagged string|tags]].
+| @style@ [[type:scriptable]] font style @"normal"@ Style of the font, one of @"normal"@ or @"italic"@. This can be changed locally by [[type:tagged string|tags]].
+| @underline@ [[type:scriptable]] [[type:boolean]] @false@ Should the font be underlined?
+| @color@ [[type:scriptable]] [[type:color]] @rgb(0,0,0)@ What color should text be drawn in?
+| @shadow color@ [[type:scriptable]] [[type:color]] @"transparent"@ Color for a shadow below the text.
+| @shadow displacement x@ [[type:double]] @0@ Relative position of the shadow in pixels.
+| @shadow displacement y@ [[type:double]] @0@ ^^^
+| @shadow blur@ [[type:double]] @0@ How much should the shadow be blurred?
+| @separator color@ [[type:color]] @rgba(0,0,0,128)@ Color for @@ tags inserted by the [[fun:combined_editor]] function.
+
+--Example--
+>font:
+> name: Times new Roman
+> size: 17
+> weight: bold
+> color: rgb(0,0,0)
diff --git a/doc/type/function.txt b/doc/type/function.txt
index cabaeea9..9daee8bf 100644
--- a/doc/type/function.txt
+++ b/doc/type/function.txt
@@ -1,20 +1,20 @@
-Primitive type: function
-
---Overview--
-The [[script:index|scripting language]] allows you to define custom functions.
-
---Syntax--
-A piece of code enclosed in curly braces defines a function.
-
-A function can be called using parentheses, for example @function(argument:value)@.
-
---Composition--
-Functions can be composed using the @+@ operator, evaluating @a + b@ first evaluates @a@ and uses its result as @input@ for @b@:
-> example := to_upper + { "result == {input}" }
-> example("xyz") == "result == XYZ"
-
-Multiple functions can be changed together like this, this is especially convenient in combination with [[script:default arguments]].
-
---Example--
-> example := { a + b }
-> example(a: 1, b: 2) == 3
+Primitive type: function
+
+--Overview--
+The [[script:index|scripting language]] allows you to define custom functions.
+
+--Syntax--
+A piece of code enclosed in curly braces defines a function.
+
+A function can be called using parentheses, for example @function(argument:value)@.
+
+--Composition--
+Functions can be composed using the @+@ operator, evaluating @a + b@ first evaluates @a@ and uses its result as @input@ for @b@:
+> example := to_upper + { "result == {input}" }
+> example("xyz") == "result == XYZ"
+
+Multiple functions can be changed together like this, this is especially convenient in combination with [[script:default arguments]].
+
+--Example--
+> example := { a + b }
+> example(a: 1, b: 2) == 3
diff --git a/doc/type/game.txt b/doc/type/game.txt
index ce2d5088..9ae201d8 100644
--- a/doc/type/game.txt
+++ b/doc/type/game.txt
@@ -1,51 +1,51 @@
-File type: Game
-
---Overview--
-
-Games are part of the [[file:style triangle]]:
-| Description Looks Data
-| '''Game''' [[type:Stylesheet]] [[type:Set]]
-| [[type:Field]] [[type:Style]] [[type:Value]]
-
-Games provide the ''description'', i.e. what kinds of things are on a card.
-
---Package format--
-
-A game is described in a [[file:package]] with the .mse-game file extension.
-Such a package contains a [[file:format|data file]] called game that has the following properties.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this game is made for.
-| @short name@ [[type:string]] file name A short name of this game, for the 'new set' list.
-| @full name@ [[type:string]] file name A longer name of this game.
-| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this game, for the 'new set' list.
-| @position hint@ [[type:int]] ∞ Where to place this item in the 'new set' list? Lower numbers come first.
-| @version@ [[type:version]] @0.0.0@ Version number of this package.
-| @depends on@ [[type:list]] of [[type:dependency]]s
- Packages this package depends on.
-
-| '''Specific to games''' <<< <<< <<<
-| @init script@ [[type:script]] @;@ Script to run when this game is loaded,
can set variables
- to be used by other scripts in this game or stylesheets using it.
-| @set fields@ [[type:list]] of [[type:field]]s Fields for the styling panel.
-| @default set style@ [[type:indexmap]] of [[type:style]]s Default style for the set fields, can be overridden by the stylesheet.
-| @card fields@ [[type:list]] of [[type:field]]s Fields for each card.
-| @card list color script@ [[type:script]] from fields Script that determines the color of an item in the card list.
If not set uses the @card list colors@ property of the first card field that has it.
-| @statistics dimensions@ [[type:list]] of [[type:statistics dimension]]s from fields Dimensions for statistics, a dimension is roughly the same as an axis.
By default all card fields with 'show statistics' set to true are used.
-| @statistics categories@ [[type:list]] of [[type:statistics category]]s from dimensions DOC_MSE_VERSION: not used since 0.3.6
- Choices shown on the statistics panel.
By default all statistics dimensions are used.
-| @pack types@ [[type:list]] of [[type:pack type]]s DOC_MSE_VERSION: since 0.3.7
- The types of card packs that will be listed on the random booster panel.
-| @has keywords@ [[type:boolean]] @false@ Does this game use keywords? Should the keywords tab be available?
-| @keyword match script@ [[type:script]] @;@ Script to apply to the @match@ property of keywords.
-| @keyword modes@ [[type:list]] of [[type:keyword mode]]s Choices for the 'mode' property of keywords.
-| @keyword parameter types@ [[type:list]] of [[type:keyword param type]]s Types of parameters available to keywords.
-| @keywords@ [[type:list]] of [[type:keyword]]s Standard keywords for this game.
-| @word lists@ [[type:list]] of [[type:word list]]s Word lists that can be used by text fields.
-| @add cards script@ [[type:list]] of [[type:add cards script]]s DOC_MSE_VERSION: since 0.3.7
- A list of scripts for conveniently adding multiple cards to a set.
-
---Examples--
-Look at the game files in the standard MSE distribution for examples.
+File type: Game
+
+--Overview--
+
+Games are part of the [[file:style triangle]]:
+| Description Looks Data
+| '''Game''' [[type:Stylesheet]] [[type:Set]]
+| [[type:Field]] [[type:Style]] [[type:Value]]
+
+Games provide the ''description'', i.e. what kinds of things are on a card.
+
+--Package format--
+
+A game is described in a [[file:package]] with the .mse-game file extension.
+Such a package contains a [[file:format|data file]] called game that has the following properties.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this game is made for.
+| @short name@ [[type:string]] file name A short name of this game, for the 'new set' list.
+| @full name@ [[type:string]] file name A longer name of this game.
+| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this game, for the 'new set' list.
+| @position hint@ [[type:int]] ∞ Where to place this item in the 'new set' list? Lower numbers come first.
+| @version@ [[type:version]] @0.0.0@ Version number of this package.
+| @depends on@ [[type:list]] of [[type:dependency]]s
+ Packages this package depends on.
+
+| '''Specific to games''' <<< <<< <<<
+| @init script@ [[type:script]] @;@ Script to run when this game is loaded,
can set variables
+ to be used by other scripts in this game or stylesheets using it.
+| @set fields@ [[type:list]] of [[type:field]]s Fields for the styling panel.
+| @default set style@ [[type:indexmap]] of [[type:style]]s Default style for the set fields, can be overridden by the stylesheet.
+| @card fields@ [[type:list]] of [[type:field]]s Fields for each card.
+| @card list color script@ [[type:script]] from fields Script that determines the color of an item in the card list.
If not set uses the @card list colors@ property of the first card field that has it.
+| @statistics dimensions@ [[type:list]] of [[type:statistics dimension]]s from fields Dimensions for statistics, a dimension is roughly the same as an axis.
By default all card fields with 'show statistics' set to true are used.
+| @statistics categories@ [[type:list]] of [[type:statistics category]]s from dimensions DOC_MSE_VERSION: not used since 0.3.6
+ Choices shown on the statistics panel.
By default all statistics dimensions are used.
+| @pack types@ [[type:list]] of [[type:pack type]]s DOC_MSE_VERSION: since 0.3.7
+ The types of card packs that will be listed on the random booster panel.
+| @has keywords@ [[type:boolean]] @false@ Does this game use keywords? Should the keywords tab be available?
+| @keyword match script@ [[type:script]] @;@ Script to apply to the @match@ property of keywords.
+| @keyword modes@ [[type:list]] of [[type:keyword mode]]s Choices for the 'mode' property of keywords.
+| @keyword parameter types@ [[type:list]] of [[type:keyword param type]]s Types of parameters available to keywords.
+| @keywords@ [[type:list]] of [[type:keyword]]s Standard keywords for this game.
+| @word lists@ [[type:list]] of [[type:word list]]s Word lists that can be used by text fields.
+| @add cards script@ [[type:list]] of [[type:add cards script]]s DOC_MSE_VERSION: since 0.3.7
+ A list of scripts for conveniently adding multiple cards to a set.
+
+--Examples--
+Look at the game files in the standard MSE distribution for examples.
diff --git a/doc/type/graph_type.txt b/doc/type/graph_type.txt
index 4994a5f0..a1a4f43e 100644
--- a/doc/type/graph_type.txt
+++ b/doc/type/graph_type.txt
@@ -1,21 +1,21 @@
-Enumeration: graph type
-
-Types of graphs for the statistics panel.
-
---Possible values--
-The value is one of the following options:
-! Value Dimensions Sketch Description
-| @bar@ 1
- One bar for each value on the axis, the height represent the number of cards with that value.
-| @pie@ 1
- A pie graph, the size of the slice represents the numer of cards with a particular value.
-| @stack@ 2
- One bar for each value on the first axis, bars for each value on axis2 are stacked on top of each other.
-| @scatter@ 2
- Scatter plot, the size of the circles corresponds to the number of cards with those two values.
-| @scatter pie@ 3
- Scatter plot, the size of the circles corresponds to the number of cards with those two values.
- Each circle is a small pie graph for the third axis.
-
---Examples--
-> type: bar
+Enumeration: graph type
+
+Types of graphs for the statistics panel.
+
+--Possible values--
+The value is one of the following options:
+! Value Dimensions Sketch Description
+| @bar@ 1
+ One bar for each value on the axis, the height represent the number of cards with that value.
+| @pie@ 1
+ A pie graph, the size of the slice represents the numer of cards with a particular value.
+| @stack@ 2
+ One bar for each value on the first axis, bars for each value on axis2 are stacked on top of each other.
+| @scatter@ 2
+ Scatter plot, the size of the circles corresponds to the number of cards with those two values.
+| @scatter pie@ 3
+ Scatter plot, the size of the circles corresponds to the number of cards with those two values.
+ Each circle is a small pie graph for the third axis.
+
+--Examples--
+> type: bar
diff --git a/doc/type/image.txt b/doc/type/image.txt
index b28eb775..0d3fbf09 100644
--- a/doc/type/image.txt
+++ b/doc/type/image.txt
@@ -1,28 +1,28 @@
-Primitive type: image
-
-Images are generated using scripts.
-
-It is either given using a [[type:filename]] or as the output of a function.
-
---File syntax--
-The syntax for files is similair to that of [[type:scriptable]] properties:
-> image: image.png
-> image: { "image.png" }
-> image: { linear_blend(...) }
-
---Script syntax--
-[[type:Filename]]s are implicitly converted to images as needed.
-
---See also--
-The following functions transform images:
-| [[fun:linear_blend]] Blend two images together using a linear gradient.
-| [[fun:masked_blend]] Blend two images together using a third mask image.
-| [[fun:combine_blend]] Blend two images together using a given [[type:combine|combining mode]].
-| [[fun:set_mask]] Set the transparancy mask of an image.
-| [[fun:set_alpha]] Change the transparency of an image.
-| [[fun:set_combine]] Chnage how the image should be combined with the background.
-| [[fun:enlarge]] Enlarge an image by putting a border around it.
-| [[fun:crop]] Crop an image, giving only a small subset of it.
-| [[fun:drop_shadow]] Add a drop shadow to an image.
-| [[fun:symbol_variation]] Render a variation of a [[type:symbol]].
-| [[fun:built_in_image]] Return an image built into the program.
+Primitive type: image
+
+Images are generated using scripts.
+
+It is either given using a [[type:filename]] or as the output of a function.
+
+--File syntax--
+The syntax for files is similair to that of [[type:scriptable]] properties:
+> image: image.png
+> image: { "image.png" }
+> image: { linear_blend(...) }
+
+--Script syntax--
+[[type:Filename]]s are implicitly converted to images as needed.
+
+--See also--
+The following functions transform images:
+| [[fun:linear_blend]] Blend two images together using a linear gradient.
+| [[fun:masked_blend]] Blend two images together using a third mask image.
+| [[fun:combine_blend]] Blend two images together using a given [[type:combine|combining mode]].
+| [[fun:set_mask]] Set the transparancy mask of an image.
+| [[fun:set_alpha]] Change the transparency of an image.
+| [[fun:set_combine]] Chnage how the image should be combined with the background.
+| [[fun:enlarge]] Enlarge an image by putting a border around it.
+| [[fun:crop]] Crop an image, giving only a small subset of it.
+| [[fun:drop_shadow]] Add a drop shadow to an image.
+| [[fun:symbol_variation]] Render a variation of a [[type:symbol]].
+| [[fun:built_in_image]] Return an image built into the program.
diff --git a/doc/type/include.txt b/doc/type/include.txt
index d8d79f82..00a15541 100644
--- a/doc/type/include.txt
+++ b/doc/type/include.txt
@@ -1,22 +1,22 @@
-File type: Include package
-
---Overview--
-
-An include package contains files used by other packages, for example scripts or images.
-
---Package format--
-An include package is described in a [[file:package]] with the .mse-include file extension.
-It should contain a [[file:format|data file]] called include with the following properties.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this include package is made for.
-| @short name@ [[type:string]] file name A short name of this include package, currently not used.
-| @full name@ [[type:string]] file name A longer name of this include package, currently not used.
-| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this export template, currently not used.
-| @version@ [[type:version]] @0.0.0@ Version number of this package.
-| @depends on@ [[type:list]] of [[type:dependency]]s
- Packages this package depends on.
-
-No additional properties are available.
+File type: Include package
+
+--Overview--
+
+An include package contains files used by other packages, for example scripts or images.
+
+--Package format--
+An include package is described in a [[file:package]] with the .mse-include file extension.
+It should contain a [[file:format|data file]] called include with the following properties.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this include package is made for.
+| @short name@ [[type:string]] file name A short name of this include package, currently not used.
+| @full name@ [[type:string]] file name A longer name of this include package, currently not used.
+| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this export template, currently not used.
+| @version@ [[type:version]] @0.0.0@ Version number of this package.
+| @depends on@ [[type:list]] of [[type:dependency]]s
+ Packages this package depends on.
+
+No additional properties are available.
diff --git a/doc/type/index.txt b/doc/type/index.txt
index 0e94f6ac..02ac89f0 100644
--- a/doc/type/index.txt
+++ b/doc/type/index.txt
@@ -1,69 +1,69 @@
-Data types
-
-Magic Set Editor uses many data types in the files and in scripting.
-There are for instance [[type:card]]s in [[type:set]]s, [[type:stylesheet]]s describing the layout of [[type:field]]s, etc.
-
---File types--
-These are the 'major' data types that are written directly to [[file:package]]s.
-| [[type:Game]] What information is on each card?
-| [[type:Stylesheet]] What do cards look like?
-| [[type:Set]] Sets of cards.
-| [[type:Symbol font]] Fonts consisting of symbols, for instance mana symbols.
-| [[type:Export template]] How to export sets to HTML files?
-| [[type:Locale]] Translations of MSE.
-| [[type:Include]] Files to include in other templates.
-| [[type:Installer]] Installers containing several packages.
-| [[type:Symbol]] Expansion symbols.
-| [[type:Settings]] MSE settings.
-
---Compound types--
-These contain several properties, similair to the file types. But they are part of some other file type.
-| [[type:field]] A field description for cards.
-| [[type:style]] The styling and positioning of a field.
-| [[type:value]] The value in a field, for a particular card.
-| [[type:card]] A card containing values.
-| [[type:keyword]] A keyword.
-| [[type:keyword mode]] A possible mode for keywords.
-| [[type:keyword param type]] A type of parameters for keywords.
-| [[type:statistics dimension]] A dimension for the statistics panel.
-| [[type:statistics category]] A category for the statistics panel.
-| [[type:word list]] A list of words that can be used for a drop down list in text fields.
-| [[type:add cards script]] A script for convienently adding multiple cards to a set.
-| [[type:font]] Description of a font.
-| [[type:symbol part]] Part of a [[type:symbol]].
-| [[type:control point]] A point on in a symbol part.
-
---Collection types--
-| [[type:list]] Lists of items
- * item
- * item
- * item
-| [[type:indexmap]] Lists indexed by field name
- | name: | someone |
- | type: | something |
-| [[type:map]] Lists indexed by other text
-
---Script related--
-| [[type:script]] A script to execute to update a field, or for initialization.
-| [[type:scriptable]] A primitive type whose value can depend on a script.
-| [[type:image]] An image defined by a script.
-| [[type:function]] Functions in scripts. These have no direct representation in a file.
-
---Enumerations--
-| [[type:alignment]] Alignment of text and images.
-| [[type:direction]] Direction of text.
-| [[type:combine]] How to combine images with the background.
-| [[type:symbol combine]] How to combine [[type:symbol part|symbol shapes]] with the background.
-| [[type:graph type]] Type of statistics graphs.
-
---Primitive types--
-| [[type:string]] Text, @"abc"@
-| [[type:tagged string]] Text with tags
-| [[type:filename]] Filenames
-| [[type:regex]] Regular expression strings
-| [[type:boolean]] @true@ or @false@
-| [[type:int]] Integer numbers, @1, 2, 100@
-| [[type:double]] Real numbers, @1, 0.5, 21.3@
-| [[type:version]] Version numbers
-| [[type:color]] Colors
-| [[type:date]] Dates/times
+Data types
+
+Magic Set Editor uses many data types in the files and in scripting.
+There are for instance [[type:card]]s in [[type:set]]s, [[type:stylesheet]]s describing the layout of [[type:field]]s, etc.
+
+--File types--
+These are the 'major' data types that are written directly to [[file:package]]s.
+| [[type:Game]] What information is on each card?
+| [[type:Stylesheet]] What do cards look like?
+| [[type:Set]] Sets of cards.
+| [[type:Symbol font]] Fonts consisting of symbols, for instance mana symbols.
+| [[type:Export template]] How to export sets to HTML files?
+| [[type:Locale]] Translations of MSE.
+| [[type:Include]] Files to include in other templates.
+| [[type:Installer]] Installers containing several packages.
+| [[type:Symbol]] Expansion symbols.
+| [[type:Settings]] MSE settings.
+
+--Compound types--
+These contain several properties, similair to the file types. But they are part of some other file type.
+| [[type:field]] A field description for cards.
+| [[type:style]] The styling and positioning of a field.
+| [[type:value]] The value in a field, for a particular card.
+| [[type:card]] A card containing values.
+| [[type:keyword]] A keyword.
+| [[type:keyword mode]] A possible mode for keywords.
+| [[type:keyword param type]] A type of parameters for keywords.
+| [[type:statistics dimension]] A dimension for the statistics panel.
+| [[type:statistics category]] A category for the statistics panel.
+| [[type:word list]] A list of words that can be used for a drop down list in text fields.
+| [[type:add cards script]] A script for convienently adding multiple cards to a set.
+| [[type:font]] Description of a font.
+| [[type:symbol part]] Part of a [[type:symbol]].
+| [[type:control point]] A point on in a symbol part.
+
+--Collection types--
+| [[type:list]] Lists of items
+ * item
+ * item
+ * item
+| [[type:indexmap]] Lists indexed by field name
+ | name: | someone |
+ | type: | something |
+| [[type:map]] Lists indexed by other text
+
+--Script related--
+| [[type:script]] A script to execute to update a field, or for initialization.
+| [[type:scriptable]] A primitive type whose value can depend on a script.
+| [[type:image]] An image defined by a script.
+| [[type:function]] Functions in scripts. These have no direct representation in a file.
+
+--Enumerations--
+| [[type:alignment]] Alignment of text and images.
+| [[type:direction]] Direction of text.
+| [[type:combine]] How to combine images with the background.
+| [[type:symbol combine]] How to combine [[type:symbol part|symbol shapes]] with the background.
+| [[type:graph type]] Type of statistics graphs.
+
+--Primitive types--
+| [[type:string]] Text, @"abc"@
+| [[type:tagged string]] Text with tags
+| [[type:filename]] Filenames
+| [[type:regex]] Regular expression strings
+| [[type:boolean]] @true@ or @false@
+| [[type:int]] Integer numbers, @1, 2, 100@
+| [[type:double]] Real numbers, @1, 0.5, 21.3@
+| [[type:version]] Version numbers
+| [[type:color]] Colors
+| [[type:date]] Dates/times
diff --git a/doc/type/indexmap.txt b/doc/type/indexmap.txt
index d9a19577..00daf399 100644
--- a/doc/type/indexmap.txt
+++ b/doc/type/indexmap.txt
@@ -1,33 +1,33 @@
-Collection type: field map
-
---Overview--
-
-A 'field map' is a [[type:map]], but indexed by [[type:field]]s.
-
-For instance if a game specifies the fields:
->field:
-> type: text
-> name: field1
->field:
-> type: color
-> name: field2
-
-Then the a field map of ''things'' for those fields would look like:
->field1: thing
->field2: thing
-
-A field map of [[type:style]]s would be:
->field1: # some text style for field1 goes here
->field2: # some color style for field2 goes here
-
-And a field map of [[type:value]]s would be:
->field1: text goes here
->field2: rgb(1,2,3)
-
---Script syntax--
-
-In a script field maps can be accessed like normal [[type:map]]s based on the field name.
-So:
->card.field1 # retrieve the value of field1
->card["field" + 1] # the same thing
->card_style.field2 # retrieve the styling for field2
+Collection type: field map
+
+--Overview--
+
+A 'field map' is a [[type:map]], but indexed by [[type:field]]s.
+
+For instance if a game specifies the fields:
+>field:
+> type: text
+> name: field1
+>field:
+> type: color
+> name: field2
+
+Then the a field map of ''things'' for those fields would look like:
+>field1: thing
+>field2: thing
+
+A field map of [[type:style]]s would be:
+>field1: # some text style for field1 goes here
+>field2: # some color style for field2 goes here
+
+And a field map of [[type:value]]s would be:
+>field1: text goes here
+>field2: rgb(1,2,3)
+
+--Script syntax--
+
+In a script field maps can be accessed like normal [[type:map]]s based on the field name.
+So:
+>card.field1 # retrieve the value of field1
+>card["field" + 1] # the same thing
+>card_style.field2 # retrieve the styling for field2
diff --git a/doc/type/insert_symbol_menu.txt b/doc/type/insert_symbol_menu.txt
index bca4bebf..61f0df5c 100644
--- a/doc/type/insert_symbol_menu.txt
+++ b/doc/type/insert_symbol_menu.txt
@@ -1,44 +1,44 @@
-Data type: "insert symbol" menu.
-
---Overview--
-
-A description of the "Insert symbol" menu for a specific [[type:symbol font]].
-
-The menu consists of a number of entries, either items, separators or submenus.
-
---Properties--
-! Property Type Default Description
-| @type@ One of: @"code"@ or @"submenu"@ What type of menu item is this?
- * @code@, inserts a symbol with the given code.
- * @custom@, pops up a dialog where the user can choose a code to insert.
- * @line@, a separating line.
- * @submenu@, a submenu.
-| @name@ [[type:string]] ''required'' Name of this menu item, corresponding to the code to insert.
-| @items@ [[type:list]] of [[type:insert symbol menu|submenu items]] Items in the submenu, when items are present the @type@ is set to @"submenu"@.
-
-In the user interface the items are shown as @"menu item {name}"@, the [[type:locale]] should be used to give a beter label.
-
-For custom items the dialog will be titled @"title {name}"@ and have message text @"message {name}"@, again this should be changed in the locale.
-
---Examples--
-A menu for magic mana symbols (simplified). Containing all types of items.
->insert symbol menu:
-> item:
-> type: custom
-> name: colorless
-> item:
-> type: line
-> item: W
-> item: U
-> item: B
-> item: R
-> item: G
-> item:
-> type: line
-> item:
-> name: hybrid
-> item: W/U
-> item: U/B
-> item: B/R
-> item: R/G
-> item: G/W
+Data type: "insert symbol" menu.
+
+--Overview--
+
+A description of the "Insert symbol" menu for a specific [[type:symbol font]].
+
+The menu consists of a number of entries, either items, separators or submenus.
+
+--Properties--
+! Property Type Default Description
+| @type@ One of: @"code"@ or @"submenu"@ What type of menu item is this?
+ * @code@, inserts a symbol with the given code.
+ * @custom@, pops up a dialog where the user can choose a code to insert.
+ * @line@, a separating line.
+ * @submenu@, a submenu.
+| @name@ [[type:string]] ''required'' Name of this menu item, corresponding to the code to insert.
+| @items@ [[type:list]] of [[type:insert symbol menu|submenu items]] Items in the submenu, when items are present the @type@ is set to @"submenu"@.
+
+In the user interface the items are shown as @"menu item {name}"@, the [[type:locale]] should be used to give a beter label.
+
+For custom items the dialog will be titled @"title {name}"@ and have message text @"message {name}"@, again this should be changed in the locale.
+
+--Examples--
+A menu for magic mana symbols (simplified). Containing all types of items.
+>insert symbol menu:
+> item:
+> type: custom
+> name: colorless
+> item:
+> type: line
+> item: W
+> item: U
+> item: B
+> item: R
+> item: G
+> item:
+> type: line
+> item:
+> name: hybrid
+> item: W/U
+> item: U/B
+> item: B/R
+> item: R/G
+> item: G/W
diff --git a/doc/type/int.txt b/doc/type/int.txt
index 42d9554f..08dac006 100644
--- a/doc/type/int.txt
+++ b/doc/type/int.txt
@@ -1,14 +1,14 @@
-Primitive type: integer number
-
-Integer numbers are numbers without a decimal point.
-In many cases negative numbers don't make sense, but the program never complains about them.
-
---File syntax--
-> something: 123
-
---Script syntax--
-> 123 + 456 * -1
-
---See also--
-| [[type:double]] Number type that can contain fractional values.
-| [[fun:to_int]] Convert a value to an integer number
+Primitive type: integer number
+
+Integer numbers are numbers without a decimal point.
+In many cases negative numbers don't make sense, but the program never complains about them.
+
+--File syntax--
+> something: 123
+
+--Script syntax--
+> 123 + 456 * -1
+
+--See also--
+| [[type:double]] Number type that can contain fractional values.
+| [[fun:to_int]] Convert a value to an integer number
diff --git a/doc/type/keyword.txt b/doc/type/keyword.txt
index 6489b8fe..d5fa7ed0 100644
--- a/doc/type/keyword.txt
+++ b/doc/type/keyword.txt
@@ -1,27 +1,27 @@
-Data type: keyword
-
---Overview--
-
-A keyword in a [[type:set]] or a [[type:game]].
-
-A keyword is something that matches a piece of text, and optionally some kind of reminder text can be shown.
-
---Properties--
-! Property Type Default Description
-| @keyword@ [[type:string]] ''required'' Name of the keyword.
-| @match@ [[type:string]] ''required'' String to match.
-| @reminder@ [[type:scriptable]] [[type:string]] ''required'' Script to generate the reminder text of this keyword.
-| @rules@ [[type:string]] @""@ Explanation or additional rules for this keyword.
-| @mode@ Name of a [[type:keyword mode]] Mode of this keyword.
-
-The match string can include parameters, @"type"@ where @"type"@ is the name of a [[type:keyword param type|keyword parameter type]] in the game.
-These will match according to the @match@ property of that parameter type.
-
-When expanding the reminder text @param1@ refers to the first parameter in the match string, @param2@ to the second, etc.
-
---Example--
->keyword:
-> keyword: Equip
-> match: Equip cost
-> mode: core
-> reminder: {param1}: Attach to target creature you control. Equip only as a sorcery.
+Data type: keyword
+
+--Overview--
+
+A keyword in a [[type:set]] or a [[type:game]].
+
+A keyword is something that matches a piece of text, and optionally some kind of reminder text can be shown.
+
+--Properties--
+! Property Type Default Description
+| @keyword@ [[type:string]] ''required'' Name of the keyword.
+| @match@ [[type:string]] ''required'' String to match.
+| @reminder@ [[type:scriptable]] [[type:string]] ''required'' Script to generate the reminder text of this keyword.
+| @rules@ [[type:string]] @""@ Explanation or additional rules for this keyword.
+| @mode@ Name of a [[type:keyword mode]] Mode of this keyword.
+
+The match string can include parameters, @"type"@ where @"type"@ is the name of a [[type:keyword param type|keyword parameter type]] in the game.
+These will match according to the @match@ property of that parameter type.
+
+When expanding the reminder text @param1@ refers to the first parameter in the match string, @param2@ to the second, etc.
+
+--Example--
+>keyword:
+> keyword: Equip
+> match: Equip cost
+> mode: core
+> reminder: {param1}: Attach to target creature you control. Equip only as a sorcery.
diff --git a/doc/type/keyword_mode.txt b/doc/type/keyword_mode.txt
index 4bb11288..16064c48 100644
--- a/doc/type/keyword_mode.txt
+++ b/doc/type/keyword_mode.txt
@@ -1,22 +1,22 @@
-Data type: keyword mode
-
---Overview--
-
-A mode for [[type:keyword]]s.
-
-This becomes a choice in the 'mode' box on the keywords panel.
-
-The idea behind modes is that a mode indicates what type of keyword it is, for example an "official" keyword, a "simple" keyword or a "custom" keyword.
-This information can then be used to determine whether to expand the reminder text.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''required'' Name of the mode, this is shown in the box and used in scripts.
-| @description@ [[type:string]] @""@ A description of this mode.
-| @is default@ [[type:boolean]] @false@ Is this the default mode for new keywords?
-
---Example--
->keyword mode:
-> name: custom
-> description: Custom keywords
-> is default: true
+Data type: keyword mode
+
+--Overview--
+
+A mode for [[type:keyword]]s.
+
+This becomes a choice in the 'mode' box on the keywords panel.
+
+The idea behind modes is that a mode indicates what type of keyword it is, for example an "official" keyword, a "simple" keyword or a "custom" keyword.
+This information can then be used to determine whether to expand the reminder text.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''required'' Name of the mode, this is shown in the box and used in scripts.
+| @description@ [[type:string]] @""@ A description of this mode.
+| @is default@ [[type:boolean]] @false@ Is this the default mode for new keywords?
+
+--Example--
+>keyword mode:
+> name: custom
+> description: Custom keywords
+> is default: true
diff --git a/doc/type/keyword_param_reference_script.txt b/doc/type/keyword_param_reference_script.txt
index 59919b87..968b8c34 100644
--- a/doc/type/keyword_param_reference_script.txt
+++ b/doc/type/keyword_param_reference_script.txt
@@ -1,25 +1,25 @@
-Data type: keyword parameter reference script
-
---Overview--
-
-A way to use a [[type:keyword param type|keyword parameter]] in a [[type:keyword]]'s reminder text.
-
-Usually the parameters are included as @"{param1}"@, etc.
-But in some cases for instance a function should be applied, @"{fun(param1)}"@.
-
-To make this easy for the user, a menu of choices is provided, this type describes such a choice.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''required'' Name of the parameter type.
-| @description@ [[type:string]] ''required'' A description of the reference script.
-| @script@ [[type:script]] ''required'' Script that generates the code using the parameter.
- This means you will likely need to do some escaping.
- In the script, @input@ refers to the name of the parameter, for example @"param1"@.
-
---Example--
-Apply the [[fun:english_number]] function to the parameter:
->refer script:
-> name: as words
-> description: (one, two, three)
-> script: \{english_number({input})\}
+Data type: keyword parameter reference script
+
+--Overview--
+
+A way to use a [[type:keyword param type|keyword parameter]] in a [[type:keyword]]'s reminder text.
+
+Usually the parameters are included as @"{param1}"@, etc.
+But in some cases for instance a function should be applied, @"{fun(param1)}"@.
+
+To make this easy for the user, a menu of choices is provided, this type describes such a choice.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''required'' Name of the parameter type.
+| @description@ [[type:string]] ''required'' A description of the reference script.
+| @script@ [[type:script]] ''required'' Script that generates the code using the parameter.
+ This means you will likely need to do some escaping.
+ In the script, @input@ refers to the name of the parameter, for example @"param1"@.
+
+--Example--
+Apply the [[fun:english_number]] function to the parameter:
+>refer script:
+> name: as words
+> description: (one, two, three)
+> script: \{english_number({input})\}
diff --git a/doc/type/keyword_param_type.txt b/doc/type/keyword_param_type.txt
index 52829d7e..fe6ab706 100644
--- a/doc/type/keyword_param_type.txt
+++ b/doc/type/keyword_param_type.txt
@@ -1,40 +1,40 @@
-Data type: keyword parameter type
-
---Overview--
-
-A type of parameter that can be used in a [[type:keyword]].
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''required'' Name of the parameter type.
-| @description@ [[type:string]] ''required'' Description of the parameter type.
-| @placeholder@ [[type:string]] @name@ of this param type Placeholder to use for empty parameters, the name is used if this is empty.
-| @optional@ [[type:boolean]] @true@ Is a placeholder used when a keyword is encountered with no parameter,
for example @"Cycling "@ would become @"Cycling cost"@.
-| @match@ [[type:regex]] ''required'' Regular expression that this param type matches.
-| @separator before is@ [[type:regex]] @""@ Regular expression of separator before parameters of this type.
-| @separator after is@ [[type:regex]] @""@ Regular expression of separator after parameters of this type.
-| @eat separator@ [[type:boolean]] @true@ Allow the user to 'type over' the separator.
- For example if the separator is @" "@ in the keyword @"Cycling"@, and the user types @"Cycling"@,
- a space and a placeholder is automatically inserted, making @"Cycling "@.
- If the user now presses space the cursor is only moved, no additional space is inserted, the space is 'eaten'.
-| @script@ [[type:script]] Script to apply to parameters of this type before substituting them back into the text.
-| @reminder script@ [[type:script]] Script to apply to parameters of this type before using them in the reminder text.
-| @example@ [[type:string]] Example for in the keyword editor, currently not used.
-| @refer scripts@ [[type:list]] of [[type:keyword param reference script]]s
- Scripts for inserting parameters of this type into the reminder text.
- To make this easy for the user, a menu of ways to use a parameter is provided.
-
---Example--
-The 'number' parameter type. It matches a sequence of digits.
-It can be included in the reminder text directly, or by applying some function first.
->keyword parameter type:
-> name: number
-> match: [0-9]+
-> refer script:
-> name: normal
-> description: (1,2,3)
-> script: \{{input}\}
-> refer script:
-> name: as words
-> description: (one, two, three)
-> script: \{english_number({input})\}
+Data type: keyword parameter type
+
+--Overview--
+
+A type of parameter that can be used in a [[type:keyword]].
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''required'' Name of the parameter type.
+| @description@ [[type:string]] ''required'' Description of the parameter type.
+| @placeholder@ [[type:string]] @name@ of this param type Placeholder to use for empty parameters, the name is used if this is empty.
+| @optional@ [[type:boolean]] @true@ Is a placeholder used when a keyword is encountered with no parameter,
for example @"Cycling "@ would become @"Cycling cost"@.
+| @match@ [[type:regex]] ''required'' Regular expression that this param type matches.
+| @separator before is@ [[type:regex]] @""@ Regular expression of separator before parameters of this type.
+| @separator after is@ [[type:regex]] @""@ Regular expression of separator after parameters of this type.
+| @eat separator@ [[type:boolean]] @true@ Allow the user to 'type over' the separator.
+ For example if the separator is @" "@ in the keyword @"Cycling"@, and the user types @"Cycling"@,
+ a space and a placeholder is automatically inserted, making @"Cycling "@.
+ If the user now presses space the cursor is only moved, no additional space is inserted, the space is 'eaten'.
+| @script@ [[type:script]] Script to apply to parameters of this type before substituting them back into the text.
+| @reminder script@ [[type:script]] Script to apply to parameters of this type before using them in the reminder text.
+| @example@ [[type:string]] Example for in the keyword editor, currently not used.
+| @refer scripts@ [[type:list]] of [[type:keyword param reference script]]s
+ Scripts for inserting parameters of this type into the reminder text.
+ To make this easy for the user, a menu of ways to use a parameter is provided.
+
+--Example--
+The 'number' parameter type. It matches a sequence of digits.
+It can be included in the reminder text directly, or by applying some function first.
+>keyword parameter type:
+> name: number
+> match: [0-9]+
+> refer script:
+> name: normal
+> description: (1,2,3)
+> script: \{{input}\}
+> refer script:
+> name: as words
+> description: (one, two, three)
+> script: \{english_number({input})\}
diff --git a/doc/type/list.txt b/doc/type/list.txt
index addf7c94..613c96e6 100644
--- a/doc/type/list.txt
+++ b/doc/type/list.txt
@@ -1,35 +1,35 @@
-Collection type: List
-
---File syntax--
-In files a list is represented as multiple keys, one for each element.
-The keys are all in the singular for of the name of the list,
-if the list is named for instance @symbols@ each key will be named @symbol@.
->symbol:
-> # first symbol here
->symbol:
-> # second symbol here
-># etc.
-
---Script syntax--
-In a script lists can be declared using square brackets.
-> [] # An empty list
-> [1] # A list with a single element, the value 1
-> [1,2] # A list with two elements
-
-Lists can be accessed using either the bracket operator, or the dot operator.
-The first element of a list is numbered 0, the next 1, etc.
-> list.0 # The first element of the list 'list'
-> list[0] # The same thing
-> list[0+0] # The same thing
-
-It is possible to iterate over lists using the @for each@ construct:
-> for each x in [1,2,3] do "x = {x}. "
-evaluates to:
-> "x = 1. x = 2. x = 3. "
-
---Functions--
-There are several functions for working with lists:
-| [[fun:position]] Find the position of an element in a list
-| [[fun:number_of_items]] Return the number of items in a list
-| [[fun:sort_list]] Sort a list
-| [[fun:filter_list]] Filter a list, keeping only elements that match a predicate
+Collection type: List
+
+--File syntax--
+In files a list is represented as multiple keys, one for each element.
+The keys are all in the singular for of the name of the list,
+if the list is named for instance @symbols@ each key will be named @symbol@.
+>symbol:
+> # first symbol here
+>symbol:
+> # second symbol here
+># etc.
+
+--Script syntax--
+In a script lists can be declared using square brackets.
+> [] # An empty list
+> [1] # A list with a single element, the value 1
+> [1,2] # A list with two elements
+
+Lists can be accessed using either the bracket operator, or the dot operator.
+The first element of a list is numbered 0, the next 1, etc.
+> list.0 # The first element of the list 'list'
+> list[0] # The same thing
+> list[0+0] # The same thing
+
+It is possible to iterate over lists using the @for each@ construct:
+> for each x in [1,2,3] do "x = {x}. "
+evaluates to:
+> "x = 1. x = 2. x = 3. "
+
+--Functions--
+There are several functions for working with lists:
+| [[fun:position]] Find the position of an element in a list
+| [[fun:number_of_items]] Return the number of items in a list
+| [[fun:sort_list]] Sort a list
+| [[fun:filter_list]] Filter a list, keeping only elements that match a predicate
diff --git a/doc/type/locale.txt b/doc/type/locale.txt
index e4378330..d74dc264 100644
--- a/doc/type/locale.txt
+++ b/doc/type/locale.txt
@@ -1,62 +1,62 @@
-File type: Locale
-
---Overview--
-
-A locale gives a translation of the user interface of the program.
-
---Package format--
-
-A locale is described in a [[file:package]] with the .mse-locale file extension.
-Such a package contains a data file called locale that has the following properties.
-There are usually no other files in the package.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this locale is made for.
-| @short name@ [[type:string]] file name A short name of this locale, for the options dialog.
-| @full name@ [[type:string]] file name A longer name of this locale.
-| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this locale, currently not used.
-| @version@ [[type:version]] @0.0.0@ Version number of this package.
-
-| '''Specific to locales''' <<< <<< <<<
-| @menu@ [[type:map]] of [[type:string]]s Translations of menu items.
- Menu items can contain shortcut keys (like Ctrl+C for copy) by using a ''single'' TAB between the text and the shortcut key.
- Keys to use with Alt+Something (displayed underlined) can be specified &
- For example
- >>>new set: &New... Ctrl+N
-| @help@ [[type:map]] of [[type:string]]s Translations of help texts for the status bar.
-| @tool@ [[type:map]] of [[type:string]]s Translations of toolbar item texts.
-| @tooltip@ [[type:map]] of [[type:string]]s Translations of tooltips for toolbar items.
-| @label@ [[type:map]] of [[type:string]]s Labels of controls in the GUI.
-| @button@ [[type:map]] of [[type:string]]s Labels of buttons in the GUI.
-| @title@ [[type:map]] of [[type:string]]s Titles of windows.
-| @action@ [[type:map]] of [[type:string]]s Names of actions for undo/redo, things like "typing" and "add card".
-| @error@ [[type:map]] of [[type:string]]s Error messages.
-| @type@ [[type:map]] of [[type:string]]s Types of objects for error messages.
-| @game@ [[type:map]] of [[type:map]] of [[type:string]]s
- Translations for specific [[type:game]]s.
- Field names and field descriptions are looked up in the locale, if they are found the translation is used, otherwise the value from the game file.
- Extra keys not present in the English locale can be added here.
-| @stylesheet@ [[type:map]] of [[type:map]] of [[type:string]]s
- Translations for specific [[type:stylesheet]]s.
-| @symbol font@ [[type:map]] of [[type:map]] of [[type:string]]s
- Translations for specific [[type:symbol font]]s, in particular the "insert symbol" menu.
-
-Some of the items can contain placeholders for other values, for example:
-> undo: &Undo%s Ctrl+Z
-The @%s@ is replaced by the name of the action to undo.
-This @%s@ should be used in exactly those entries that also contain it in the English locale.
-
---Examples--
-Look at the @"en.mse-locale"@ file in the standard MSE distribution for an example.
-
---Translating MSE--
-To translate the MSE user interface:
-* Create a copy of the @"en.mse-locale"@ directory, name it @"**.mse-locale"@, where @"**"@ is a two or three letter [[http://en.wikipedia.org/wiki/ISO_language_code|ISO language code]].
-* Open the @"locale"@ file with Notepad (or another program that supports UTF-8), and translate the strings.
-* Add new keys for game, stylesheet or symbol font specific keys as described above.
-* Save the file, select the new locale from Edit->Preferences.
-* Restart MSE, and make sure everything looks right.
-* Submit the new locale to the [[http://magicseteditor.sourceforge.net/forum/7|MSE forum].
-* Maintain the locale when new versions of MSE come out. A new version may have new user interface items and therefore new keys.
+File type: Locale
+
+--Overview--
+
+A locale gives a translation of the user interface of the program.
+
+--Package format--
+
+A locale is described in a [[file:package]] with the .mse-locale file extension.
+Such a package contains a data file called locale that has the following properties.
+There are usually no other files in the package.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this locale is made for.
+| @short name@ [[type:string]] file name A short name of this locale, for the options dialog.
+| @full name@ [[type:string]] file name A longer name of this locale.
+| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this locale, currently not used.
+| @version@ [[type:version]] @0.0.0@ Version number of this package.
+
+| '''Specific to locales''' <<< <<< <<<
+| @menu@ [[type:map]] of [[type:string]]s Translations of menu items.
+ Menu items can contain shortcut keys (like Ctrl+C for copy) by using a ''single'' TAB between the text and the shortcut key.
+ Keys to use with Alt+Something (displayed underlined) can be specified &
+ For example
+ >>>new set: &New... Ctrl+N
+| @help@ [[type:map]] of [[type:string]]s Translations of help texts for the status bar.
+| @tool@ [[type:map]] of [[type:string]]s Translations of toolbar item texts.
+| @tooltip@ [[type:map]] of [[type:string]]s Translations of tooltips for toolbar items.
+| @label@ [[type:map]] of [[type:string]]s Labels of controls in the GUI.
+| @button@ [[type:map]] of [[type:string]]s Labels of buttons in the GUI.
+| @title@ [[type:map]] of [[type:string]]s Titles of windows.
+| @action@ [[type:map]] of [[type:string]]s Names of actions for undo/redo, things like "typing" and "add card".
+| @error@ [[type:map]] of [[type:string]]s Error messages.
+| @type@ [[type:map]] of [[type:string]]s Types of objects for error messages.
+| @game@ [[type:map]] of [[type:map]] of [[type:string]]s
+ Translations for specific [[type:game]]s.
+ Field names and field descriptions are looked up in the locale, if they are found the translation is used, otherwise the value from the game file.
+ Extra keys not present in the English locale can be added here.
+| @stylesheet@ [[type:map]] of [[type:map]] of [[type:string]]s
+ Translations for specific [[type:stylesheet]]s.
+| @symbol font@ [[type:map]] of [[type:map]] of [[type:string]]s
+ Translations for specific [[type:symbol font]]s, in particular the "insert symbol" menu.
+
+Some of the items can contain placeholders for other values, for example:
+> undo: &Undo%s Ctrl+Z
+The @%s@ is replaced by the name of the action to undo.
+This @%s@ should be used in exactly those entries that also contain it in the English locale.
+
+--Examples--
+Look at the @"en.mse-locale"@ file in the standard MSE distribution for an example.
+
+--Translating MSE--
+To translate the MSE user interface:
+* Create a copy of the @"en.mse-locale"@ directory, name it @"**.mse-locale"@, where @"**"@ is a two or three letter [[http://en.wikipedia.org/wiki/ISO_language_code|ISO language code]].
+* Open the @"locale"@ file with Notepad (or another program that supports UTF-8), and translate the strings.
+* Add new keys for game, stylesheet or symbol font specific keys as described above.
+* Save the file, select the new locale from Edit->Preferences.
+* Restart MSE, and make sure everything looks right.
+* Submit the new locale to the [[http://magicseteditor.sourceforge.net/forum/7|MSE forum].
+* Maintain the locale when new versions of MSE come out. A new version may have new user interface items and therefore new keys.
diff --git a/doc/type/map.txt b/doc/type/map.txt
index 9dca952d..e104aef2 100644
--- a/doc/type/map.txt
+++ b/doc/type/map.txt
@@ -1,26 +1,26 @@
-Collection type: Map
-
-A map is like a [[type:list]] with [[type:string]] keys.
-
---File syntax--
-In files a map is represented as key/value pairs.
-For instance a map of [[type:color]]s could be:
->some map:
-> red: rgb(255,0,0)
-> green: rgb(0,255,0)
-> blue: rgb(0,0,255)
-
---Script syntax--
-In a script maps can be declared using square brackets.
-> [] # An empty map
-> [key:1] # A map with a single element, the value 1 under the key "key"
-> [red:rgb(255,0,0), green:rgb(0,255,0)] # A map with two elements
-
-Like lists, maps can be accessed using either the bracket operator, or the dot operator.
-> map.key # The elment named "key"
-> map["k"+"ey"] # The same thing
-
-It is possible to iterate over the values maps using the @for@ construct:
-> for each x in [one: 1, two: 2] do "x = {x}. "
-evaluates to:
-> "x = 1. x = 2. "
+Collection type: Map
+
+A map is like a [[type:list]] with [[type:string]] keys.
+
+--File syntax--
+In files a map is represented as key/value pairs.
+For instance a map of [[type:color]]s could be:
+>some map:
+> red: rgb(255,0,0)
+> green: rgb(0,255,0)
+> blue: rgb(0,0,255)
+
+--Script syntax--
+In a script maps can be declared using square brackets.
+> [] # An empty map
+> [key:1] # A map with a single element, the value 1 under the key "key"
+> [red:rgb(255,0,0), green:rgb(0,255,0)] # A map with two elements
+
+Like lists, maps can be accessed using either the bracket operator, or the dot operator.
+> map.key # The elment named "key"
+> map["k"+"ey"] # The same thing
+
+It is possible to iterate over the values maps using the @for@ construct:
+> for each x in [one: 1, two: 2] do "x = {x}. "
+evaluates to:
+> "x = 1. x = 2. "
diff --git a/doc/type/pack_item.txt b/doc/type/pack_item.txt
index f4b8291d..ccbfcb4e 100644
--- a/doc/type/pack_item.txt
+++ b/doc/type/pack_item.txt
@@ -1,25 +1,25 @@
-Data type: card pack item
-
-DOC_MSE_VERSION: since 0.3.8
-
---Overview--
-
-A reference to another [[type:pack type]], from which one or more cards are chosen.
-
---Properties--
-! Property Type Default Description
-| @name@ Name of a [[type:pack item]] ''required'' Name of the pack item to include in this pack.
-| @amount@ [[type:scriptable]] [[type:int]] 1 How many of those cards are in the pack?
-| @weight@ [[type:scriptable]] [[type:double]] 1 How 'important' is this item?
- Items with a higher weight will be chosen more often.
- Cards from @filter@ will have a weight of 1.
-
---Examples--
->item:
-> name: common
-> amount: 11
-
-Include 11 commons in this [[type:pack type|pack]].
-
->item: common
-Short form. Include a single common in this pack.
+Data type: card pack item
+
+DOC_MSE_VERSION: since 0.3.8
+
+--Overview--
+
+A reference to another [[type:pack type]], from which one or more cards are chosen.
+
+--Properties--
+! Property Type Default Description
+| @name@ Name of a [[type:pack item]] ''required'' Name of the pack item to include in this pack.
+| @amount@ [[type:scriptable]] [[type:int]] 1 How many of those cards are in the pack?
+| @weight@ [[type:scriptable]] [[type:double]] 1 How 'important' is this item?
+ Items with a higher weight will be chosen more often.
+ Cards from @filter@ will have a weight of 1.
+
+--Examples--
+>item:
+> name: common
+> amount: 11
+
+Include 11 commons in this [[type:pack type|pack]].
+
+>item: common
+Short form. Include a single common in this pack.
diff --git a/doc/type/pack_type.txt b/doc/type/pack_type.txt
index 27e4d328..6c6d94f5 100644
--- a/doc/type/pack_type.txt
+++ b/doc/type/pack_type.txt
@@ -1,109 +1,109 @@
-Data type: card pack type
-
-DOC_MSE_VERSION: since 0.3.8
-
---Overview--
-
-A type of card packs. For instance "booster" and "tournament pack" are card pack types.
-
-A pack type contains either:
-* a filter for selecting the desired kind of cards from the set.
-* one or more [[type:pack item]]s, indicating what kinds and how many cards are in the pack.
-* a combination of the above.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] Name of this card pack type.
- Other pack types can refer to this name.
-| @select@ see below see below How are instances of this pack generated?
-| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this pack type enabled, i.e. can the user select it?
-| @selectable@ [[type:boolean]] @true@ Is this pack selectable from the list of packs in the user interface?
-| @summary@ [[type:boolean]] @true@ Is a summary of the total number of cards shown in the second panel in the user interface?
- Note: this only applies to pack types that have the @filter@ property set.
-| @filter@ [[type:script]] ''optional'' Condition that a card must satisfy to be included in this pack type.
-| @items@ [[type:list]] of [[type:pack item]]s The items to include in this pack.
-
---Selection--
-
-The @select@ property specifies how instances of this pack are generated.
-When the user selects that he wants 3 copies of pack X, then MSE will generate three ''instances'' of that pack.
-How that happens depends on the @select@ property:
-
-! @select@ Description
-| @all@ Each instance of this pack type contains all of the filtered cards and @items@.
- In general, @select: all@ is used for the selectable pack types, while other @select@ types are used for the rest of the packs.
- This is the default for pack types with @items@.
-| @replace@ Each instance of this pack type contains a single card or @item@, chosen at random with replacement.
- The probability of picking an item is proportional to its @weight@, all filtered cards have weight 1.
-| @no replace@ Each instance of this pack type contains a single card or @item@, chosen at random without replacement.
- This means that the same card or item will not be chosen twice (if the set is large enough).
- This is the default for pack types with a @filter@.
-| @proportional@ Each instance of this pack type contains a single filtered card or @item@, chosen with probability proportional to the number of choices for the card/item.
- The choice is made with replacement.
-| @nonempty@ Each instance of this pack type contains a single filtered card or @item@,
- but items that contain no cards will be ignored.
- The choice is made with replacement.
-| @equal@ Instead of choosing cards and items at random, they are chosen to make their numbers as equal as possible.
-| @equal proportional@ A combination of @equal@ and @proportional@.
-| @equal nonempty@ A combination of @equal@ and @nonempty@.
-| @first@ If there are any cards, the first is always chosen, otherwise the first ''nonempty'' item is used.
- @select: first@ can be used to make a kind of if statement: "If there are any X cards then use those, otherwise use Y cards".
-
---Examples--
->pack item:
-> name: rare
-> select: no replace # this is optional, 'no replace' is the default
-> filter: card.rarity == "rare"
-
-Rare cards are those with the rarity value of @"rare"@.
-The cards are chosen without replacement, so in a single pack the same rare will not occur twice.
-
->pack item:
-> name: basic land
-> select: equal
-> filter: card.rarity == "basic land"
-
-Basic land cards are selected in equal amounts:
-Say a set contains two basic lands: "Good Land" and "Bad Land".
-Then if 6 basic lands are selected, there will always be exactly 3 "Good Lands" and 3 "Bad Lands".
-If an odd number of basic lands are selected then the amounts will be as close as possible to being equal.
-
-
->pack type:
-> name: booster pack
-> select: all # this is optional, 'all' is the default
-> item:
-> name: rare
-> amount: 1
-> item:
-> name: uncommon
-> amount: 3
-> item:
-> name: common
-> amount: 11
-
-A Magic booster pack contains 1 rare, 3 uncommons and 11 commons.
-
->pack type:
-> name: special or else common
-> select: first
-> item: special
-> item: common
-
-If there are any special cards in the set, then "special or else common" will be a special card, otherwise it will be a common.
-
->pack type:
-> name: rare or mythic rare
-> select: proportional
-> item:
-> name: rare
-> weight: 2
-> item:
-> name: mythic rare
-> weight: 1
-
-In Magic, individual "mythic rares" are twice as rare as normal rare cards.
-Since there are also less mythic rares, this does not mean that each booster pack has a 33% percent chance of containing a mythic rare.
-Instead the probability of a mythic rare is
-@number_of_mythics / (number_of_rares * 2 + number_of_mythics)@.
-So, for example if there are 20 rares in a set and only 5 mythic rares, then one in 9 "rare or mythic rare" cards will be a mythic rare.
+Data type: card pack type
+
+DOC_MSE_VERSION: since 0.3.8
+
+--Overview--
+
+A type of card packs. For instance "booster" and "tournament pack" are card pack types.
+
+A pack type contains either:
+* a filter for selecting the desired kind of cards from the set.
+* one or more [[type:pack item]]s, indicating what kinds and how many cards are in the pack.
+* a combination of the above.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] Name of this card pack type.
+ Other pack types can refer to this name.
+| @select@ see below see below How are instances of this pack generated?
+| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this pack type enabled, i.e. can the user select it?
+| @selectable@ [[type:boolean]] @true@ Is this pack selectable from the list of packs in the user interface?
+| @summary@ [[type:boolean]] @true@ Is a summary of the total number of cards shown in the second panel in the user interface?
+ Note: this only applies to pack types that have the @filter@ property set.
+| @filter@ [[type:script]] ''optional'' Condition that a card must satisfy to be included in this pack type.
+| @items@ [[type:list]] of [[type:pack item]]s The items to include in this pack.
+
+--Selection--
+
+The @select@ property specifies how instances of this pack are generated.
+When the user selects that he wants 3 copies of pack X, then MSE will generate three ''instances'' of that pack.
+How that happens depends on the @select@ property:
+
+! @select@ Description
+| @all@ Each instance of this pack type contains all of the filtered cards and @items@.
+ In general, @select: all@ is used for the selectable pack types, while other @select@ types are used for the rest of the packs.
+ This is the default for pack types with @items@.
+| @replace@ Each instance of this pack type contains a single card or @item@, chosen at random with replacement.
+ The probability of picking an item is proportional to its @weight@, all filtered cards have weight 1.
+| @no replace@ Each instance of this pack type contains a single card or @item@, chosen at random without replacement.
+ This means that the same card or item will not be chosen twice (if the set is large enough).
+ This is the default for pack types with a @filter@.
+| @proportional@ Each instance of this pack type contains a single filtered card or @item@, chosen with probability proportional to the number of choices for the card/item.
+ The choice is made with replacement.
+| @nonempty@ Each instance of this pack type contains a single filtered card or @item@,
+ but items that contain no cards will be ignored.
+ The choice is made with replacement.
+| @equal@ Instead of choosing cards and items at random, they are chosen to make their numbers as equal as possible.
+| @equal proportional@ A combination of @equal@ and @proportional@.
+| @equal nonempty@ A combination of @equal@ and @nonempty@.
+| @first@ If there are any cards, the first is always chosen, otherwise the first ''nonempty'' item is used.
+ @select: first@ can be used to make a kind of if statement: "If there are any X cards then use those, otherwise use Y cards".
+
+--Examples--
+>pack item:
+> name: rare
+> select: no replace # this is optional, 'no replace' is the default
+> filter: card.rarity == "rare"
+
+Rare cards are those with the rarity value of @"rare"@.
+The cards are chosen without replacement, so in a single pack the same rare will not occur twice.
+
+>pack item:
+> name: basic land
+> select: equal
+> filter: card.rarity == "basic land"
+
+Basic land cards are selected in equal amounts:
+Say a set contains two basic lands: "Good Land" and "Bad Land".
+Then if 6 basic lands are selected, there will always be exactly 3 "Good Lands" and 3 "Bad Lands".
+If an odd number of basic lands are selected then the amounts will be as close as possible to being equal.
+
+
+>pack type:
+> name: booster pack
+> select: all # this is optional, 'all' is the default
+> item:
+> name: rare
+> amount: 1
+> item:
+> name: uncommon
+> amount: 3
+> item:
+> name: common
+> amount: 11
+
+A Magic booster pack contains 1 rare, 3 uncommons and 11 commons.
+
+>pack type:
+> name: special or else common
+> select: first
+> item: special
+> item: common
+
+If there are any special cards in the set, then "special or else common" will be a special card, otherwise it will be a common.
+
+>pack type:
+> name: rare or mythic rare
+> select: proportional
+> item:
+> name: rare
+> weight: 2
+> item:
+> name: mythic rare
+> weight: 1
+
+In Magic, individual "mythic rares" are twice as rare as normal rare cards.
+Since there are also less mythic rares, this does not mean that each booster pack has a 33% percent chance of containing a mythic rare.
+Instead the probability of a mythic rare is
+@number_of_mythics / (number_of_rares * 2 + number_of_mythics)@.
+So, for example if there are 20 rares in a set and only 5 mythic rares, then one in 9 "rare or mythic rare" cards will be a mythic rare.
diff --git a/doc/type/regex.txt b/doc/type/regex.txt
index f9d1ca81..22854fe7 100644
--- a/doc/type/regex.txt
+++ b/doc/type/regex.txt
@@ -1,10 +1,10 @@
-Primitive type: regular expression
-
-Regular expressions (regexes) are things that can match parts of [[type:string]]s.
-
-Regexes are represented by normal [[type:string]]s.
-Note that to escape something in a regex the backslash is used, in script code this also needs to be escaped.
-For example, in a script, the regex matching a single backslash is @"\\\\"@.
-
-For more information, see
-[[http://www.wxwidgets.org/manuals/stable/wx_wxresyn.html|the wxWidgets regular expression documentation]].
+Primitive type: regular expression
+
+Regular expressions (regexes) are things that can match parts of [[type:string]]s.
+
+Regexes are represented by normal [[type:string]]s.
+Note that to escape something in a regex the backslash is used, in script code this also needs to be escaped.
+For example, in a script, the regex matching a single backslash is @"\\\\"@.
+
+For more information, see
+[[http://www.wxwidgets.org/manuals/stable/wx_wxresyn.html|the wxWidgets regular expression documentation]].
diff --git a/doc/type/script.txt b/doc/type/script.txt
index 171605a5..5fc231a6 100644
--- a/doc/type/script.txt
+++ b/doc/type/script.txt
@@ -1,19 +1,19 @@
-Data type: script
-
---Overview--
-
-A script object is a piece of code written in the [[script:index|MSE scripting language]].
-
---File syntax--
-
-A script is given in the same way as a [[type:string]].
-
---Example--
-A simple [[type:field]] script that converts everything to upper case:
->script: to_upper(value)
-
-A larger script, changes @"y"@s to @"x"@s and @"a"@s to @"b"@s:
->script:
-> new_value := replace(value, match: "x", replace: "y")
-> new_value := replace(value, match: "a", replace: "b")
-> new_value
+Data type: script
+
+--Overview--
+
+A script object is a piece of code written in the [[script:index|MSE scripting language]].
+
+--File syntax--
+
+A script is given in the same way as a [[type:string]].
+
+--Example--
+A simple [[type:field]] script that converts everything to upper case:
+>script: to_upper(value)
+
+A larger script, changes @"y"@s to @"x"@s and @"a"@s to @"b"@s:
+>script:
+> new_value := replace(value, match: "x", replace: "y")
+> new_value := replace(value, match: "a", replace: "b")
+> new_value
diff --git a/doc/type/scriptable.txt b/doc/type/scriptable.txt
index b0f4e973..79efedd2 100644
--- a/doc/type/scriptable.txt
+++ b/doc/type/scriptable.txt
@@ -1,34 +1,34 @@
-Data type: scriptable
-
---Overview--
-
-Many [[type:style]] properties are ''scriptable''; their value can be changed by a script.
-
-Consider for example:
->left: 123
-This defines that the left coordinate of a field is 123 pixels.
-To script this you can write:
->left: { if card.name == "" then 100 else 123 }
-Now the left position depends on whether or not the name is empty.
-
---File syntax--
-A 'scriptable something' can take three forms:
-# It can be a regular 'something'
- >something: 123
-# It can be a script that produces 'something', enclosed in curly braces:
- >something: {100 + 23}
-# It can be a script that produces 'something', indented and preceded by @script:@:
- >something:
- > script: 100 + 23
-
-Note: To use a multiline script the following does not work:
->something: { 100 +
-> 23 }
-If the script has multiple lines, it must start on a new line, and be indented with a TAB:
->something:
-> { 100 +
-> 23 }
-or
->something:
-> script: 100 +
-> 23
+Data type: scriptable
+
+--Overview--
+
+Many [[type:style]] properties are ''scriptable''; their value can be changed by a script.
+
+Consider for example:
+>left: 123
+This defines that the left coordinate of a field is 123 pixels.
+To script this you can write:
+>left: { if card.name == "" then 100 else 123 }
+Now the left position depends on whether or not the name is empty.
+
+--File syntax--
+A 'scriptable something' can take three forms:
+# It can be a regular 'something'
+ >something: 123
+# It can be a script that produces 'something', enclosed in curly braces:
+ >something: {100 + 23}
+# It can be a script that produces 'something', indented and preceded by @script:@:
+ >something:
+ > script: 100 + 23
+
+Note: To use a multiline script the following does not work:
+>something: { 100 +
+> 23 }
+If the script has multiple lines, it must start on a new line, and be indented with a TAB:
+>something:
+> { 100 +
+> 23 }
+or
+>something:
+> script: 100 +
+> 23
diff --git a/doc/type/set.txt b/doc/type/set.txt
index bbf9e0f2..c5ccf49b 100644
--- a/doc/type/set.txt
+++ b/doc/type/set.txt
@@ -1,64 +1,64 @@
-File type: Set
-
---Overview--
-
-Sets are part of the [[file:style triangle]]:
-| Description Looks Data
-| [[type:Game]] [[type:Stylesheet]] '''Set'''
-| [[type:Field]] [[type:Style]] [[type:Value]]
-
---Package format--
-A set is described in a [[file:package]] with the .mse-set file extension,
-such a package contains a data file called set.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this set is made with.
-| @short name@ [[type:string]] file name Name of this set.
-| @depends on@ [[type:list]] of [[type:dependency]]s
- Packages this package depends on.
-
-| '''Specific to sets''' <<< <<< <<<
-| @game@ Name of a [[type:game]] ''required'' The game this set is made for.
-| @stylesheet@ Name of a [[type:stylesheet]] ''required'' The default style for drawing cards in this set.
- This is without the game name or extension, so @"new"@ refers to the package @"gamename-new.mse-style"@.
-| @set info@ [[type:indexmap]] of [[type:value]]s The data for the [[prop:game:set fields]] defined in the game.
-| @styling@ [[type:map]] of [[type:indexmap]]s of [[type:value]]s
- Data for the 'extra fields' of the stylesheet.
- This is first indexed by stylesheet name, then by field name.
- Data is given not only for the set's stylesheet but also for those of cards.
-| @cards@ [[type:list] of [[type:card]]s The cards in the set.
-| @keywords@ [[type:list] of [[type:keyword]]s The custom keywords in the set.
-| @pack types@ [[type:list]] of [[type:pack type]]s DOC_MSE_VERSION: since 0.3.8
- The custom card pack types in the set.
-
---Example--
-
-If the game looks like:
->mse version: 0.3.4
->name: my game
->set field:
-> name: copyright
-> type: text
->card field:
-> name: card name
-> type: text
->card field:
-> name: power
-> type: text
-The the a set file would looks like:
->mse version: 0.3.4
->game: my game
->name: my set
->set info:
-> copyright: something
->extra set info:
-> name of style:
-> name of field: something
->card:
-> card name: first card
-> power: 100
->card:
-> card name: second card
-> power: 50
+File type: Set
+
+--Overview--
+
+Sets are part of the [[file:style triangle]]:
+| Description Looks Data
+| [[type:Game]] [[type:Stylesheet]] '''Set'''
+| [[type:Field]] [[type:Style]] [[type:Value]]
+
+--Package format--
+A set is described in a [[file:package]] with the .mse-set file extension,
+such a package contains a data file called set.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this set is made with.
+| @short name@ [[type:string]] file name Name of this set.
+| @depends on@ [[type:list]] of [[type:dependency]]s
+ Packages this package depends on.
+
+| '''Specific to sets''' <<< <<< <<<
+| @game@ Name of a [[type:game]] ''required'' The game this set is made for.
+| @stylesheet@ Name of a [[type:stylesheet]] ''required'' The default style for drawing cards in this set.
+ This is without the game name or extension, so @"new"@ refers to the package @"gamename-new.mse-style"@.
+| @set info@ [[type:indexmap]] of [[type:value]]s The data for the [[prop:game:set fields]] defined in the game.
+| @styling@ [[type:map]] of [[type:indexmap]]s of [[type:value]]s
+ Data for the 'extra fields' of the stylesheet.
+ This is first indexed by stylesheet name, then by field name.
+ Data is given not only for the set's stylesheet but also for those of cards.
+| @cards@ [[type:list] of [[type:card]]s The cards in the set.
+| @keywords@ [[type:list] of [[type:keyword]]s The custom keywords in the set.
+| @pack types@ [[type:list]] of [[type:pack type]]s DOC_MSE_VERSION: since 0.3.8
+ The custom card pack types in the set.
+
+--Example--
+
+If the game looks like:
+>mse version: 0.3.4
+>name: my game
+>set field:
+> name: copyright
+> type: text
+>card field:
+> name: card name
+> type: text
+>card field:
+> name: power
+> type: text
+The the a set file would looks like:
+>mse version: 0.3.4
+>game: my game
+>name: my set
+>set info:
+> copyright: something
+>extra set info:
+> name of style:
+> name of field: something
+>card:
+> card name: first card
+> power: 100
+>card:
+> card name: second card
+> power: 50
diff --git a/doc/type/settings.txt b/doc/type/settings.txt
index 87a7850b..2c79a538 100644
--- a/doc/type/settings.txt
+++ b/doc/type/settings.txt
@@ -1,13 +1,13 @@
-File type: Settings
-
---Overview--
-
-The MSE settings are stored in a separate file.
-
---Location--
-
-On Windows XP the settings are located in:
-> "C:\Documents and Settings\Application Data\Magic Set Editor\mse8.config"
-
---Properties--
-See the settings file for the properties.
+File type: Settings
+
+--Overview--
+
+The MSE settings are stored in a separate file.
+
+--Location--
+
+On Windows XP the settings are located in:
+> "C:\Documents and Settings\Application Data\Magic Set Editor\mse8.config"
+
+--Properties--
+See the settings file for the properties.
diff --git a/doc/type/statistics_category.txt b/doc/type/statistics_category.txt
index 619f95c5..4b5e3d16 100644
--- a/doc/type/statistics_category.txt
+++ b/doc/type/statistics_category.txt
@@ -1,29 +1,29 @@
-Data type: statistics category
-
-DOC_MSE_VERSION: not used since 0.3.6
-
---Overview--
-
-A category in the statistics panel.
-This is a single choice in the list on the left of that panel.
-
-Statistics dimensions are automatically generated for all [[type:statistics dimension]]s a [[type:game]].
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''required'' Name of this category.
-| @description@ [[type:string]] @""@ A description of the category, currently not used.
-| @position hint@ [[type:string]] @0@ Hint for ordering category, lower numbers are at the top of the list.
-| @icon@ [[type:filename]] Filename of an icon for this category, the image should be 21x21 pixels.
-| @type@ [[type:graph type]] @"bar"@ Type of graph to use.
-| @dimensions@ [[type:list]] of names of [[type:statistics dimension]]s
- Dimensions for the axes of the graph.
- The number of dimensions must be the same as that needed for the [[type:graph type]].
-
---Example--
-A graph with power on the horizontal axis, toughness on the vertical axis:
->statistics category:
-> name: power/toughness
-> type: scatter
-> dimension: power
-> dimension: toughness
+Data type: statistics category
+
+DOC_MSE_VERSION: not used since 0.3.6
+
+--Overview--
+
+A category in the statistics panel.
+This is a single choice in the list on the left of that panel.
+
+Statistics dimensions are automatically generated for all [[type:statistics dimension]]s a [[type:game]].
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''required'' Name of this category.
+| @description@ [[type:string]] @""@ A description of the category, currently not used.
+| @position hint@ [[type:string]] @0@ Hint for ordering category, lower numbers are at the top of the list.
+| @icon@ [[type:filename]] Filename of an icon for this category, the image should be 21x21 pixels.
+| @type@ [[type:graph type]] @"bar"@ Type of graph to use.
+| @dimensions@ [[type:list]] of names of [[type:statistics dimension]]s
+ Dimensions for the axes of the graph.
+ The number of dimensions must be the same as that needed for the [[type:graph type]].
+
+--Example--
+A graph with power on the horizontal axis, toughness on the vertical axis:
+>statistics category:
+> name: power/toughness
+> type: scatter
+> dimension: power
+> dimension: toughness
diff --git a/doc/type/statistics_dimension.txt b/doc/type/statistics_dimension.txt
index ae6f800c..e244d8a1 100644
--- a/doc/type/statistics_dimension.txt
+++ b/doc/type/statistics_dimension.txt
@@ -1,48 +1,48 @@
-Data type: statistics dimension
-
---Overview--
-
-A dimension or axis for the statistics panel.
-
-One or more dimensions are combined in a graph, these combinations are called [[type:statistics category]]s.
-
-Statistics dimensions are automatically generated for all card fields in a [[type:game]] that don't set @show statistics@ to @false@.
-
-Categories are also automatically generated from dimensions.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''required'' Name of this dimension, used as an axis label and a label for automatically generated categories.
-| @description@ [[type:string]] @""@ A description of the dimension, currently not used.
-| @position hint@ [[type:string]] @0@ Hint for ordering dimensions.
-| @icon@ [[type:filename]] Filename of an icon for this dimension.
-| @script@ [[type:script]] ''required'' Script that generates a value for each card in the set.
-| @numeric@ [[type:boolean]] @false@ Is the value always a number?
-| @bin size@ [[type:double]] ''none'' For numeric dimensions: group numbers together into bins this large.
- For example with @bin size: 5@, values @1@ and @3@ both get put under @"1-5"@.
-| @show empty@ [[type:boolean]] @false@ Should cards with the value @""@ be included?
-| @split list@ [[type:boolean]] @false@ Indicates the value is a list of the form @"item1, item2"@. The card is put under both items.
-| @colors@ [[type:map]] of opaque [[type:color]]s Colors to use for specific values
-| @groups@ [[type:list]] of [[type:string]]s Values to always show, and the order to show them in.
-
---Example--
-Automatically generated statistics dimensions look like this:
->statistics dimension:
-> name: power
-> script: card.power
-
-Specify a specific order and color of values, otherwise they are ordered alphabeticaly and groups with no cards are not shown:
->statistics dimension:
-> name: color
-> script: card.color
-> group: white
-> group: blue
-> group: black
-> group: red
-> group: green
-> colors:
-> white: rgb(255,255,255)
-> blue: rgb(0,0,255)
-> black: rgb(0,0,0)
-> red: rgb(255,0,0)
-> green: rgb(0,255,0)
+Data type: statistics dimension
+
+--Overview--
+
+A dimension or axis for the statistics panel.
+
+One or more dimensions are combined in a graph, these combinations are called [[type:statistics category]]s.
+
+Statistics dimensions are automatically generated for all card fields in a [[type:game]] that don't set @show statistics@ to @false@.
+
+Categories are also automatically generated from dimensions.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''required'' Name of this dimension, used as an axis label and a label for automatically generated categories.
+| @description@ [[type:string]] @""@ A description of the dimension, currently not used.
+| @position hint@ [[type:string]] @0@ Hint for ordering dimensions.
+| @icon@ [[type:filename]] Filename of an icon for this dimension.
+| @script@ [[type:script]] ''required'' Script that generates a value for each card in the set.
+| @numeric@ [[type:boolean]] @false@ Is the value always a number?
+| @bin size@ [[type:double]] ''none'' For numeric dimensions: group numbers together into bins this large.
+ For example with @bin size: 5@, values @1@ and @3@ both get put under @"1-5"@.
+| @show empty@ [[type:boolean]] @false@ Should cards with the value @""@ be included?
+| @split list@ [[type:boolean]] @false@ Indicates the value is a list of the form @"item1, item2"@. The card is put under both items.
+| @colors@ [[type:map]] of opaque [[type:color]]s Colors to use for specific values
+| @groups@ [[type:list]] of [[type:string]]s Values to always show, and the order to show them in.
+
+--Example--
+Automatically generated statistics dimensions look like this:
+>statistics dimension:
+> name: power
+> script: card.power
+
+Specify a specific order and color of values, otherwise they are ordered alphabeticaly and groups with no cards are not shown:
+>statistics dimension:
+> name: color
+> script: card.color
+> group: white
+> group: blue
+> group: black
+> group: red
+> group: green
+> colors:
+> white: rgb(255,255,255)
+> blue: rgb(0,0,255)
+> black: rgb(0,0,0)
+> red: rgb(255,0,0)
+> green: rgb(0,255,0)
diff --git a/doc/type/string.txt b/doc/type/string.txt
index 52bce929..dd238539 100644
--- a/doc/type/string.txt
+++ b/doc/type/string.txt
@@ -1,41 +1,41 @@
-Primitive type: character string
-
-A string is just a piece of text.
-
---File syntax--
-In files, strings are written just as their value:
-> string: this is some string
-The whitespace at the beginning is removed by the program.
-Multiline strings are written on a new line, indented by a TAB:
-> string:
-> This is a very long string
-> It contains a line break.
-
---Script syntax--
-In scripts, strings are written between double quotes, @"this is a string"@.
-The backslash character is used to escape values:
-! Code Represents
-| @\"@ A " character
-| @\{@ A { character
-| @\n@ A newline character (line break)
-| @\\@ A backslash
-| @\<@ An escaped < for [[type:tagged string]]s.
-
-Sections between curly braces are interpreted as script code, that is concatentated with the string, for example
-> "ab{1 + 1}c" == "ab2c"
-This can be nested arbitrarily.
-
-The @+@ operator concatenates strings. Numbers and most other values are automatically converted to strings when needed. This conversion can be forced with the [[fun:to_string]] function.
-
-Using the @[]@ or @.@ operator characters in a string can be selected. 0 is the first character:
-> "xyz"[0] == "x"
-> "xyz".0 == "x" # same thing
-> "xyz".1 == "y"
-> "xyz".2 == "z"
-It is an error to select characters outside the string
-> "xyz".10 # error
-
---See also--
-| [[type:tagged string]] A string containg tags.
-| [[fun:to_string]] Convert any value to a [[type:string]]
-
+Primitive type: character string
+
+A string is just a piece of text.
+
+--File syntax--
+In files, strings are written just as their value:
+> string: this is some string
+The whitespace at the beginning is removed by the program.
+Multiline strings are written on a new line, indented by a TAB:
+> string:
+> This is a very long string
+> It contains a line break.
+
+--Script syntax--
+In scripts, strings are written between double quotes, @"this is a string"@.
+The backslash character is used to escape values:
+! Code Represents
+| @\"@ A " character
+| @\{@ A { character
+| @\n@ A newline character (line break)
+| @\\@ A backslash
+| @\<@ An escaped < for [[type:tagged string]]s.
+
+Sections between curly braces are interpreted as script code, that is concatentated with the string, for example
+> "ab{1 + 1}c" == "ab2c"
+This can be nested arbitrarily.
+
+The @+@ operator concatenates strings. Numbers and most other values are automatically converted to strings when needed. This conversion can be forced with the [[fun:to_string]] function.
+
+Using the @[]@ or @.@ operator characters in a string can be selected. 0 is the first character:
+> "xyz"[0] == "x"
+> "xyz".0 == "x" # same thing
+> "xyz".1 == "y"
+> "xyz".2 == "z"
+It is an error to select characters outside the string
+> "xyz".10 # error
+
+--See also--
+| [[type:tagged string]] A string containg tags.
+| [[fun:to_string]] Convert any value to a [[type:string]]
+
diff --git a/doc/type/style.txt b/doc/type/style.txt
index a622ba94..57b6662b 100644
--- a/doc/type/style.txt
+++ b/doc/type/style.txt
@@ -1,167 +1,167 @@
-Data type: style
-
---Overview--
-
-A style specifies how a [[type:field]] should look,
-things like position, size, fonts, colors, etc.
-
-Styles are part of the [[file:style triangle]]:
-| Description Looks Data
-| [[type:Game]] [[type:Stylesheet]] [[type:Set]]
-| [[type:Field]] '''Style''' [[type:Value]]
-
---Positioning--
-
-
-A style specifies the position of a box for the content.
-To specify the horizontal location ''two'' of @left@, @width@ and @right@ must be specified.
-
-For example:
-> left: 10
-> width: 20
-Implies that @right@ is 30 pixels.
-
-Similarly:
-> left: 10
-> right: 30
-Implies the @width@ is 20.
-
-The same holds for the vertical location and size; @top@, @height@ and @bottom@.
-
---Rotation--
-Rotating a box can be done with the @angle@ property.
-The angle gives a counter clockwise rotation in degrees of the box.
-The box is rotated such that the corner for which the position is specified is at the correct position after rotating.
-
-Here are some examples:
-
-|
- >red box:
- > width: 30
- > height: 25
- > left: 10
- > top: 20
- > angle: 30
-
- >green box:
- > width: 25
- > height: 30
- > left: 10
- > top: 80
- > angle: 90
-
- >blue box:
- > width: 30
- > height: 25
- > right: 90
- > bottom: 30
- > angle: 30
-
- >yellow box:
- > width: 20
- > height: 35
- > right: 60
- > bottom: 60
- > angle: 180
-
-
---Properties--
-! Property Type Default Description
-| @z index@ [[type:int]] @0@ Stacking of this box, fields with a higher @z index@ are placed on top of those with a lower index.
-| @tab index@ [[type:int]] @0@ Index for moving through the fields with the tab key, fields with a lower tab index come first. Otherwise the order is from top to bottom and then left to right.
-| @left@ [[type:scriptable]] [[type:double]] ''Required'' Distance between left edge of the box and the left of the card in pixels.
-| @width@ [[type:scriptable]] [[type:double]] ''Required'' Width of the box in pixels.
-| @right@ [[type:scriptable]] [[type:double]] ''Required'' Distance between right edge of the box and the ''left'' of the card in pixels.
-| @top@ [[type:scriptable]] [[type:double]] ''Required'' Distance between top edge of the box and the top of the card in pixels.
-| @height@ [[type:scriptable]] [[type:double]] ''Required'' Height of the box in pixels.
-| @bottom@ [[type:scriptable]] [[type:double]] ''Required'' Distance between bottom edge of the box and the ''top'' of the card in pixels.
-| @angle@ [[type:scriptable]] [[type:int]] @0@ Rotation of this box, in degrees counter clockwise.
-| @visible@ [[type:scriptable]] [[type:boolean]] @true@ Is this field visible at all?
-| @mask@ [[type:image|scriptable image]] ''none'' A mask to apply to the box, black areas in the mask become transparent, similar to [[fun:set_mask]].
-
-The rest of the properties depend on the type of [[type:field]] this style is for.
-! Type Property Type Default Description
-| @"text"@ @font@ [[type:font]] ''Required'' Font to render the text.
-| ^^^ @symbol font@ [[type:symbol font]] Font to render symbols in the text (optional).
-| ^^^ @always symbol@ [[type:boolean]] @false@ Should all text be rendered with symbols?
- Text that is not supported by the symbol font is still rendered as normal text.
-| ^^^ @allow formating@ [[type:boolean]] @true@ Is custom formating (bold, italic) allowed?
-| ^^^ @alignment@ [[type:scriptable]] [[type:alignment]] @top left@ Alignment of the text.
-| ^^^ @direction@ [[type:direction]] @"left to right"@ Direction in which the text flows. If set to @"vertical"@ it is as if a line break is inserted after each character.
-| ^^^ @padding left@ [[type:scriptable]] [[type:double]] @0@ Padding between the text and the border of the box, in pixels.
-| ^^^ @padding right@ ^^^ ^^^ ^^^
-| ^^^ @padding top@ ^^^ ^^^ ^^^
-| ^^^ @padding bottom@ ^^^ ^^^ ^^^
-| ^^^ @padding left min@ [[type:scriptable]] [[type:double]] ∞ Minimal padding around the field.
When the text is scaled down the padding is scaled as well, but it becomes no smaller than this.
-| ^^^ @padding right min@ ^^^ ^^^ ^^^
-| ^^^ @padding top min@ ^^^ ^^^ ^^^
-| ^^^ @padding bottom min@ ^^^ ^^^ ^^^
-| ^^^ @line height soft@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by wrapping around lines that are too long.
- A line height of @0@ means all lines are in the same position, @1@ is normal behaviour, @2@ skips a line, etc.
-| ^^^ @line height hard@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'hard' line breaks. These are breaks caused by the enter key.
-| ^^^ @line height line@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by @"\n"@ tags.
-| ^^^ @line height soft max@ [[type:scriptable]] [[type:double]] ''disabled'' When there is still vertical room in the text box, increase the line heights to at most these values to spread the text more evenly.
-| ^^^ @line height hard max@ ^^^ ^^^ ^^^
-| ^^^ @line height line max@ ^^^ ^^^ ^^^
-| ^^^ @paragraph height@ [[type:double]] ''flexible'' The height of paragraphs. If specified, each paragraph is given this much space, and aligned inside that space as specified by @alignment@.
- A paragraph break is any line break that is not soft (i.e. caused by word wrap or a @@ break).
-| ^^^ @mask@ [[type:image|scriptable image]] ''none'' A mask that indicates where in the box text can be placed.
- Text is never put in black areas of the box:
- 
- The same mask image is also used to determine the size and shape of the box.
- To include a certain pixel in the size/shape but not allow text to be placed there, it can be made dark gray (a value less than 128).
-| ^^^ @content width@ [[type:double]] ''automatic'' When read from a script, gives the width of the current content in this box.
-| ^^^ @content height@ [[type:double]] ''automatic'' When read from a script, gives the height of the current content in this box.
-| ^^^ @content lines@ [[type:int]] ''automatic'' When read from a script, gives the number of lines of the current content in this box.
-
-! <<< <<< <<< <<<
-| @"choice"@,
@"multiple choice"@,
@"boolean"@
- @popup style@ @"drop down"@ or @"in place"@ @"drop down"@ Where to place the drop down box for editing the value.
- @"drop down"@ places the box below the field, similar to normal combo boxes.
- @"in place"@ places the box at the mouse coordinates.
-| ^^^ @render style@ [[type:choice render style]] @"text"@ How should the field be rendered?
-| ^^^ @combine@ [[type:combine]] @"normal"@ How to combine the image with the background? Can be overridden using the [[fun:set_combine]] function.
-| ^^^ @alignment@ [[type:alignment]] @"stretch"@ Alignment of text and images in the box.
-| ^^^ @font@ [[type:font]] Font to use for rendering text (depending on @render style@)
-| ^^^ @image@ [[type:image|scriptable image]] Image to show (depending on @render style@).
- The script will be called with @input@ set to the value to determine an image for.
-| ^^^ @choice images@ [[type:map]] of [[type:image]]s An alternative way to specify what image to show.
- For each [[type:choice]] a separate image is specified.
-| ^^^ @content width@ [[type:double]] ''automatic'' When read from a script, gives the width of the current choice image in this box.
- This is only useful when the alignment is changed, otherwise it is always equal the box size itself.
-| ^^^ @content height@ [[type:double]] ''automatic'' When read from a script, gives the height of the current choice image in this box.
-| @"multiple choice"@
- @direction@ [[type:scriptable]] [[type:direction]] @"left to right"@ Direction the items are laid out in, only when @render style@ is @list@.
-| ^^^ @spacing@ [[type:scriptable]] [[type:double]] @0@ Spacing between the items.
-
-! <<< <<< <<< <<<
-| @"package choice"@
-| ^^^ @font@ [[type:font]] Font to use for rendering text.
-
-! <<< <<< <<< <<<
-| @"color"@ @radius@ [[type:double]] @0@ Radius of rounded corners for the box in pixels.
-| ^^^ @left width@ [[type:double]] ∞ Draw only this many pixels from the side, creating a box with a hole in it, or a card border.
-| ^^^ @right width@ ^^^ ^^^ ^^^
-| ^^^ @top width@ ^^^ ^^^ ^^^
-| ^^^ @bottom width@ ^^^ ^^^ ^^^
-| ^^^ @combine@ [[type:combine]] @"normal"@ How to combine the color with the background? Only applies when a mask is used.
-
-! <<< <<< <<< <<<
-| @"image"@ @default@ [[type:image|scriptable image]] ''none'' A default image to use when the card has none.
-
-! <<< <<< <<< <<<
-| @"symbol"@ @variations@ [[type:list]] of [[type:symbol variation]]s Available variations of the symbol, a variation describes color and border size.
-| ^^^ @min aspect ratio@ [[type:double]] @1@ Bounds for the aspect ratio, @width/height@ symbols can take. This can be used to make non-square symbols.
-| ^^^ @max aspect ratio@ [[type:double]] @1@ ^^^
-
-! <<< <<< <<< <<<
-| @"info"@ @font@ [[type:font]] ''Required'' Font to render the text.
-| ^^^ @alignment@ [[type:scriptable]] [[type:alignment]] @top left@ Alignment of the text.
-| ^^^ @padding left@ [[type:double]] @0@ Padding between the text and the border of the box, in pixels.
-| ^^^ @padding right@ ^^^ ^^^ ^^^
-| ^^^ @padding top@ ^^^ ^^^ ^^^
-| ^^^ @padding bottom@ ^^^ ^^^ ^^^
-| ^^^ @background color@ opaque [[type:color]] @rgb(255,255,255)@ Background color for the box, can be used to make it stand out.
-
---Example--
-
+Data type: style
+
+--Overview--
+
+A style specifies how a [[type:field]] should look,
+things like position, size, fonts, colors, etc.
+
+Styles are part of the [[file:style triangle]]:
+| Description Looks Data
+| [[type:Game]] [[type:Stylesheet]] [[type:Set]]
+| [[type:Field]] '''Style''' [[type:Value]]
+
+--Positioning--
+
+
+A style specifies the position of a box for the content.
+To specify the horizontal location ''two'' of @left@, @width@ and @right@ must be specified.
+
+For example:
+> left: 10
+> width: 20
+Implies that @right@ is 30 pixels.
+
+Similarly:
+> left: 10
+> right: 30
+Implies the @width@ is 20.
+
+The same holds for the vertical location and size; @top@, @height@ and @bottom@.
+
+--Rotation--
+Rotating a box can be done with the @angle@ property.
+The angle gives a counter clockwise rotation in degrees of the box.
+The box is rotated such that the corner for which the position is specified is at the correct position after rotating.
+
+Here are some examples:
+
+|
+ >red box:
+ > width: 30
+ > height: 25
+ > left: 10
+ > top: 20
+ > angle: 30
+
+ >green box:
+ > width: 25
+ > height: 30
+ > left: 10
+ > top: 80
+ > angle: 90
+
+ >blue box:
+ > width: 30
+ > height: 25
+ > right: 90
+ > bottom: 30
+ > angle: 30
+
+ >yellow box:
+ > width: 20
+ > height: 35
+ > right: 60
+ > bottom: 60
+ > angle: 180
+
+
+--Properties--
+! Property Type Default Description
+| @z index@ [[type:int]] @0@ Stacking of this box, fields with a higher @z index@ are placed on top of those with a lower index.
+| @tab index@ [[type:int]] @0@ Index for moving through the fields with the tab key, fields with a lower tab index come first. Otherwise the order is from top to bottom and then left to right.
+| @left@ [[type:scriptable]] [[type:double]] ''Required'' Distance between left edge of the box and the left of the card in pixels.
+| @width@ [[type:scriptable]] [[type:double]] ''Required'' Width of the box in pixels.
+| @right@ [[type:scriptable]] [[type:double]] ''Required'' Distance between right edge of the box and the ''left'' of the card in pixels.
+| @top@ [[type:scriptable]] [[type:double]] ''Required'' Distance between top edge of the box and the top of the card in pixels.
+| @height@ [[type:scriptable]] [[type:double]] ''Required'' Height of the box in pixels.
+| @bottom@ [[type:scriptable]] [[type:double]] ''Required'' Distance between bottom edge of the box and the ''top'' of the card in pixels.
+| @angle@ [[type:scriptable]] [[type:int]] @0@ Rotation of this box, in degrees counter clockwise.
+| @visible@ [[type:scriptable]] [[type:boolean]] @true@ Is this field visible at all?
+| @mask@ [[type:image|scriptable image]] ''none'' A mask to apply to the box, black areas in the mask become transparent, similar to [[fun:set_mask]].
+
+The rest of the properties depend on the type of [[type:field]] this style is for.
+! Type Property Type Default Description
+| @"text"@ @font@ [[type:font]] ''Required'' Font to render the text.
+| ^^^ @symbol font@ [[type:symbol font]] Font to render symbols in the text (optional).
+| ^^^ @always symbol@ [[type:boolean]] @false@ Should all text be rendered with symbols?
+ Text that is not supported by the symbol font is still rendered as normal text.
+| ^^^ @allow formating@ [[type:boolean]] @true@ Is custom formating (bold, italic) allowed?
+| ^^^ @alignment@ [[type:scriptable]] [[type:alignment]] @top left@ Alignment of the text.
+| ^^^ @direction@ [[type:direction]] @"left to right"@ Direction in which the text flows. If set to @"vertical"@ it is as if a line break is inserted after each character.
+| ^^^ @padding left@ [[type:scriptable]] [[type:double]] @0@ Padding between the text and the border of the box, in pixels.
+| ^^^ @padding right@ ^^^ ^^^ ^^^
+| ^^^ @padding top@ ^^^ ^^^ ^^^
+| ^^^ @padding bottom@ ^^^ ^^^ ^^^
+| ^^^ @padding left min@ [[type:scriptable]] [[type:double]] ∞ Minimal padding around the field.
When the text is scaled down the padding is scaled as well, but it becomes no smaller than this.
+| ^^^ @padding right min@ ^^^ ^^^ ^^^
+| ^^^ @padding top min@ ^^^ ^^^ ^^^
+| ^^^ @padding bottom min@ ^^^ ^^^ ^^^
+| ^^^ @line height soft@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by wrapping around lines that are too long.
+ A line height of @0@ means all lines are in the same position, @1@ is normal behaviour, @2@ skips a line, etc.
+| ^^^ @line height hard@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'hard' line breaks. These are breaks caused by the enter key.
+| ^^^ @line height line@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by @"\n"@ tags.
+| ^^^ @line height soft max@ [[type:scriptable]] [[type:double]] ''disabled'' When there is still vertical room in the text box, increase the line heights to at most these values to spread the text more evenly.
+| ^^^ @line height hard max@ ^^^ ^^^ ^^^
+| ^^^ @line height line max@ ^^^ ^^^ ^^^
+| ^^^ @paragraph height@ [[type:double]] ''flexible'' The height of paragraphs. If specified, each paragraph is given this much space, and aligned inside that space as specified by @alignment@.
+ A paragraph break is any line break that is not soft (i.e. caused by word wrap or a @@ break).
+| ^^^ @mask@ [[type:image|scriptable image]] ''none'' A mask that indicates where in the box text can be placed.
+ Text is never put in black areas of the box:
+ 
+ The same mask image is also used to determine the size and shape of the box.
+ To include a certain pixel in the size/shape but not allow text to be placed there, it can be made dark gray (a value less than 128).
+| ^^^ @content width@ [[type:double]] ''automatic'' When read from a script, gives the width of the current content in this box.
+| ^^^ @content height@ [[type:double]] ''automatic'' When read from a script, gives the height of the current content in this box.
+| ^^^ @content lines@ [[type:int]] ''automatic'' When read from a script, gives the number of lines of the current content in this box.
+
+! <<< <<< <<< <<<
+| @"choice"@,
@"multiple choice"@,
@"boolean"@
+ @popup style@ @"drop down"@ or @"in place"@ @"drop down"@ Where to place the drop down box for editing the value.
+ @"drop down"@ places the box below the field, similar to normal combo boxes.
+ @"in place"@ places the box at the mouse coordinates.
+| ^^^ @render style@ [[type:choice render style]] @"text"@ How should the field be rendered?
+| ^^^ @combine@ [[type:combine]] @"normal"@ How to combine the image with the background? Can be overridden using the [[fun:set_combine]] function.
+| ^^^ @alignment@ [[type:alignment]] @"stretch"@ Alignment of text and images in the box.
+| ^^^ @font@ [[type:font]] Font to use for rendering text (depending on @render style@)
+| ^^^ @image@ [[type:image|scriptable image]] Image to show (depending on @render style@).
+ The script will be called with @input@ set to the value to determine an image for.
+| ^^^ @choice images@ [[type:map]] of [[type:image]]s An alternative way to specify what image to show.
+ For each [[type:choice]] a separate image is specified.
+| ^^^ @content width@ [[type:double]] ''automatic'' When read from a script, gives the width of the current choice image in this box.
+ This is only useful when the alignment is changed, otherwise it is always equal the box size itself.
+| ^^^ @content height@ [[type:double]] ''automatic'' When read from a script, gives the height of the current choice image in this box.
+| @"multiple choice"@
+ @direction@ [[type:scriptable]] [[type:direction]] @"left to right"@ Direction the items are laid out in, only when @render style@ is @list@.
+| ^^^ @spacing@ [[type:scriptable]] [[type:double]] @0@ Spacing between the items.
+
+! <<< <<< <<< <<<
+| @"package choice"@
+| ^^^ @font@ [[type:font]] Font to use for rendering text.
+
+! <<< <<< <<< <<<
+| @"color"@ @radius@ [[type:double]] @0@ Radius of rounded corners for the box in pixels.
+| ^^^ @left width@ [[type:double]] ∞ Draw only this many pixels from the side, creating a box with a hole in it, or a card border.
+| ^^^ @right width@ ^^^ ^^^ ^^^
+| ^^^ @top width@ ^^^ ^^^ ^^^
+| ^^^ @bottom width@ ^^^ ^^^ ^^^
+| ^^^ @combine@ [[type:combine]] @"normal"@ How to combine the color with the background? Only applies when a mask is used.
+
+! <<< <<< <<< <<<
+| @"image"@ @default@ [[type:image|scriptable image]] ''none'' A default image to use when the card has none.
+
+! <<< <<< <<< <<<
+| @"symbol"@ @variations@ [[type:list]] of [[type:symbol variation]]s Available variations of the symbol, a variation describes color and border size.
+| ^^^ @min aspect ratio@ [[type:double]] @1@ Bounds for the aspect ratio, @width/height@ symbols can take. This can be used to make non-square symbols.
+| ^^^ @max aspect ratio@ [[type:double]] @1@ ^^^
+
+! <<< <<< <<< <<<
+| @"info"@ @font@ [[type:font]] ''Required'' Font to render the text.
+| ^^^ @alignment@ [[type:scriptable]] [[type:alignment]] @top left@ Alignment of the text.
+| ^^^ @padding left@ [[type:double]] @0@ Padding between the text and the border of the box, in pixels.
+| ^^^ @padding right@ ^^^ ^^^ ^^^
+| ^^^ @padding top@ ^^^ ^^^ ^^^
+| ^^^ @padding bottom@ ^^^ ^^^ ^^^
+| ^^^ @background color@ opaque [[type:color]] @rgb(255,255,255)@ Background color for the box, can be used to make it stand out.
+
+--Example--
+
diff --git a/doc/type/stylesheet.txt b/doc/type/stylesheet.txt
index 07c3f614..ed0a6b96 100644
--- a/doc/type/stylesheet.txt
+++ b/doc/type/stylesheet.txt
@@ -1,42 +1,42 @@
-File type: Stylesheet
-
---Overview--
-
-Stylesheets are part of the [[file:style triangle]]:
-| Description Looks Data
-| [[type:Game]] '''Stylesheet''' [[type:Set]]
-| [[type:Field]] [[type:Style]] [[type:Value]]
-
-Stylesheets provide the ''look and feel'' of cards.
-
---Package format--
-A stylesheet is described in a [[file:package]] with the .mse-style file extension,
-such a package contains a data file called style.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this stylesheet is made for.
-| @short name@ [[type:string]] file name A short name of this stylesheet, for the 'new set' and style panel lists.
-| @full name@ [[type:string]] file name A longer name of this stylesheet.
-| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this stylesheet, for the 'new set' and style panel lists.
-| @position hint@ [[type:int]] ∞ Where to place this item in the list? Lower numbers come first.
-| @version@ [[type:version]] @0.0.0@ Version number of this package.
-| @depends on@ [[type:list]] of [[type:dependency]]s
- Packages this package depends on.
-
-| '''Specific to stylesheets''' <<< <<< <<<
-| @game@ Name of a [[type:game]] ''required'' Game this stylesheet is made for
-| @card width@ [[type:double]] 100 Width of cards in pixels
-| @card height@ [[type:double]] 100 Height of cards in pixels
-| @card dpi@ [[type:double]] 96 Resolution of cards in dots-per-inch
-| @card background@ [[type:color]] white Background color of cards
-| @init script@ [[type:script]] @;@ Script to run when this stylesheet is loaded, after the game's init script.
-| @styling fields@ [[type:list]] of [[type:field]]s Fields for styling options, shown on the 'style' panel.
-| @styling style@ [[type:indexmap]] of [[type:style]]s Styles for the styling fields.
-| @set info style@ [[type:indexmap]] of [[type:style]]s game.default_set_style Styling for the 'set info' panel
-| @card style@ [[type:indexmap]] of [[type:style]]s Styles for the card fields defined in the game
-| @extra card fields@ [[type:list]] of [[type:field]]s Additional fields to add to each card.
- These fields are intended for things like lines and boxes, whose value is determined automatically.
-| @extra card style@ [[type:indexmap] of [[type:style]]s Styling for the extra card fields
-
+File type: Stylesheet
+
+--Overview--
+
+Stylesheets are part of the [[file:style triangle]]:
+| Description Looks Data
+| [[type:Game]] '''Stylesheet''' [[type:Set]]
+| [[type:Field]] [[type:Style]] [[type:Value]]
+
+Stylesheets provide the ''look and feel'' of cards.
+
+--Package format--
+A stylesheet is described in a [[file:package]] with the .mse-style file extension,
+such a package contains a data file called style.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this stylesheet is made for.
+| @short name@ [[type:string]] file name A short name of this stylesheet, for the 'new set' and style panel lists.
+| @full name@ [[type:string]] file name A longer name of this stylesheet.
+| @icon@ [[type:filename]] ''none'' Filename of an icon / preview for this stylesheet, for the 'new set' and style panel lists.
+| @position hint@ [[type:int]] ∞ Where to place this item in the list? Lower numbers come first.
+| @version@ [[type:version]] @0.0.0@ Version number of this package.
+| @depends on@ [[type:list]] of [[type:dependency]]s
+ Packages this package depends on.
+
+| '''Specific to stylesheets''' <<< <<< <<<
+| @game@ Name of a [[type:game]] ''required'' Game this stylesheet is made for
+| @card width@ [[type:double]] 100 Width of cards in pixels
+| @card height@ [[type:double]] 100 Height of cards in pixels
+| @card dpi@ [[type:double]] 96 Resolution of cards in dots-per-inch
+| @card background@ [[type:color]] white Background color of cards
+| @init script@ [[type:script]] @;@ Script to run when this stylesheet is loaded, after the game's init script.
+| @styling fields@ [[type:list]] of [[type:field]]s Fields for styling options, shown on the 'style' panel.
+| @styling style@ [[type:indexmap]] of [[type:style]]s Styles for the styling fields.
+| @set info style@ [[type:indexmap]] of [[type:style]]s game.default_set_style Styling for the 'set info' panel
+| @card style@ [[type:indexmap]] of [[type:style]]s Styles for the card fields defined in the game
+| @extra card fields@ [[type:list]] of [[type:field]]s Additional fields to add to each card.
+ These fields are intended for things like lines and boxes, whose value is determined automatically.
+| @extra card style@ [[type:indexmap] of [[type:style]]s Styling for the extra card fields
+
diff --git a/doc/type/symbol.txt b/doc/type/symbol.txt
index 34db1acd..702efd93 100644
--- a/doc/type/symbol.txt
+++ b/doc/type/symbol.txt
@@ -1,20 +1,20 @@
-File type: Symbol
-
---Overview--
-
-A symbol file contains a symbol created with the symbol editor.
-
-Symbols are not stored in packages, the data file is directly written to a @".mse-symbol"@ file.
-
---Coordinates--
-
-Various parts of a symbol use [[type:vector2d|coordinates]].
-These are pairs of numbers in the range @0@ to @1@. @(0,0)@ is the top-left of the symbol, @(1,1)@ the bottom-right.
-
---Properties--
-! Property Type Default Description
-| @mse version@ [[type:version]] ''required'' Version of MSE this symbol is made with.
-| @parts@ [[type:list]] of [[type:symbol part]]s The parts in this symbol.
-
---Example--
-Look at a file made with the program.
+File type: Symbol
+
+--Overview--
+
+A symbol file contains a symbol created with the symbol editor.
+
+Symbols are not stored in packages, the data file is directly written to a @".mse-symbol"@ file.
+
+--Coordinates--
+
+Various parts of a symbol use [[type:vector2d|coordinates]].
+These are pairs of numbers in the range @0@ to @1@. @(0,0)@ is the top-left of the symbol, @(1,1)@ the bottom-right.
+
+--Properties--
+! Property Type Default Description
+| @mse version@ [[type:version]] ''required'' Version of MSE this symbol is made with.
+| @parts@ [[type:list]] of [[type:symbol part]]s The parts in this symbol.
+
+--Example--
+Look at a file made with the program.
diff --git a/doc/type/symbol_combine.txt b/doc/type/symbol_combine.txt
index 8aa2b972..081957e6 100644
--- a/doc/type/symbol_combine.txt
+++ b/doc/type/symbol_combine.txt
@@ -1,19 +1,19 @@
-Enumeration: symbol combine
-
-Specifies how symbol shapes are combined with those below it
-
---Script syntax--
-In scripts, symbol combine modes are passed around as a string.
-
---Possible values--
-The value is one of the following options:
-! Value Description
-| @overlap@ Place this shape on top of those below it.
Further combine options only apply to this shape.
-| @merge@ Marge this shape with the one below it, they are considered a single shape for further combining.
-| @subtract@ Subtract this shape from the one below it.
-| @intersection@ Take the intersection of this shape and the one below it, only areas that are in both shapes remain.
-| @difference@ Take the difference of this shape and the one below it, only areas that are in exactly one of the shapes remain.
-| @border@ Use this shape as additional border for the shape below it.
-
---Examples--
-> combine: overlap
+Enumeration: symbol combine
+
+Specifies how symbol shapes are combined with those below it
+
+--Script syntax--
+In scripts, symbol combine modes are passed around as a string.
+
+--Possible values--
+The value is one of the following options:
+! Value Description
+| @overlap@ Place this shape on top of those below it.
Further combine options only apply to this shape.
+| @merge@ Marge this shape with the one below it, they are considered a single shape for further combining.
+| @subtract@ Subtract this shape from the one below it.
+| @intersection@ Take the intersection of this shape and the one below it, only areas that are in both shapes remain.
+| @difference@ Take the difference of this shape and the one below it, only areas that are in exactly one of the shapes remain.
+| @border@ Use this shape as additional border for the shape below it.
+
+--Examples--
+> combine: overlap
diff --git a/doc/type/symbol_font.txt b/doc/type/symbol_font.txt
index c4b44396..9944ab61 100644
--- a/doc/type/symbol_font.txt
+++ b/doc/type/symbol_font.txt
@@ -1,55 +1,55 @@
-File type: Symbol font
-
---Overview--
-
-A symbol font is a font for drawing with images.
-Each [[type:symbol font symbol|symbol-font-symbol]] in the font is an image.
-
-A symbol font is referenced in [[type:stylesheet]]s using a [[type:symbol font reference]].
-
---Splitting--
-
-A piece of text drawn with the symbol font is split into separate symbols.
-The list of symbols in the font is scanned from top to bottom to find matches.
-
-If the text is for instance "W/GR" and "W/G" should be rendered as a single symbol, then it should appear before the symbol "W".
-Otherwise the "W" is seen as a symbol and the program continues with rendering "/GR".
-
---Font size--
-
-A symbol font is drawn using a specific point size, similar to normal fonts.
-Usually the images that make up the font are given in a very high resolution, for example 200x200.
-This resolution could correspond to a point size of for instance 150pt.
-
-When the symbol is drawn at for instance 12pt the image well then be scaled down to @200/150*12 == 16@ pixels.
-
-Sizes like margin, padding and font size are given in 'pixels per point'. If for instance
-> text margin left: 0.1
-is specified, and the symbol is rendered at 12pt, the margin will be @12*0.1 == 1.2@ pixels.
-
---Package format--
-
-A symbol font is described in a [[file:package]] with the .mse-symbol-font file extension.
-Such a package contains a [[file:format|data file]] called symbol-font that has the following properties.
-
---Properties--
-! Property Type Default Description
-| '''Common to all packages''' <<< <<< <<<
-| @mse version@ [[type:version]] ''required'' Version of MSE this symbol font is made for.
-| @short name@ [[type:string]] file name A short name of this symbol font, currently not used by the program.
-| @full name@ [[type:string]] file name A longer name of this symbol font, currently not used by the program.
-| @icon@ [[type:filename]] ''none'' Filename of an icon, currently not used by the program.
-| @version@ [[type:version]] @0.0.0@ Version number of this package.
-| @depends on@ [[type:list]] of [[type:dependency]]s
- Packages this package depends on.
-
-| '''Specific to symbol fonts''' <<< <<< <<<
-| @image font size@ [[type:double]] @12@ To what point size do the images correspond?
-| @horizontal space@ [[type:double]] @0@ Horizontal spacing between symbols, in pixels.
-| @vertical space@ [[type:double]] @0@ Vertical spacing between symbols, in pixels.
-| @symbols@ [[type:list]] of [[type:symbol font symbol]]s Symbols that make up this font.
-| @scale text@ [[type:boolean]] @false@ Should text be scaled down to fit in a symbol?
-| @insert symbol menu@ [[type:insert symbol menu|"insert symbol" menu]] ''none'' A description of the menu to insert a symbol into the text.
-
---Examples--
-See for instance the @"magic-mana-small.mse-symbol-font"@ package in the MSE distribution.
+File type: Symbol font
+
+--Overview--
+
+A symbol font is a font for drawing with images.
+Each [[type:symbol font symbol|symbol-font-symbol]] in the font is an image.
+
+A symbol font is referenced in [[type:stylesheet]]s using a [[type:symbol font reference]].
+
+--Splitting--
+
+A piece of text drawn with the symbol font is split into separate symbols.
+The list of symbols in the font is scanned from top to bottom to find matches.
+
+If the text is for instance "W/GR" and "W/G" should be rendered as a single symbol, then it should appear before the symbol "W".
+Otherwise the "W" is seen as a symbol and the program continues with rendering "/GR".
+
+--Font size--
+
+A symbol font is drawn using a specific point size, similar to normal fonts.
+Usually the images that make up the font are given in a very high resolution, for example 200x200.
+This resolution could correspond to a point size of for instance 150pt.
+
+When the symbol is drawn at for instance 12pt the image well then be scaled down to @200/150*12 == 16@ pixels.
+
+Sizes like margin, padding and font size are given in 'pixels per point'. If for instance
+> text margin left: 0.1
+is specified, and the symbol is rendered at 12pt, the margin will be @12*0.1 == 1.2@ pixels.
+
+--Package format--
+
+A symbol font is described in a [[file:package]] with the .mse-symbol-font file extension.
+Such a package contains a [[file:format|data file]] called symbol-font that has the following properties.
+
+--Properties--
+! Property Type Default Description
+| '''Common to all packages''' <<< <<< <<<
+| @mse version@ [[type:version]] ''required'' Version of MSE this symbol font is made for.
+| @short name@ [[type:string]] file name A short name of this symbol font, currently not used by the program.
+| @full name@ [[type:string]] file name A longer name of this symbol font, currently not used by the program.
+| @icon@ [[type:filename]] ''none'' Filename of an icon, currently not used by the program.
+| @version@ [[type:version]] @0.0.0@ Version number of this package.
+| @depends on@ [[type:list]] of [[type:dependency]]s
+ Packages this package depends on.
+
+| '''Specific to symbol fonts''' <<< <<< <<<
+| @image font size@ [[type:double]] @12@ To what point size do the images correspond?
+| @horizontal space@ [[type:double]] @0@ Horizontal spacing between symbols, in pixels.
+| @vertical space@ [[type:double]] @0@ Vertical spacing between symbols, in pixels.
+| @symbols@ [[type:list]] of [[type:symbol font symbol]]s Symbols that make up this font.
+| @scale text@ [[type:boolean]] @false@ Should text be scaled down to fit in a symbol?
+| @insert symbol menu@ [[type:insert symbol menu|"insert symbol" menu]] ''none'' A description of the menu to insert a symbol into the text.
+
+--Examples--
+See for instance the @"magic-mana-small.mse-symbol-font"@ package in the MSE distribution.
diff --git a/doc/type/symbol_font_reference.txt b/doc/type/symbol_font_reference.txt
index f9f4efd7..a410ce96 100644
--- a/doc/type/symbol_font_reference.txt
+++ b/doc/type/symbol_font_reference.txt
@@ -1,26 +1,26 @@
-Data type: symbol font reference
-
---Overview--
-
-A reference to a [[type:symbol font]].
-
-In [[type:stylesheet]]s the symbol fonts are not included inline, instead they are referenced by their package name.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:scriptable]] Name of a [[type:symbol font]]
- ''required'' Name of the symbol font package to use (without the extension).
-| @size@ [[type:scriptable]] [[type:double]] 12 Size in points to render the symbols with.
-| @scale down to@ [[type:double]] 1 Minimum size in points to scale the size down to.
-| @alignment@ [[type:scriptable]] [[type:alignment]] @"middle center"@ Alignment of symbols in a line of text.
-
---Example--
->symbol font:
-> name: magic-mana-small
-> size: 10
-> alignment: top left
-The name can be scripted:
->symbol font:
-> name: { if set.use_larga_mana_symbols then "magic-mana-large" else "magic-mana-small" }
-> size: 10
-> alignment: top left
+Data type: symbol font reference
+
+--Overview--
+
+A reference to a [[type:symbol font]].
+
+In [[type:stylesheet]]s the symbol fonts are not included inline, instead they are referenced by their package name.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:scriptable]] Name of a [[type:symbol font]]
+ ''required'' Name of the symbol font package to use (without the extension).
+| @size@ [[type:scriptable]] [[type:double]] 12 Size in points to render the symbols with.
+| @scale down to@ [[type:double]] 1 Minimum size in points to scale the size down to.
+| @alignment@ [[type:scriptable]] [[type:alignment]] @"middle center"@ Alignment of symbols in a line of text.
+
+--Example--
+>symbol font:
+> name: magic-mana-small
+> size: 10
+> alignment: top left
+The name can be scripted:
+>symbol font:
+> name: { if set.use_larga_mana_symbols then "magic-mana-large" else "magic-mana-small" }
+> size: 10
+> alignment: top left
diff --git a/doc/type/symbol_font_symbol.txt b/doc/type/symbol_font_symbol.txt
index 275d58f3..8ee24639 100644
--- a/doc/type/symbol_font_symbol.txt
+++ b/doc/type/symbol_font_symbol.txt
@@ -1,41 +1,41 @@
-Data type: symbol font symbol
-
---Overview--
-
-A single symbol in a [[type:symbol font]].
-
---Properties--
-! Property Type Default Description
-| @image font size@ [[type:double]] value from symbol font To what point size does the images correspond?
-| @code@ [[type:string]] or [[type:regex]] ''required'' Text this symbol matches.
-| @regex@ [[type:boolean]] @false@ Is the code a regular expression (as opposed to a string)?
-| @image@ [[type:scriptable]] [[type:image]] ''required'' Image of this symbol.
-| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this symbol actually used?
- This can be scripted to optionally disable certain symbols.
- If multiple symbols with the same code are given disabling the first switches to the second one.
-| @draw text@ [[type:int]] @-1@ The index of the captured regex expression to draw as text, or -1 to not draw text.
For example with the code @"x([a-z])"@ and @draw text: 1@ the text of the symbol @"xb"@ will be @"b"@.
-| @text font@ [[type:font]] Font to use for drawing text on symbols. The font size is in font points per text box font point.
-| @text alignment@ [[type:alignment]] @"middle center"@ How should text be aligned on the symbol?
-| @text margin left@ [[type:double]] @0@ Margin on the left of the text in pixels per point.
-| @text margin right@ [[type:double]] @0@ Margin on the right of the text in pixels per point.
-| @text margin top@ [[type:double]] @0@ Margin on the top of the text in pixels per point.
-| @text margin bottom@ [[type:double]] @0@ Margin on the bottom of the text in pixels per point.
-
-
---Examples--
-A symbol with text:
->symbol:
-> image: blank.png
-> code: .
-> regex: true
-> text font: Arial
-
-Two symbols for the same code, which one is used depends on a function from the [[type:stylesheet]].
-It is recommended to only use functions in @enabled@, so each stylesheet can determine how the font should be used.
->symbol:
-> code: T
-> image: mana_t_old.png
-> enabled: { use_old_tap_symbol() }
->symbol:
-> code: T
-> image: mana_t.png
+Data type: symbol font symbol
+
+--Overview--
+
+A single symbol in a [[type:symbol font]].
+
+--Properties--
+! Property Type Default Description
+| @image font size@ [[type:double]] value from symbol font To what point size does the images correspond?
+| @code@ [[type:string]] or [[type:regex]] ''required'' Text this symbol matches.
+| @regex@ [[type:boolean]] @false@ Is the code a regular expression (as opposed to a string)?
+| @image@ [[type:scriptable]] [[type:image]] ''required'' Image of this symbol.
+| @enabled@ [[type:scriptable]] [[type:boolean]] @true@ Is this symbol actually used?
+ This can be scripted to optionally disable certain symbols.
+ If multiple symbols with the same code are given disabling the first switches to the second one.
+| @draw text@ [[type:int]] @-1@ The index of the captured regex expression to draw as text, or -1 to not draw text.
For example with the code @"x([a-z])"@ and @draw text: 1@ the text of the symbol @"xb"@ will be @"b"@.
+| @text font@ [[type:font]] Font to use for drawing text on symbols. The font size is in font points per text box font point.
+| @text alignment@ [[type:alignment]] @"middle center"@ How should text be aligned on the symbol?
+| @text margin left@ [[type:double]] @0@ Margin on the left of the text in pixels per point.
+| @text margin right@ [[type:double]] @0@ Margin on the right of the text in pixels per point.
+| @text margin top@ [[type:double]] @0@ Margin on the top of the text in pixels per point.
+| @text margin bottom@ [[type:double]] @0@ Margin on the bottom of the text in pixels per point.
+
+
+--Examples--
+A symbol with text:
+>symbol:
+> image: blank.png
+> code: .
+> regex: true
+> text font: Arial
+
+Two symbols for the same code, which one is used depends on a function from the [[type:stylesheet]].
+It is recommended to only use functions in @enabled@, so each stylesheet can determine how the font should be used.
+>symbol:
+> code: T
+> image: mana_t_old.png
+> enabled: { use_old_tap_symbol() }
+>symbol:
+> code: T
+> image: mana_t.png
diff --git a/doc/type/symbol_part.txt b/doc/type/symbol_part.txt
index 9351b420..cf90d906 100644
--- a/doc/type/symbol_part.txt
+++ b/doc/type/symbol_part.txt
@@ -1,29 +1,29 @@
-Data type: symbol part
-
---Overview--
-
-A part of a symbol, corresponds to an item you see in the list on the left of the editor.
-
---Properties--
-! Property Type Default Description
-| @type@ One of: @"shape"@ What type of symbol part is this?
- * @shape@
- * @group@
- * @symmetry@
-| @name@ [[type:string]] @""@ The name of this part, for the part list.
-
-The rest of the properties depends on the @type@.
-
-! Type Property Type Default Description
-| @"shape"@ @combine@ [[type:symbol combine]] @"overlap"@ How to combine the shape with those below it?
-| ^^^ @points@ [[type:list]] of [[type:control point]]s The points that form this shape
-| @"symmetry"@ @kind@ @rotation@ or @reflection@ @"rotation"@ What kind of symmetry is this?
-| ^^^ @copies@ [[type:int]] 2 How many times is the original copied (including the original itself)?
-| ^^^ @center@ [[type:vector2d]] Coordinates of the center of symmetry.
-| ^^^ @handle@ [[type:vector2d]] Direction perpendicular to the 'mirror' (this is a direction, so relative to the center).
-| @"group"@ and @"symmetry"@
- @parts@ [[type:list]] of [[type:symbol part]]s Parts in this group.
-
-
---Example--
-Look at a symbol file made with the program.
+Data type: symbol part
+
+--Overview--
+
+A part of a symbol, corresponds to an item you see in the list on the left of the editor.
+
+--Properties--
+! Property Type Default Description
+| @type@ One of: @"shape"@ What type of symbol part is this?
+ * @shape@
+ * @group@
+ * @symmetry@
+| @name@ [[type:string]] @""@ The name of this part, for the part list.
+
+The rest of the properties depends on the @type@.
+
+! Type Property Type Default Description
+| @"shape"@ @combine@ [[type:symbol combine]] @"overlap"@ How to combine the shape with those below it?
+| ^^^ @points@ [[type:list]] of [[type:control point]]s The points that form this shape
+| @"symmetry"@ @kind@ @rotation@ or @reflection@ @"rotation"@ What kind of symmetry is this?
+| ^^^ @copies@ [[type:int]] 2 How many times is the original copied (including the original itself)?
+| ^^^ @center@ [[type:vector2d]] Coordinates of the center of symmetry.
+| ^^^ @handle@ [[type:vector2d]] Direction perpendicular to the 'mirror' (this is a direction, so relative to the center).
+| @"group"@ and @"symmetry"@
+ @parts@ [[type:list]] of [[type:symbol part]]s Parts in this group.
+
+
+--Example--
+Look at a symbol file made with the program.
diff --git a/doc/type/symbol_variation.txt b/doc/type/symbol_variation.txt
index cc237af6..d40265c1 100644
--- a/doc/type/symbol_variation.txt
+++ b/doc/type/symbol_variation.txt
@@ -1,46 +1,46 @@
-Data type: symbol variation
-
---Overview--
-
-A variation of a symbol, describes color and border.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''Required'' Name of this variation, refered to by the [[fun:symbol_variation]] function.
-| @border radius@ [[type:double]] @0.05@ Border radius of the symbol.
-| @fill type@ @solid@ or @linear gradient@ or @radial gradient@
- @"solid"@ How to fill the symbol.
-
-Depending on the @fill type@ there are additional properties:
-! Fill type Property Type Description
-| @"solid"@ @fill color@ [[type:color]] Color to use for filling the symbol.
-| ^^^ @border color@ [[type:color]] Color to use for the border of the symbol.
-| @"linear gradient"@ @fill color 1@ [[type:color]] Color to use for filling the symbol at the center of the gradient.
-| ^^^ @border color 1@ [[type:color]] Color to use for the border of the symbol at the center of the gradient.
-| ^^^ @fill color 2@ [[type:color]] Color to use for filling the symbol at the ends of the gradient.
-| ^^^ @border color 2@ [[type:color]] Color to use for the border of the symbol at the ends of the gradient.
-| ^^^ @center x@, @center y@ [[type:double]] Position of the center point of the gradient (in the range 0 to 1)
-| ^^^ @end x@, @end y@ [[type:double]] Position of the end point of the gradient (in the range 0 to 1)
-| @"radial gradient"@ @fill color 1@ [[type:color]] Color to use for filling the symbol at the center of the symbol.
-| ^^^ @border color 1@ [[type:color]] Color to use for the border of the symbol at the center of the symbol.
-| ^^^ @fill color 2@ [[type:color]] Color to use for filling the symbol at the edges of the symbol.
-| ^^^ @border color 2@ [[type:color]] Color to use for the border of the symbol at the edges of the symbol.
-
---Examples--
-'Common' and 'uncommon' magic expansion symbol styles:
->variation:
-> name: common
-> border radius: 0.10
-> # White border, black fill
-> fill type: solid
-> fill color: rgb(0,0,0)
-> border color: rgb(255,255,255)
->variation:
-> name: uncommon
-> border radius: 0.05
-> fill type: linear gradient
-> # Black border, silver gradient fill
-> fill color 1: rgb(224,224,224)
-> fill color 2: rgb(84, 84, 84)
-> border color 1: rgb(0, 0, 0)
-> border color 2: rgb(0, 0, 0)
+Data type: symbol variation
+
+--Overview--
+
+A variation of a symbol, describes color and border.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''Required'' Name of this variation, refered to by the [[fun:symbol_variation]] function.
+| @border radius@ [[type:double]] @0.05@ Border radius of the symbol.
+| @fill type@ @solid@ or @linear gradient@ or @radial gradient@
+ @"solid"@ How to fill the symbol.
+
+Depending on the @fill type@ there are additional properties:
+! Fill type Property Type Description
+| @"solid"@ @fill color@ [[type:color]] Color to use for filling the symbol.
+| ^^^ @border color@ [[type:color]] Color to use for the border of the symbol.
+| @"linear gradient"@ @fill color 1@ [[type:color]] Color to use for filling the symbol at the center of the gradient.
+| ^^^ @border color 1@ [[type:color]] Color to use for the border of the symbol at the center of the gradient.
+| ^^^ @fill color 2@ [[type:color]] Color to use for filling the symbol at the ends of the gradient.
+| ^^^ @border color 2@ [[type:color]] Color to use for the border of the symbol at the ends of the gradient.
+| ^^^ @center x@, @center y@ [[type:double]] Position of the center point of the gradient (in the range 0 to 1)
+| ^^^ @end x@, @end y@ [[type:double]] Position of the end point of the gradient (in the range 0 to 1)
+| @"radial gradient"@ @fill color 1@ [[type:color]] Color to use for filling the symbol at the center of the symbol.
+| ^^^ @border color 1@ [[type:color]] Color to use for the border of the symbol at the center of the symbol.
+| ^^^ @fill color 2@ [[type:color]] Color to use for filling the symbol at the edges of the symbol.
+| ^^^ @border color 2@ [[type:color]] Color to use for the border of the symbol at the edges of the symbol.
+
+--Examples--
+'Common' and 'uncommon' magic expansion symbol styles:
+>variation:
+> name: common
+> border radius: 0.10
+> # White border, black fill
+> fill type: solid
+> fill color: rgb(0,0,0)
+> border color: rgb(255,255,255)
+>variation:
+> name: uncommon
+> border radius: 0.05
+> fill type: linear gradient
+> # Black border, silver gradient fill
+> fill color 1: rgb(224,224,224)
+> fill color 2: rgb(84, 84, 84)
+> border color 1: rgb(0, 0, 0)
+> border color 2: rgb(0, 0, 0)
diff --git a/doc/type/tagged_string.txt b/doc/type/tagged_string.txt
index 844f65af..aa7f8444 100644
--- a/doc/type/tagged_string.txt
+++ b/doc/type/tagged_string.txt
@@ -1,58 +1,58 @@
-Data type: string with tags
-
---Syntax--
-Strings in [[type:value|text values]] can contain markup tags.
-These tags affect the presentation and sometimes the behaviour of the text.
-
-A tag is something like @"some text"@, similar to HTML.
-Tags are closed by the same tag with a @/@ before it.
-
-To represent the character @"<"@ in a tagged string use @"\<"@ in script code.
-This is written as the character with code 1 in files.
-
---Basic markup--
-! Tag Description
-| @@ The text inside the tag is bold.
-| @@ The text inside the tag is italic.
-| @@ The text inside the tag is rendered as symbols, if a [[prop:style:symbol font]] is set for the text box.
-| @@ The text inside the tag is rendered with the given [[type:color]].
-| @@ The text inside the tag is rendered with the given font size in points, for example @"text"@ makes the text 12 points. The text is scaled down proportionally when it does not fit in a text box and the @scale down to@ attribute allows it.
-| @@ Line breaks inside this tag use the [[prop:style:line height line]], and they show a horizontal line.
-| @@ Line breaks inside this tag use the [[prop:style:soft line height]].
-| @@ An atomic piece of text. The cursor can never be inside it; it is selected as a whole.
- The program automatically inserts @@.
-| @@ The text inside the tag is rendered in a monospace font. This is used for syntax highlighting script code.
-| @@ The text inside the tag is highlighted as a keyword in source code.
-| @@ The text inside the tag is highlighted as a string in source code.
-
-
---Other tags--
-! Tag Description
-| @@ Indicates that the text inside it is a keyword. This tag is automatically inserted by
- The [[fun:expand_keywords]] function.
- There are four versions, indicating whether or not reminder text is shown:
- * @@, Reminder text hidden, by default
- * @@, Reminder text shown, by default
- * @@, Reminder hidden manually
- * @@, Reminder shown manually
-| @@ A separator between fields. This tag is automatically inserted by the [[fun:combined_editor]] function.
- Inserting this tag manually will confuse that function!
- This tag can never be selected, and its contents can not be edited.
-| @@ At the beginning of a string, indicates a part that can not be selected. This tag is automatically inserted by the [[fun:combined_editor]] function.
-| @@ At the end of a string, indicates a part that can not be selected. This tag is automatically inserted by the [[fun:combined_editor]] function.
-| @@ Like @@, only hidden. This is inserted by [[fun:combined_editor]]
-| @@ Text who's width is ignored for alignment, similar to @@, but not a separator.
-| @@ Indicate that the text inside the tag should be selected from a [[type:word list]].
- The ??? must be the name of a word list in the game.
-| @@ The text inside the tag is an error, and is shown with a red wavy underline.
-| @@ A spelling error, marked by the [[fun::check_spelling]] function.
- The ??? part indicates the language used for spelling checking.
-| any other tag Other tags are ignored.
-
-
---Related functions--
-The following script functions deal with tags:
-| [[fun:tag_contents]] Change the contents of a specific tag.
-| [[fun:remove_tag]] Remove a tag, keep the contents.
-| [[fun:remove_tags]] Remove all tags from tagged text.
-| [[fun:to_text]] Remove all tags from tagged text, and convert it to a [[type:string]].
+Data type: string with tags
+
+--Syntax--
+Strings in [[type:value|text values]] can contain markup tags.
+These tags affect the presentation and sometimes the behaviour of the text.
+
+A tag is something like @"some text"@, similar to HTML.
+Tags are closed by the same tag with a @/@ before it.
+
+To represent the character @"<"@ in a tagged string use @"\<"@ in script code.
+This is written as the character with code 1 in files.
+
+--Basic markup--
+! Tag Description
+| @@ The text inside the tag is bold.
+| @@ The text inside the tag is italic.
+| @@ The text inside the tag is rendered as symbols, if a [[prop:style:symbol font]] is set for the text box.
+| @@ The text inside the tag is rendered with the given [[type:color]].
+| @@ The text inside the tag is rendered with the given font size in points, for example @"text"@ makes the text 12 points. The text is scaled down proportionally when it does not fit in a text box and the @scale down to@ attribute allows it.
+| @@ Line breaks inside this tag use the [[prop:style:line height line]], and they show a horizontal line.
+| @@ Line breaks inside this tag use the [[prop:style:soft line height]].
+| @@ An atomic piece of text. The cursor can never be inside it; it is selected as a whole.
+ The program automatically inserts @@.
+| @@ The text inside the tag is rendered in a monospace font. This is used for syntax highlighting script code.
+| @@ The text inside the tag is highlighted as a keyword in source code.
+| @@ The text inside the tag is highlighted as a string in source code.
+
+
+--Other tags--
+! Tag Description
+| @@ Indicates that the text inside it is a keyword. This tag is automatically inserted by
+ The [[fun:expand_keywords]] function.
+ There are four versions, indicating whether or not reminder text is shown:
+ * @@, Reminder text hidden, by default
+ * @@, Reminder text shown, by default
+ * @@, Reminder hidden manually
+ * @@, Reminder shown manually
+| @@ A separator between fields. This tag is automatically inserted by the [[fun:combined_editor]] function.
+ Inserting this tag manually will confuse that function!
+ This tag can never be selected, and its contents can not be edited.
+| @@ At the beginning of a string, indicates a part that can not be selected. This tag is automatically inserted by the [[fun:combined_editor]] function.
+| @@ At the end of a string, indicates a part that can not be selected. This tag is automatically inserted by the [[fun:combined_editor]] function.
+| @@ Like @@, only hidden. This is inserted by [[fun:combined_editor]]
+| @@ Text who's width is ignored for alignment, similar to @@, but not a separator.
+| @@ Indicate that the text inside the tag should be selected from a [[type:word list]].
+ The ??? must be the name of a word list in the game.
+| @@ The text inside the tag is an error, and is shown with a red wavy underline.
+| @@ A spelling error, marked by the [[fun::check_spelling]] function.
+ The ??? part indicates the language used for spelling checking.
+| any other tag Other tags are ignored.
+
+
+--Related functions--
+The following script functions deal with tags:
+| [[fun:tag_contents]] Change the contents of a specific tag.
+| [[fun:remove_tag]] Remove a tag, keep the contents.
+| [[fun:remove_tags]] Remove all tags from tagged text.
+| [[fun:to_text]] Remove all tags from tagged text, and convert it to a [[type:string]].
diff --git a/doc/type/value.txt b/doc/type/value.txt
index 10410a6d..e38fbe41 100644
--- a/doc/type/value.txt
+++ b/doc/type/value.txt
@@ -1,51 +1,51 @@
-Data type: Field value
-
---Overview--
-
-A value is something that is 'stored in' a [[type:field]].
-
-Values are part of the [[file:style triangle]]:
-| Description Looks Data
-| [[type:Game]] [[type:Stylesheet]] [[type:Set]]
-| [[type:Field]] [[type:Style]] '''Value'''
-
---Possible types--
-
-The type of a value depends on the corresponding field:
-! Field type Value data type Description
-| @"text"@ [[type:tagged string]] A piece of text, possibly with markup.
-| @"choice"@ [[type:string]] One of the choices of the field.
-| @"multiple choice"@ [[type:string]] A list of choices from the field, separated by commas.
- For example: @"red, green, blue"@.
-| @"package choice"@ Name of a package The (file)name of a package, including the extension.
-| @"boolean"@ @"yes"@ or @"no"@ This can be directly used as a [[type:boolean]] value in scripts.
-| @"image"@ [[type:filename]] Filename of an image file in the [[type:set]] package.
-| @"symbol"@ [[type:filename]] Filename of a [[type:symbol]] file in the [[type:set]] package.
- When accessed from a script, image fields can be directly used as [[type:image]]s.
-| @"color"@ opaque [[type:color]] A color.
-| @"info"@ [[type:string]] A label for the information box.
-
---File syntax--
-
-DOC_MSE_VERSION: since 2.0.1
-
-Values are stored using script syntax. This makes means that a value can be parsed without knowing the field type.
-Here are some examples
->some_text_value: "This is a string\nNext line."
->some_choice_value: "uncommon"
->some_image_value: local_image_file("image1.png")
->some_symbol_value: local_symbol_file("symbol1.mse-symbol")
-
---Example (old syntax)--
-
-DOC_MSE_VERSION: before 2.0.1
-
-For the field:
->field:
-> type: choice
-> name: card color
-> choice: red
-> choice: green
-> choice: blue
-A value could be:
->card color: red
+Data type: Field value
+
+--Overview--
+
+A value is something that is 'stored in' a [[type:field]].
+
+Values are part of the [[file:style triangle]]:
+| Description Looks Data
+| [[type:Game]] [[type:Stylesheet]] [[type:Set]]
+| [[type:Field]] [[type:Style]] '''Value'''
+
+--Possible types--
+
+The type of a value depends on the corresponding field:
+! Field type Value data type Description
+| @"text"@ [[type:tagged string]] A piece of text, possibly with markup.
+| @"choice"@ [[type:string]] One of the choices of the field.
+| @"multiple choice"@ [[type:string]] A list of choices from the field, separated by commas.
+ For example: @"red, green, blue"@.
+| @"package choice"@ Name of a package The (file)name of a package, including the extension.
+| @"boolean"@ @"yes"@ or @"no"@ This can be directly used as a [[type:boolean]] value in scripts.
+| @"image"@ [[type:filename]] Filename of an image file in the [[type:set]] package.
+| @"symbol"@ [[type:filename]] Filename of a [[type:symbol]] file in the [[type:set]] package.
+ When accessed from a script, image fields can be directly used as [[type:image]]s.
+| @"color"@ opaque [[type:color]] A color.
+| @"info"@ [[type:string]] A label for the information box.
+
+--File syntax--
+
+DOC_MSE_VERSION: since 2.0.1
+
+Values are stored using script syntax. This makes means that a value can be parsed without knowing the field type.
+Here are some examples
+>some_text_value: "This is a string\nNext line."
+>some_choice_value: "uncommon"
+>some_image_value: local_image_file("image1.png")
+>some_symbol_value: local_symbol_file("symbol1.mse-symbol")
+
+--Example (old syntax)--
+
+DOC_MSE_VERSION: before 2.0.1
+
+For the field:
+>field:
+> type: choice
+> name: card color
+> choice: red
+> choice: green
+> choice: blue
+A value could be:
+>card color: red
diff --git a/doc/type/vector2d.txt b/doc/type/vector2d.txt
index a4f38183..2f38d1f1 100644
--- a/doc/type/vector2d.txt
+++ b/doc/type/vector2d.txt
@@ -1,15 +1,15 @@
-Data type: two dimensional vector
-
-A coordinate or direction in a symbol.
-This is a pair of [[type:double]]s.
-
-The coordinates are usually in the range @0@ to @1@.
-@(0,0)@ is the top-left of the symbol, @(1,1)@ the bottom-right.
-
---File syntax--
-> (x-coordinate,y-coordinate)
-For example
-> (0.5,0.5)
-
---Script syntax--
-Vectors can not be represented in script syntax.
+Data type: two dimensional vector
+
+A coordinate or direction in a symbol.
+This is a pair of [[type:double]]s.
+
+The coordinates are usually in the range @0@ to @1@.
+@(0,0)@ is the top-left of the symbol, @(1,1)@ the bottom-right.
+
+--File syntax--
+> (x-coordinate,y-coordinate)
+For example
+> (0.5,0.5)
+
+--Script syntax--
+Vectors can not be represented in script syntax.
diff --git a/doc/type/version.txt b/doc/type/version.txt
index 2cbc8199..52c96277 100644
--- a/doc/type/version.txt
+++ b/doc/type/version.txt
@@ -1,11 +1,11 @@
-Primitive type: version number
-
---File syntax--
-A version number consists of three components, in the form "a.b.c".
-Higher numbers mean newer versions.
-
-The version number can also be a date, of the form "YYYY-MM-DD"
-
---Examples--
-> version: 1.2.3
-> version: 2007-07-12
+Primitive type: version number
+
+--File syntax--
+A version number consists of three components, in the form "a.b.c".
+Higher numbers mean newer versions.
+
+The version number can also be a date, of the form "YYYY-MM-DD"
+
+--Examples--
+> version: 1.2.3
+> version: 2007-07-12
diff --git a/doc/type/word_list.txt b/doc/type/word_list.txt
index 861b78b2..445f73f1 100644
--- a/doc/type/word_list.txt
+++ b/doc/type/word_list.txt
@@ -1,18 +1,18 @@
-Data type: word list
-
-A list of words. Used for drop down lists in the text editor, for example for card types.
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''Required'' Name of this word list, refered to using a @""@ tag.
-| @words@ [[type:list]] of [[type:word list word]]s ''Required'' The words in the list
-
---Example--
->word list:
-> name: type
-> word: Creature
-> word: Spell
-> word: Artifact
-This can be used with for example:
-> @"Creature"@
-Which gives the creature choice, and that can be changed with a drop down list.
+Data type: word list
+
+A list of words. Used for drop down lists in the text editor, for example for card types.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''Required'' Name of this word list, refered to using a @""@ tag.
+| @words@ [[type:list]] of [[type:word list word]]s ''Required'' The words in the list
+
+--Example--
+>word list:
+> name: type
+> word: Creature
+> word: Spell
+> word: Artifact
+This can be used with for example:
+> @"Creature"@
+Which gives the creature choice, and that can be changed with a drop down list.
diff --git a/doc/type/word_list_word.txt b/doc/type/word_list_word.txt
index ef5166da..d9ab5429 100644
--- a/doc/type/word_list_word.txt
+++ b/doc/type/word_list_word.txt
@@ -1,34 +1,34 @@
-Data type: word list word
-
-A word in a [[type:word list]].
-
---Properties--
-! Property Type Default Description
-| @name@ [[type:string]] ''Required'' The word.
-| @line below@ [[type:boolean]] @false@ Display a line below this item in the list?
-| @is prefix@ [[type:boolean]] @false@ Should this word be used as a prefix before another word from the list?
- Think "Legendary ". Note the space after it, words are directly concatenated.
-| @words@ [[type:list]] of [[type:word list word]]s A submenu. If given, the @name@ of this word is only used as a label for the menu.
-| @script@ [[type:script]] ''Optional'' A script that determines zero or more words.
- The result should be a list of comma separated words, for example @"x,y,z"@ specifies three words.
- The words are included in the parent menu, not a sub menu.
-
-A word can also be given in a short form, in that case only the name is specified.
-
---Example--
-In short form:
->word: xyz
-Is the same as:
->word:
-> name: xyz
-
-Using a script,
->word:
-> script: "red,green,blue"
-> line below: true
-Is the same as
->word: blue
->word: green
->word:
-> name: red
-> line below: true
+Data type: word list word
+
+A word in a [[type:word list]].
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''Required'' The word.
+| @line below@ [[type:boolean]] @false@ Display a line below this item in the list?
+| @is prefix@ [[type:boolean]] @false@ Should this word be used as a prefix before another word from the list?
+ Think "Legendary ". Note the space after it, words are directly concatenated.
+| @words@ [[type:list]] of [[type:word list word]]s A submenu. If given, the @name@ of this word is only used as a label for the menu.
+| @script@ [[type:script]] ''Optional'' A script that determines zero or more words.
+ The result should be a list of comma separated words, for example @"x,y,z"@ specifies three words.
+ The words are included in the parent menu, not a sub menu.
+
+A word can also be given in a short form, in that case only the name is specified.
+
+--Example--
+In short form:
+>word: xyz
+Is the same as:
+>word:
+> name: xyz
+
+Using a script,
+>word:
+> script: "red,green,blue"
+> line below: true
+Is the same as
+>word: blue
+>word: green
+>word:
+> name: red
+> line below: true
diff --git a/src/cli/cli_main.cpp b/src/cli/cli_main.cpp
index 1ffd0807..57f89377 100644
--- a/src/cli/cli_main.cpp
+++ b/src/cli/cli_main.cpp
@@ -1,275 +1,280 @@
-//+----------------------------------------------------------------------------+
-//| Description: Magic Set Editor - Program to make Magic (tm) cards |
-//| Copyright: (C) 2001 - 2012 Twan van Laarhoven and Sean Hunt |
-//| License: GNU General Public License 2 or later (see file COPYING) |
-//+----------------------------------------------------------------------------+
-
-// ----------------------------------------------------------------------------- : Includes
-
-#include "util/prec.hpp"
-#include "util/error.hpp"
-#include "cli/cli_main.hpp"
-#include "cli/text_io_handler.hpp"
-#include "script/functions/functions.hpp"
-#include "script/profiler.hpp"
-#include "data/format/formats.hpp"
-#include
-#include
-#include
-
-using std::min;
-
-String read_utf8_line(wxInputStream& input, bool eat_bom = true, bool until_eof = false);
-
-
-// ----------------------------------------------------------------------------- : Command line interface
-
-CLISetInterface::CLISetInterface(const SetP& set, bool quiet)
- : quiet(quiet)
- , our_context(nullptr)
-{
- if (!cli.haveConsole()) {
- throw Error(_("Can not run command line interface without a console;\nstart MSE with \"mse.com --cli\""));
- }
- ei.allow_writes_outside = true;
- setExportInfoCwd();
- setSet(set);
- // show welcome logo
- if (!quiet) showWelcome();
- cli.print_pending_errors();
-}
-
-CLISetInterface::~CLISetInterface() {
- delete our_context;
-}
-
-Context& CLISetInterface::getContext() {
- if (set) {
- return set->getContext();
- } else {
- if (!our_context) {
- our_context = new Context();
- init_script_functions(*our_context);
- }
- return *our_context;
- }
-}
-
-void CLISetInterface::onBeforeChangeSet() {
- if (set || our_context) {
- Context& ctx = getContext();
- ctx.closeScope(scope);
- }
-}
-
-void CLISetInterface::onChangeSet() {
- Context& ctx = getContext();
- scope = ctx.openScope();
- ei.set = set;
-}
-
-void CLISetInterface::setExportInfoCwd() {
- // write to the current directory
- ei.directory_relative = ei.directory_absolute = wxGetCwd();
- // read from the current directory
- ei.export_template = intrusive(new Package());
- ei.export_template->open(ei.directory_absolute, true);
-}
-
-
-// ----------------------------------------------------------------------------- : Running
-
-void CLISetInterface::run_interactive() {
- // loop
- running = true;
- while (running) {
- // show prompt
- if (!quiet) {
- cli << GRAY << _("> ") << NORMAL;
- cli.flush();
- }
- // read line from stdin
- String command = cli.getLine();
- if (command.empty() && !cli.canGetLine()) break;
- handleCommand(command);
- cli.print_pending_errors();
- cli.flush();
- cli.flushRaw();
- }
-}
-
-bool CLISetInterface::run_script(ScriptP const& script) {
- try {
- WITH_DYNAMIC_ARG(export_info, &ei);
- Context& ctx = getContext();
- ScriptValueP result = ctx.eval(*script,false);
- // show result (?)
- cli << result->toCode() << ENDL;
- return true;
- } CATCH_ALL_ERRORS(true);
- return false;
-}
-
-bool CLISetInterface::run_script_string(String const& command, bool multiline) {
- vector errors;
- ScriptP script = parse(command,nullptr,false,errors);
- if (errors.empty()) {
- return run_script(script);
- } else {
- for(auto& error :errors) {
- if (multiline) {
- cli.show_message(MESSAGE_ERROR, String::Format(_("On line %d:\t"), error.line) + error.what());
- } else {
- cli.show_message(MESSAGE_ERROR, error.what());
- }
- }
- return false;
- }
-}
-
-bool CLISetInterface::run_script_file(String const& filename) {
- // read file
- if (!wxFileExists(filename)) {
- cli.show_message(MESSAGE_ERROR, _("File not found: ")+filename);
- return false;
- }
- wxFileInputStream is(filename);
- if (!is.Ok()) {
- cli.show_message(MESSAGE_ERROR, _("Unable to open file: ")+filename);
- return false;
- }
- wxBufferedInputStream bis(is);
- String code = read_utf8_line(bis, true, true);
- run_script_string(code);
- return true;
-}
-
-void CLISetInterface::showWelcome() {
- cli << _(" ___ \n")
- _(" __ __ _ ___ _ ___ _ _ _ |__ \\ \n")
- _(" | \\/ |__ _ __ _(_)__ / __|___| |_ | __|__| (_) |_ ___ _ _ ) |\n")
- _(" | |\\/| / _` / _` | / _| \\__ | -_) _| | _|/ _` | | _/ _ \\ '_| / / \n")
- _(" |_| |_\\__,_\\__, |_\\__| |___|___|\\__| |___\\__,_|_|\\__\\___/_| / /_ \n")
- _(" |___/ |____|\n\n");
- cli.flush();
-}
-
-void CLISetInterface::showUsage() {
- cli << _(" Commands available from the prompt:\n\n");
- cli << _(" Execute a script expression, display the result\n");
- cli << _(" :help Show this help page.\n");
- cli << _(" :load Load a different set file.\n");
- cli << _(" :quit Exit the MSE command line interface.\n");
- cli << _(" :reset Clear all local variable definitions.\n");
- cli << _(" :pwd Print the current working directory.\n");
- cli << _(" :cd Change the working directory.\n");
- cli << _(" :! Perform a shell command.\n");
- cli << _("\n Commands can be abreviated to their first letter if there is no ambiguity.\n\n");
-}
-
-void CLISetInterface::handleCommand(const String& command) {
- try {
- if (command.empty()) {
- // empty, ignore
- } else if (command.GetChar(0) == _(':')) {
- // :something
- size_t space = min(command.find_first_of(_(' ')), command.size());
- String before = command.substr(0,space);
- String arg = space + 1 < command.size() ? command.substr(space+1) : wxEmptyString;
- if (before == _(":q") || before == _(":quit")) {
- if (!quiet) {
- cli << _("Goodbye\n");
- }
- running = false;
- } else if (before == _(":?") || before == _(":h") || before == _(":help")) {
- showUsage();
- } else if (before == _(":l") || before == _(":load")) {
- if (arg.empty()) {
- cli.show_message(MESSAGE_ERROR,_("Give a filename to open."));
- } else {
- setSet(import_set(arg));
- }
- } else if (before == _(":r") || before == _(":reset")) {
- Context& ctx = getContext();
- ei.exported_images.clear();
- ctx.closeScope(scope);
- scope = ctx.openScope();
- } else if (before == _(":i") || before == _(":info")) {
- if (set) {
- cli << _("set: ") << set->identification() << ENDL;
- cli << _("filename: ") << set->absoluteFilename() << ENDL;
- cli << _("relative: ") << set->relativeFilename() << ENDL;
- cli << String::Format(_("#cards: %d"), set->cards.size()) << ENDL;
- } else {
- cli << _("No set loaded") << ENDL;
- }
- } else if (before == _(":c") || before == _(":cd")) {
- if (arg.empty()) {
- cli.show_message(MESSAGE_ERROR,_("Give a new working directory."));
- } else {
- if (!wxSetWorkingDirectory(arg)) {
- cli.show_message(MESSAGE_ERROR,_("Can't change working directory to ")+arg);
- } else {
- setExportInfoCwd();
- }
- }
- } else if (before == _(":pwd") || before == _(":p")) {
- cli << ei.directory_absolute << ENDL;
- } else if (before == _(":!")) {
- if (arg.empty()) {
- cli.show_message(MESSAGE_ERROR,_("Give a shell command to execute."));
- } else {
- #ifdef UNICODE
- #ifdef __WXMSW__
- _wsystem(arg.c_str()); // TODO: is this function available on other platforms?
- #else
- wxCharBuffer buf = arg.fn_str();
- system(buf);
- #endif
- #else
- system(arg.c_str());
- #endif
- }
- #if USE_SCRIPT_PROFILING
- } else if (before == _(":profile")) {
- if (arg == _("full")) {
- showProfilingStats(profile_root);
- } else {
- long level = 1;
- arg.ToLong(&level);
- showProfilingStats(profile_aggregated(level));
- }
- #endif
- } else {
- cli.show_message(MESSAGE_ERROR,_("Unknown command, type :help for help."));
- }
- } else if (command == _("exit") || command == _("quit")) {
- cli << _("Use :quit to quit\n");
- } else if (command == _("help")) {
- cli << _("Use :help for help\n");
- } else {
- run_script_string(command);
- }
- } catch (const Error& e) {
- cli.show_message(MESSAGE_ERROR,e.what());
- }
-}
-
-#if USE_SCRIPT_PROFILING
- void CLISetInterface::showProfilingStats(const FunctionProfile& item, int level) {
- // show parent
- if (level == 0) {
- cli << GRAY << _("Time(s) Avg (ms) Calls Function") << ENDL;
- cli << _("======== ======== ====== ===============================") << NORMAL << ENDL;
- } else {
- for (int i = 1 ; i < level ; ++i) cli << _(" ");
- cli << String::Format(_("%8.5f %8.5f %6d %s"), item.total_time(), 1000 * item.avg_time(), item.calls, item.name.c_str()) << ENDL;
- }
- // show children
- vector children;
- item.get_children(children);
- for(auto& c : boost::adaptors::reverse(children)) {
- showProfilingStats(*c, level + 1);
- }
- }
-#endif
+//+----------------------------------------------------------------------------+
+//| Description: Magic Set Editor - Program to make Magic (tm) cards |
+//| Copyright: (C) 2001 - 2012 Twan van Laarhoven and Sean Hunt |
+//| License: GNU General Public License 2 or later (see file COPYING) |
+//+----------------------------------------------------------------------------+
+
+// ----------------------------------------------------------------------------- : Includes
+
+#include "util/prec.hpp"
+#include "util/error.hpp"
+#include "cli/cli_main.hpp"
+#include "cli/text_io_handler.hpp"
+#include "script/functions/functions.hpp"
+#include "script/profiler.hpp"
+#include "data/format/formats.hpp"
+#include
+#include
+#include
+
+using std::min;
+
+String read_utf8_line(wxInputStream& input, bool eat_bom = true, bool until_eof = false);
+
+
+// ----------------------------------------------------------------------------- : Command line interface
+
+CLISetInterface::CLISetInterface(const SetP& set, bool quiet)
+ : quiet(quiet)
+ , our_context(nullptr)
+{
+ if (!cli.haveConsole()) {
+ throw Error(L"Can not run command line interface without a console;\nstart MSE with \"mse.com --cli\"");
+ }
+ ei.allow_writes_outside = true;
+ setExportInfoCwd();
+ setSet(set);
+ // show welcome logo
+ if (!quiet) showWelcome();
+ cli.print_pending_errors();
+}
+
+CLISetInterface::~CLISetInterface() {
+ delete our_context;
+}
+
+Context& CLISetInterface::getContext() {
+ if (set) {
+ return set->getContext();
+ } else {
+ if (!our_context) {
+ our_context = new Context();
+ init_script_functions(*our_context);
+ }
+ return *our_context;
+ }
+}
+
+void CLISetInterface::onBeforeChangeSet() {
+ if (set || our_context) {
+ Context& ctx = getContext();
+ ctx.closeScope(scope);
+ }
+}
+
+void CLISetInterface::onChangeSet() {
+ Context& ctx = getContext();
+ scope = ctx.openScope();
+ ei.set = set;
+}
+
+void CLISetInterface::setExportInfoCwd() {
+ // write to the current directory
+ ei.directory_relative = ei.directory_absolute = wxGetCwd();
+ // read from the current directory
+ ei.export_template = intrusive(new Package());
+ ei.export_template->open(ei.directory_absolute, true);
+}
+
+
+// ----------------------------------------------------------------------------- : Running
+
+void CLISetInterface::run_interactive() {
+ // loop
+ running = true;
+ while (running) {
+ // show prompt
+ if (!quiet) {
+ cli << GRAY << L"> " << NORMAL;
+ cli.flush();
+ }
+ // read line from stdin
+ String command = cli.getLine();
+ if (command.empty() && !cli.canGetLine()) break;
+ handleCommand(command);
+ cli.print_pending_errors();
+ cli.flush();
+ cli.flushRaw();
+ }
+}
+
+bool CLISetInterface::run_script(ScriptP const& script) {
+ try {
+ WITH_DYNAMIC_ARG(export_info, &ei);
+ Context& ctx = getContext();
+ ScriptValueP result = ctx.eval(*script,false);
+ // show result (?)
+ cli << result->toCode() << ENDL;
+ return true;
+ } CATCH_ALL_ERRORS(true);
+ return false;
+}
+
+bool CLISetInterface::run_script_string(String const& command, bool multiline) {
+ vector errors;
+ ScriptP script = parse(command,nullptr,false,errors);
+ if (errors.empty()) {
+ return run_script(script);
+ } else {
+ for(auto& error :errors) {
+ if (multiline) {
+ cli.show_message(MESSAGE_ERROR, String::Format(L"On line %d:\t", error.line) + error.what());
+ } else {
+ cli.show_message(MESSAGE_ERROR, error.what());
+ }
+ }
+ return false;
+ }
+}
+
+bool CLISetInterface::run_script_file(String const& filename) {
+ // read file
+ if (!wxFileExists(filename)) {
+ cli.show_message(MESSAGE_ERROR, L"File not found: "+filename);
+ return false;
+ }
+ wxFileInputStream is(filename);
+ if (!is.Ok()) {
+ cli.show_message(MESSAGE_ERROR, L"Unable to open file: "+filename);
+ return false;
+ }
+ wxBufferedInputStream bis(is);
+ String code = read_utf8_line(bis, true, true);
+ run_script_string(code);
+ return true;
+}
+
+void CLISetInterface::showWelcome() {
+ // clang-format off
+ cli << LR"++(\
++---------------------------------------------------------------------------+
+| ___ |
+| __ __ _ ___ _ ___ _ _ _ |__ \ |
+| | \/ |__ _ __ _(_)__ / __|___| |_ | __|__| (_) |_ ___ _ _ ) | |
+| | |\/| / _` / _` | / _| \__ | -_) _| | _|/ _` | | _/ _ \ '_| / / |
+| |_| |_\__,_\__, |_\__| |___|___|\__| |___\__,_|_|\__\___/_| / /_ |
+| |___/ |____| |
+| |
++---------------------------------------------------------------------------+
+)++";
+ // clang-format on
+ cli.flush();
+}
+
+void CLISetInterface::showUsage() {
+ cli << L" Commands available from the prompt:\n\n";
+ cli << L" Execute a script expression, display the result\n";
+ cli << L" :help Show this help page.\n";
+ cli << L" :load Load a different set file.\n";
+ cli << L" :quit Exit the MSE command line interface.\n";
+ cli << L" :reset Clear all local variable definitions.\n";
+ cli << L" :pwd Print the current working directory.\n";
+ cli << L" :cd Change the working directory.\n";
+ cli << L" :! Perform a shell command.\n";
+ cli << L"\n Commands can be abreviated to their first letter if there is no ambiguity.\n\n";
+}
+
+void CLISetInterface::handleCommand(const String& command) {
+ try {
+ if (command.empty()) {
+ // empty, ignore
+ } else if (command.GetChar(0) == L':') {
+ // :something
+ size_t space = min(command.find_first_of(L' '), command.size());
+ String before = command.substr(0,space);
+ String arg = space + 1 < command.size() ? command.substr(space+1) : wxEmptyString;
+ if (before == L":q" || before == L":quit") {
+ if (!quiet) {
+ cli << L"Goodbye\n";
+ }
+ running = false;
+ } else if (before == L":?" || before == L":h" || before == L":help") {
+ showUsage();
+ } else if (before == L":l" || before == L":load") {
+ if (arg.empty()) {
+ cli.show_message(MESSAGE_ERROR, L"Give a filename to open.");
+ } else {
+ setSet(import_set(arg));
+ }
+ } else if (before == L":r" || before == L":reset") {
+ Context& ctx = getContext();
+ ei.exported_images.clear();
+ ctx.closeScope(scope);
+ scope = ctx.openScope();
+ } else if (before == L":i" || before == L":info") {
+ if (set) {
+ cli << L"set: " << set->identification() << ENDL;
+ cli << L"filename: " << set->absoluteFilename() << ENDL;
+ cli << L"relative: " << set->relativeFilename() << ENDL;
+ cli << String::Format(L"#cards: %d", set->cards.size()) << ENDL;
+ } else {
+ cli << L"No set loaded" << ENDL;
+ }
+ } else if (before == L":c" || before == L":cd") {
+ if (arg.empty()) {
+ cli.show_message(MESSAGE_ERROR, L"Give a new working directory.");
+ } else {
+ if (!wxSetWorkingDirectory(arg)) {
+ cli.show_message(MESSAGE_ERROR,L"Can't change working directory to "+arg);
+ } else {
+ setExportInfoCwd();
+ }
+ }
+ } else if (before == L":pwd" || before == L":p") {
+ cli << ei.directory_absolute << ENDL;
+ } else if (before == L":!") {
+ if (arg.empty()) {
+ cli.show_message(MESSAGE_ERROR, L"Give a shell command to execute.");
+ } else {
+ #ifdef __WXMSW__
+ _wsystem(arg.c_str()); // TODO: is this function available on other platforms?
+ #else
+ wxCharBuffer buf = arg.fn_str();
+ system(buf);
+ #endif
+ }
+ #if USE_SCRIPT_PROFILING
+ } else if (before == L":profile") {
+ if (arg == L"full") {
+ showProfilingStats(profile_root);
+ } else {
+ long level = 1;
+ arg.ToLong(&level);
+ showProfilingStats(profile_aggregated(level));
+ }
+ #endif
+ } else {
+ cli.show_message(MESSAGE_ERROR, L"Unknown command, type :help for help.");
+ }
+ } else if (command == L"exit" || command == L"quit") {
+ cli << L"Use :quit to quit\n";
+ } else if (command == L"help") {
+ cli << L"Use :help for help\n";
+ } else {
+ run_script_string(command);
+ }
+ } catch (const Error& e) {
+ cli.show_message(MESSAGE_ERROR,e.what());
+ }
+}
+
+#if USE_SCRIPT_PROFILING
+ void CLISetInterface::showProfilingStats(const FunctionProfile& item, int level) {
+ // show parent
+ if (level == 0) {
+ cli << GRAY << L"Time(s) Avg (ms) Calls Function" << ENDL;
+ cli << L"======== ======== ====== ===============================" << NORMAL << ENDL;
+ } else {
+ for (int i = 1 ; i < level ; ++i) cli << L" ";
+ cli << String::Format(L"%8.5f %8.5f %6d %s",
+ item.total_time(), 1000 * item.avg_time(),
+ item.calls, item.name.c_str()) << ENDL;
+ }
+ // show children
+ vector children;
+ item.get_children(children);
+ for(auto& c : boost::adaptors::reverse(children)) {
+ showProfilingStats(*c, level + 1);
+ }
+ }
+#endif
diff --git a/src/cli/cli_main.hpp b/src/cli/cli_main.hpp
index c70d6b44..2e726d4d 100644
--- a/src/cli/cli_main.hpp
+++ b/src/cli/cli_main.hpp
@@ -1,55 +1,55 @@
-//+----------------------------------------------------------------------------+
-//| Description: Magic Set Editor - Program to make Magic (tm) cards |
-//| Copyright: (C) 2001 - 2012 Twan van Laarhoven and Sean Hunt |
-//| License: GNU General Public License 2 or later (see file COPYING) |
-//+----------------------------------------------------------------------------+
-
-#ifndef HEADER_CLI_MAIN
-#define HEADER_CLI_MAIN
-
-// ----------------------------------------------------------------------------- : Includes
-
-#include
-#include
-#include
-#include