Edgewall Software

Changes between Version 60 and Version 62 of WikiProcessors


Ignore:
Timestamp:
(multiple changes)
Author:
(multiple changes)
Comment:
(multiple changes)

Legend:

Unmodified
Added
Removed
Modified
  • WikiProcessors

    v60 v62  
    179179|||| ||
    180180
     181Since 1.1.2 the default, coding highlighting and MIME-type processors support the argument `lineno` for adding line numbering to the code block. When a value is specified, as in `lineno=3`, the numbering will start at the specified value. When used in combination with the `lineno` argument, the `marks` argument is also supported for highlighting lines. A single line number, set of line numbers and range of line numbers are allowed. For example, `marks=3`, `marks=3-6`, `marks=3,5,7` and `marks=3-5,7` are all allowed. The specified values are relative to the numbered lines, so if `lineno=2` is specified to start the line numbering at 2, `marks=2` will result in the first line being highlighted.
     182
    181183Using the MIME type as processor, it is possible to syntax-highlight the same languages that are supported when browsing source code.
    182184
     
    245247 }}}
    246248}}}
     249{{{#!comment
     250Uncomment for Trac 1.2 release.
     251{{{
     252{{{#!python lineno=3 marks=3,5-6,8
     253def expand_markup(stream, ctxt=None):
     254    """A Genshi stream filter for expanding `genshi.Markup` events.
     255
     256    Note: Expansion may not be possible if the fragment is badly
     257    formed, or partial.
     258    """
     259    for event in stream:
     260        if isinstance(event[1], Markup):
     261            try:
     262                for subevent in HTML(event[1]):
     263                    yield subevent
     264            except ParseError:
     265                yield event
     266        else:
     267            yield event
     268}}}
     269}}}
     270Line numbers can be added to code blocks and lines can be highlighted //(since 1.1.2)//.
     271{{{#!python lineno=3 marks=3,5-6,8
     272def expand_markup(stream, ctxt=None):
     273    """A Genshi stream filter for expanding `genshi.Markup` events.
     274
     275    Note: Expansion may not be possible if the fragment is badly
     276    formed, or partial.
     277    """
     278    for event in stream:
     279        if isinstance(event[1], Markup):
     280            try:
     281                for subevent in HTML(event[1]):
     282                    yield subevent
     283            except ParseError:
     284                yield event
     285        else:
     286            yield event
     287}}}
     288}}}
    247289
    248290For more processor macros developed and/or contributed by users, visit: