I'm working on a plug-in that contains a few dynamic tags and one of them needs to access some details of the AST node in the balise_*_dyn() function. At the moment I'm using the "add a new parameter node to the AST before calling calculer_balise_dynamique()" technique I've seen in a few built-in tags. I've written up a short description of this technique at <http://passingcuriosity.com/2009/dynamic-tags-fake-arguments-ast-mangling-in-spip/>. Is there a better way to do this?
Also: while trying to get this to work I looked for the AST documentation that used to be at <http://doc.spip.org/@details-sur-l-AST> but it has been deleted. Has this article moved somewhere else or been deleted? Is it coming back? Is the information available somewhere else? I don't mind using spip_log(print_r($p, TRUE)), but it does get a little bit boring at times.
I’m working on a plug-in that contains a few dynamic tags and one of them needs to access some details of the AST node in the balise_*_dyn() function. At the moment I’m using the « add a new parameter node to the AST before calling calculer_balise_dynamique() » technique I’ve seen in a few built-in tags. I’ve written up a short description of this technique at <http://passingcuriosity.com/2009/dynamic-tags-fake-arguments-ast-mangling-in-spip/>. Is there a better way to do this?
Also: while trying to get this to work I looked for the AST documentation that used to be at <http://doc.spip.org/@details-sur-l-AST> but it has been deleted. Has this article moved somewhere else or been deleted? Is it coming back? Is the information available somewhere else? I don’t mind using spip_log(print_r($p, TRUE)), but it does get a little bit boring at times.
Yeah, I've looked through the code in that file, but it doesn't help much. The are only a few comments and all of the code that creates and modifies these objects is in other files. The way I figured out how to do this was to run
grep -r calculer_balise_dynamique *
and
grep -r Texte * | grep new
in /ecrire/.
It seems that your method is the good one.
I think it would be better if there were an "official" way to pass extra arguments into the balise_*_stat() functions. I've created a new ticket on Trac as per Fil's request http://trac.spip.org/trac/spip/ticket/1728 and I've attached a patch to it which modifies calculer_balise_dynamique() to take an optional array of extra "arguments" as I described in the conclusion of my blog post.
On Wed, Mar 11, 2009 at 7:39 AM, Thomas Sutton <thomas@bouncingorange.com> wrote:
Hi all,
I'm working on a plug-in that contains a few dynamic tags and one of them needs to access some details of the AST node in the balise_*_dyn() function. At the moment I'm using the "add a new parameter node to the AST before calling calculer_balise_dynamique()" technique I've seen in a few built-in tags. I've written up a short description of this technique at <http://passingcuriosity.com/2009/dynamic-tags-fake-arguments-ast-mangling-in-spip/>\. Is there a better way to do this?
Also: while trying to get this to work I looked for the AST documentation that used to be at <http://doc.spip.org/@details-sur-l-AST> but it has been deleted. Has this article moved somewhere else or been deleted? Is it coming back? Is the information available somewhere else? I don't mind using spip_log(print_r($p, TRUE)), but it does get a little bit boring at times.
I just get « There is no article at this address » with this URL.
It’s because I’m administrator, and so I can see this article even if it hasn’t been published for publication.
I’ve just changed the status of the article so that you can see it.
Of course, it’s incomplete and I’m afraid that you won’t find the information you’re looking for.
Yeah, I’ve looked through the code in that file, but it doesn’t help much. The are only a few comments and all of the code that creates and modifies these objects is in other files. The way I figured out how to do this was to run
It’s because only a few persons understand what does this part of the core do
grep -r calculer_balise_dynamique *
and
grep -r Texte * | grep new
in /ecrire/.
It seems that your method is the good one.
I think it would be better if there were an « official » way to pass extra arguments into the balise_*_stat() functions. I’ve created a new ticket on Trac as per Fil’s request http://trac.spip.org/trac/spip/ticket/1728 and I’ve attached a patch to it which modifies calculer_balise_dynamique() to take an optional array of extra « arguments » as I described in the conclusion of my blog post.
good idea.
I have no objection – but for me the core of SPIP is like a magic box ^^ –
I’m working on a plug-in that contains a few dynamic tags and one of them needs to access some details of the AST node in the balise_*_dyn() function. At the moment I’m using the « add a new parameter node to the AST before calling calculer_balise_dynamique() » technique I’ve seen in a few built-in tags. I’ve written up a short description of this technique at <http://passingcuriosity.com/2009/dynamic-tags-fake-arguments-ast-mangling-in-spip/>. Is there a better way to do this?
Also: while trying to get this to work I looked for the AST documentation that used to be at <http://doc.spip.org/@details-sur-l-AST> but it has been deleted. Has this article moved somewhere else or been deleted? Is it coming back? Is the information available somewhere else? I don’t mind using spip_log(print_r($p, TRUE)), but it does get a little bit boring at times.
On Wed, Mar 11, 2009 at 7:39 AM, Thomas Sutton
<thomas@bouncingorange.com> wrote:
Also: while trying to get this to work I looked for the AST documentation
that used to be at <http://doc.spip.org/@details-sur-l-AST> but it has been
deleted. Has this article moved somewhere else or been deleted? Is it coming
back? Is the information available somewhere else? I don't mind using
On Wed, Mar 11, 2009 at 7:39 AM, Thomas Sutton
<thomas@bouncingorange.com> wrote:
Also: while trying to get this to work I looked for the AST documentation
that used to be at <http://doc.spip.org/@details-sur-l-AST> but it has been
deleted. Has this article moved somewhere else or been deleted? Is it coming
back? Is the information available somewhere else? I don't mind using
Thanks for this. I probably should have saved my own copy (and now, I have). I've started to translate this article into English at <http://doc.spip.org/ecrire/?exec=articles&id_article=5865>\. At the moment it is just the documentation of the AST classes. I'll try to finish the translation (which is not too good, it's me and BabelFish with very occasional assistance from Geraldine on French idioms, etc.)
I have not fixed any of the factual errors, but will endeavour to do so as soon as I find time.
Ones I've noticed so far include:
* Some of the "common elements" don't appear to be common. The Critere class, for example, doesn't have the `type`, `apres`, or `avant` fields in spite of the note implying otherwise.
* The `type` field is not the same as the result of get_class(). That function returns the name of the class as defined ("Critere", not "critere") and certainly doesn't return "include" for Inclure.
In any case, there will be more English and more details (which "other fields", etc.) coming as soon as I get the chance to figure it out and write it down.