Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Can render() append to the end of the document?
Avatar
zioth #1
Member since Jul 2011 · 77 posts
Group memberships: Members
Show profile · Link to this post
Subject: Can render() append to the end of the document?
I would like the render() method of my syntax plugin to render some things in-place, and save other things to be added just before the end of the document. Is there a way to do this, or would I have have to do something like:

- Queue up HTML fragments in a helper plugin.
- Create an action plugin to read the fragments and render them before the end of the document.
Avatar
LarsDW223 #2
Member since Sep 2014 · 370 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Eventually you could use the Event PARSER_HANDLER_DONE but I never used it myself. So you need to test and find out. See https://www.dokuwiki.org/devel:event:parser_handler_done.
Avatar
turnermm (Moderator) #3
Member since Oct 2009 · 4446 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #1
Is there some reason why you can't have separate markup for the end of the file?  If you can, then here is a suggestion. 

I assume that you are collecting data in your syntax plugin as you move through it.  So, create a new class variable in your helper and a setter method which you can call from the syntax plugin.  Call that method when you have to add data.  Then create a getter method which enables you to retrieve the data.  At the end of your page, insert a special pattern, which is set in  
  $this->Lexer->addSpecialPattern().
Then replace the special  pattern with the saved data in your renderer.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
zioth #4
Member since Jul 2011 · 77 posts
Group memberships: Members
Show profile · Link to this post
I don't want to make users add a special pattern to the end of each wiki page. It's a strange requirement, and people (including me) will forget. I think I might be stuck with the Action plugin solution.

That is, unless I can add a special pattern that will capture the end of the document, without messing up other plugins. I just tried: $this->Lexer->addSpecialPattern('$', ...). It made the content fail to render at all.
Avatar
turnermm (Moderator) #5
Member since Oct 2009 · 4446 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Probably either misconfigured or bad regex.  And '$' cannot be used as is for a regex, at the very least has to be escaped.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
zioth #6
Member since Jul 2011 · 77 posts
Group memberships: Members
Show profile · Link to this post
Yes, I know that now. I was just checking whether I could match the end of the document ($) without breaking anything. The answer was no.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-01-17, 20:24:37 (UTC +01:00)