[pmwiki-users] Definition Lists
DaveG
pmwiki at solidgone.com
Sat Feb 18 17:46:09 CST 2006
As an fyi, I had to change the markup to include two colons before the
definition. A single colon messed things up when the definition included
an external link, since the external link became http:. So now the
markup is:
::term::definition
I also now have two markups to accommodate terms not starting with a-z.
Basically I don't define anchor tags for terms not starting with a-z.
# No Anchor defined (for terms starting with non-alpha
Markup('^terms1:', 'directives', '/^::([^a-z].*)::(.*)$/i',
'<b>$1:</b> $2');
# ::term::definition
Markup('^terms2:', 'directives', '/^::([a-z].*)::(.*)$/i',
'[[#$1]]<b>$1:</b> $2');
Patrick R. Michaud wrote:
> On Sat, Feb 18, 2006 at 06:22:55PM -0500, DaveG wrote:
>>>> are not allowed to begin with digits or contain spaces.
>> Is there a way to have the regex strip the spaces from the definition name?
>
> 1. Do you want them stripped or converted to underscores?
Not sure I see a difference either way, although underscores isn't
removing information, so it's probably a minimally better solution. What
would be really neat is if the anchor contained the underscore, but the
user visible Term text still contained the space:
::multi word::definition
becomes:
<a name='multi_word' id='multi_word'></a><b>multi word:</b> definition
> 2. Do you need PmWiki to also be able to do the same thing on the
> linking end -- i.e., to be able to convert... ?
>
> [[#my tag | link text]]
I hadn't thought it would be possible to affect this side of things. I
think it would make sense for the conversion to also happen on this
side, if possible.
>
> Pm
>
>
>> Patrick R. Michaud wrote:
>>> On Sun, Feb 12, 2006 at 06:17:53PM -0500, DaveG wrote:
>>>> Well it works until it hits a term starting with a number, or with more
>>>> than one word. Anyone who understands regex help out? Ref
>>>> http://mr2wiki.com/Main/WikiSandbox.
>>>>
>>>> DaveG wrote:
>>>>> Here's what I used. Seems to work fine...
>>>>> Markup('^terms:', 'fulltext',
>>>>> '/^::(.*?):(.*?)$/i', '[[#$1]]<b>$1:</b> $2');
>>> The problem likely isn't the regex, it's that anchors
>>> are not allowed to begin with digits or contain spaces.
>>> See http://www.w3.org/TR/html4/types.html#type-name for why
>>> this is so.
>>>
>>> Thus:
>>>
>>> ::3rd:some text
>>> ::my tag:some text
>>>
>>> becomes
>>>
>>> [[#3rd]]<b>3rd:</b> some text
>>> [[#my tag]]<b>my tag:</b> some text
>>>
>>> and PmWiki doesn't recognize [[#3rd]] or [[#my tag]] as a valid anchors.
>>>
>>> Pm
>>>
>>>
>>>
>>>>> DaveG wrote:
>>>>>> I'd like to extend the definition list formatting:
>>>>>> :term:definition of term
>>>>>>
>>>>>> to include anchor links, and additional styling with output like:
>>>>>> [[#term]]'''term''': definition of term
>>>>>>
>>>>>> what is the name of the markup I should be looking at? Would it be
>>>>>> easier to simply define my own markup?
>>>>>>
>>>>>> ~ ~ Dave
>>
>
More information about the pmwiki-users
mailing list