[Trac-tickets] [The Trac Project] #2232: OneLinerFormatter should remove [[BR]]

The Trac Project noreply at edgewall.com
Fri Oct 14 21:02:36 CDT 2005


#2232: OneLinerFormatter should remove [[BR]]
-----------------------------------------------+----------------------------
 Reporter:  Shunichi Goto <gotoh at taiyo.co.jp>  |       Owner:  jonas
     Type:  defect                             |      Status:  new  
 Priority:  normal                             |   Milestone:       
Component:  wiki                               |     Version:  devel
 Severity:  minor                              |   Keywords:                                     |  
-----------------------------------------------+----------------------------
 I think !OneLinerFormatter should remove [[BR]].
 And I also think better that the macro is printed without long arguments.
 For example, '`[[SomeMacro(arg1,arg2,arg3,arg4)]]`' => '`[[SomeMacro]]`'.

 Here is a patch:
 {{{
 #!diff
 Index: formatter.py
 ===================================================================
 --- formatter.py        (revision 2345)
 +++ formatter.py        (working copy)
 @@ -623,13 +623,19 @@

      # Override a few formatters to disable some wiki syntax in
 "oneliner"-mode
      def _list_formatter(self, match, fullmatch): return match
 -    def _macro_formatter(self, match, fullmatch): return match
      def _indent_formatter(self, match, fullmatch): return match
      def _heading_formatter(self, match, fullmatch): return match
      def _definition_formatter(self, match, fullmatch): return match
      def _table_cell_formatter(self, match, fullmatch): return match
      def _last_table_cell_formatter(self, match, fullmatch): return match

 +    def _macro_formatter(self, match, fullmatch):
 +        name = fullmatch.group('macroname')
 +        if name in ['br', 'BR']:
 +            return '&nbsp;'             # new line should be removed.
 +        else:
 +            return '[[%s]]' % name      # show only macroname.
 +
      def format(self, text, out):
          if not text:
              return
 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2232>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list