Line continuation support in .ini files
There's no official standard for this, but it seems to be common where multi-line values are needed in .ini files to use a leading space (as opposed to a trailing ''/'') on subsequent lines of the value.
Here's a simple patch to make IniLexer be able to handle these types of multi-line values in an ini file.
--- text.py (revision 5327) +++ text.py (working copy) @@ -54,7 +54,7 @@ (r'\s+', Text), (r'[;#].?$', Comment), (r'\[.?\]$', Keyword), - (r'(.?)([ \t])(=)([ \t])(.?)$', + (r'(.?)([ \t])(=)([ \t])((\n |[^\n;#]))', bygroups(Name.Attribute, Text, Operator, Text, String)) ] } }}}
The match for the value is either a newline followed by a single space or anything up to a standalone newline or comment.
The only drawback to this patch is that it would no longer allow leading spaces before the keys themselves. Whitespace after the key and before and after the equals sign would continue to be recognized properly. I don't think that is common, but Pygments would currently recognize it, so it's worth pointing out.
Reported by guest