[dokuwiki] Re: New Pagemove Plugin (Brainstorming)

  • From: Mykola Ostrovskyy <spambox03@xxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 23 Mar 2010 01:24:10 +0100

Hello Michael,

MK> Then you end up using regex again, I don't know, but the phrase "more
MK> reliable" than just switching out array values in the instructions list 
kinda
MK> doesn't sound right to me here ;-).

Yeah, I know. Regex's are evil. Wait, doesn't lexer use them to parse the 
pages? ;)
Though, I do agree that "more reliable" was quite unfortunate choice of words :)


MK> Can you give an example of what you're doing with the instructions? Do you 
add
MK> extra plugin instructions (that should be no problem). Or do you something
MK> different?

In Columns plugin I move around section_[open|close|edit] instructions to 
improve interaction
between section <div> tags and the columns <table>. I guess it should be benign 
as this instructions
have no text attached to them.

In RefNotes I run lexer recursively on a piece of wiki text and stuff resulting 
instructions into a
nest. The nested block triggers the plugin to capture rendered output to be 
used elsewhere, so the
contents of this block doesn't show up at the point of nesting (like footnotes) 
nor it is present
in the wiki text (unlike the footnotes).

Sorry for confusing description but the point is that plugins can do things to 
the instructions. And
it is difficult to say in advance will those things get in the way if you try 
to recover the original
wiki text from the instruction stream.

So even if it sounds ugly, I still think that you could avoid some 
compatibility issues by taking
offsets of links (or any other instructions of interest) from the instruction 
stream and then
patching the text file at those offsets. Of course, it would be nice to verify 
that text at the
offset matches the text from the instruction before you overwrite it with fixed 
link. And indeed
regex's could be used for that ;)


Mykola

-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: