Module:Convert/text: Difference between revisions

(update from sandbox per Template talk:Convert#Module version 8)
(update from sandbox per Template talk:Convert#Module version 9)
Line 102:
["sqbr-sp"] = { " [" , "]" },
["sqbr-nbsp"] = { " [" , "]" },
["comma"] = { ", " , "" , ", " },
["slash-sp"] = { " / " , "" , wantname = true },
["slash-nbsp"] = { " / ", "" , wantname = true },
["slash-nosp"] = { "/" , "" , wantname = true },
["b"] = { " (" , ")" },
["(or)"] = { " (" , ")", " or " },
["br"] = { "<br />" , "" , wantname = true },
["br()"] = { "<br />(" , ")", wantname = true },
Line 114:
-- Text to separate values in a range.
local range_types = {
-- Specifying a table requires "off" and "on" values (for "abbr=off" and "abbr=on");either:
-- * "off" and "on" values (for "abbr=off" and "abbr=on"), or
-- * "input" and "output" values (for LHS and RHS);
-- other fields are optional.
-- When "adj=on|abbr=off" applies, spaces in range text are replaced with hyphens.
Line 127 ⟶ 129:
["to about"] = " to about ",
["and"] = { off = " and ", on = " and ", exception = true },
["and(-)"] = { offinput = " and ", onoutput = "–" },
["or"] = { off = " or " , on = " or " , exception = true },
["to"] = { off = " to " , on = " to " , exception = true },
["to(-)"] = { offinput = "&nbsp;to ", onoutput = "–" },
["+/-"] = { off = "&nbsp;±&nbsp;", on = "&nbsp;±&nbsp;", adj = "&nbsp;±&nbsp;", is_range_change = true },
["x"] = { off = " by ", on = " ×&nbsp;", is_range_x = true },
Line 149 ⟶ 151:
}
 
-- TheConvert followingaccepts "words"range aretext accepteddelimited towith make a simple rangewhitespace, for example, {{convert|1- to 2|ft}}.
-- WordsIn mustaddition, bethe infollowing correct"words" orderare foraccepted without searchingspaces, for example, '{{convert|1-' after '+/-' and 'x' after 'xx'2|ft}}.
-- Words must be in correct order for searching, for example, 'x' after 'xx'.
-- Put '-' last so can have a simple range with negative values as in {{convert|-5 to -1|C}}.
local range_words = { '+/-', 'to(-)', 'xx', 'x', '*', 'to', 'or', 'by', '–' , '-' }
 
local ranges = {
Anonymous user