Content deleted Content added
→parameter warnings=true: explain code |
→parameter warnings=true: interesting bug |
||
Line 100:
:The line "<code>if warnings then</code>" tests if warnings are enabled.
:The line "<code>if parms.warnings == nil then</code>" means only the first warning is displayed (if there already is a warning, <code>parms.warnings</code> will be set, not nil). That is to reduce clutter that would appear in an article if malformed input was given. As I just commented above, a new list of messages is [[User:Johnuniq/Convert messages|here]], and it includes some warnings. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 03:14, 20 September 2013 (UTC)
----
I've had time to investigate the above interesting bug where using "warnings=true" causes "true" to be appended to the result. [[Module:Convert]] includes the following code:
<syntaxhighlight lang="lua">
-- The wikitext with the final result is set (not shown here).
wikitext = ...
-- If any warnings have been generated, they are appended.
if parms.warnings then
wikitext = wikitext .. parms.warnings
end
</syntaxhighlight>
The problem is that the parms table contains what the user entered, and because the convert contains "warnings=true", the module sets <code>parms.warnings = true</code>. That is then appended, and Lua helpfully converts the Boolean "true" to the string "true". I'll think about making that more robust. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 06:29, 20 September 2013 (UTC)
== Before going live ==
|