Modify

Opened 14 years ago

Last modified 4 years ago

#7748 new defect

Make definition lists work

Reported by: trac@… Owned by:
Priority: normal Component: MediaWikiPluginMacro
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Definition lists like

;Fruits
:Apples, Oranges
;Vegetables
:Carrots, Cabbage

Makes the processor barf with:

NameError: global name 'findColonNoLinks' is not defined

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by anonymous

Interestingly this function wasn't implemented at all in the parser.

I made a meek attempt at porting the function from PHP:

_colonPat = re.compile( ur':|<|-\{', re.UNICODE )
def findColonNoLinks( str ):
    """Return the string before and string after the colon."""

    fcnl_match = _colonPat.search(str)
    if not fcnl_match:
        return False, u'', u''

    if fcnl_match.group() == u':':
        return True, fcnl_match.string[:fcnl_match.start()], fcnl_match.string[fcnl_match.end():]

    # TBD ...
    # Ugly state machine to walk through avoiding tags.
    #  ... etc

    # Note: Original PHP code listed here.
    # https://doc.wikimedia.org/mediawiki-core/master/php/BlockLevelPass_8php_source.html

    return False, u'', u''

The places this function is called, I replaced with the following:

                    fcnl_result, term, t2 = findColonNoLinks(t)
                    if fcnl_result:

These changes create a minimum of functionality for the definition lists.

It's possible that porting the rest of the function from PHP would be fairly straightforward. I know the users I support mostly use Mediawiki, but they don't seem to use this macro, instead using Trac markup directly.

comment:2 Changed 4 years ago by Ryan J Ollos

Owner: permon deleted

comment:3 Changed 4 years ago by Ryan J Ollos

This plugin appears to be unmaintained. Would you like committer access?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.