Description

When entering #!/bin/bash into a code block, MoinMoin does not show the line in the HTML view.

Steps to reproduce

  1. Create a new page (or edit the SandBox)

  2. Create a new code block containing a sample bash script (for example)
  3. Save and view the page
  4. The hashbang line is not rendered in the HTML

I expect to see the #!/bin/bash

Example

This isn't showing the #!/bin/bash line.

echo foobar

Nor does this show the #!/usr/bin/env python line.

def foo:
    bar

This does as the formatter doesn't think that this is a formatting line.

-
#!/bin/bash
echo foobar

Component selection

Details

This Wiki.

Workaround

Add something else on the line preceeding #!/bin/bash

Or apply this HORRIBLE patch (against 1.6.3):

--- formatter/__init__.py-orig  2008-07-23 19:07:03.000000000 +0100
+++ formatter/__init__.py-new   2008-07-23 19:06:12.000000000 +0100
@@ -317,6 +317,8 @@
                 return self.text(errmsg)
 
     def _get_bang_args(self, line):
+        if line.startswith('#!/'):
+            return None
         if line.startswith('#!'):
             try:
                 name, args = line[2:].split(None, 1)

Discussion

The parser successfully negotiates that the content type should be 'text', but the formatter removes the line if it begins with '#!'. Since many wiki's probably are used for code snippets, these lines are probably missing.

It doesn't seem to affect the version of MoinMoin running at http://moinmoin.wikiwikiweb.de though... (1.5.9)

(!) if your stuff begins with #! and you want to see that as content (or it is not meant as parser format spec for moin), you have to add another #! line specifying the parser you want to use:

{{{
#!python
#!/usr/bin/env python
def foo:
    bar
}}}

Renders as:

   1 #!/usr/bin/env python
   2 def foo:
   3     bar

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/ParserDoesNotShowHashBangSlash (last edited 2008-07-25 20:08:30 by ThomasWaldmann)