Refoactor: transform angle brackets into square brackets in process phase

hingo - July 13, 2008 - 22:08
Project:Footnotes
Version:6.x-2.x-dev
Component:Footnotes.module
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

Now that we support both <fn> and [fn] syntax, there is an increasing amount of code doing "the same thing twice" and/or regexps getting more complex.

It would simplify code and just generally make sense to use the "process:" phase to make following transformations:

<fn([^>]*)> to [fn\1]
</fn> to [/fn]
<footnotes(( )?\/)?> to [footnotes\1]

After this, all other code could be simplified to assume input always uses [fn] syntax.

#1

hingo - July 13, 2008 - 23:08

Note: This should be done at the beginning of "process:" phase, not "prepare:" phase. Square brackets have special meaning in some other filters like MediaWiki, BBCode and Textile, so it is safer to not do anything in "prepare" but only convert them "internally" in the "process" phase.

#2

hingo - July 27, 2008 - 18:33
Status:active» fixed

Done and committed. I actually ended up doing the opposite, all [fn] are replaced with <fn> so internally it's all angle brackets after that.

#3

hingo - July 27, 2008 - 18:33
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.