Option for default line numbering behavior / parser options in attachments

There is no way for disabling line numbering on attached text files. There is option numbers=disable, but you can define it only when source is included in the page, but not when it is attached.

Because I generally don't like line numbering (and maybe other people too), so for me the simplest solution is to add global config option for default behavior

Now I've just changed file "parser/init.py"

--- MoinMoin/parser/__init__-orig.py    2010-08-27 09:19:37.000000000 +0200
+++ MoinMoin/parser/__init__.py 2010-08-27 09:30:49.000000000 +0200
@@ -33,7 +33,7 @@
 
     @returns: numbers, start, step, attrdict
     """
-    nums, start, step = 1, 1, 1
+    nums, start, step = -1, 1, 1
     attrs, msg = wikiutil.parseAttributes(request, args)
     if not msg:
         try:
@@ -44,9 +44,11 @@
             step = int(attrs.get('step', '"1"')[1:-1])
         except ValueError:
             pass
-        if attrs.get('numbers', '"on"')[1:-1].lower() in ('off', 'false', 'no'):
+        if attrs.get('numbers', '""')[1:-1].lower() in ('on', 'true', 'yes'):
+            nums = 1
+        elif attrs.get('numbers', '""')[1:-1].lower() in ('off', 'false', 'no'):
             nums = 0
-        elif attrs.get('numbers', '"on"')[1:-1].lower() in ('none', 'disable'):
+        elif attrs.get('numbers', '""')[1:-1].lower() in ('none', 'disable'):
             nums = -1
     return nums, start, step, attrs

And after that my default behavior is "disable", but it would be better to make it configurable.


Of course such default would be enough for me, but the best solution is to add possibility to modify such parameters in every attachment.

It would be nice if something like this worked:

{{attachment:myfile.js|description:numbers=disable}}

or

{{attachment:myfile.js|description|numbers=disable}}

or even

{{attachment:myfile.js.txt|description:highlight js numbers=disable}}

I'am not sure which variant would be the best (in attached images you can define attributes like 'alt','width' and so on after '|', but it looks like this should be left for defining HTML-like parameters, so maybe it would be better to use second ':' here)

param querystring syntax is different see HelpOnLinking but I get your suggestion.


CategoryFeatureRequest

MoinMoin: FeatureRequests/ConfigOptionForLineNumbering (last edited 2010-08-27 14:30:14 by ReimarBauer)