running plugins / external scripts with each build

7 views
Skip to first unread message

Dave

unread,
Jul 19, 2016, 6:26:11 PM7/19/16
to nikola-discuss
Hi guys,

I am looking to create some plugins (auto teaser plugin, rest cleaner for common issues I always seem to make) that I currently run manually with some hard coded variables for the post folders. I'd like ideally to move these to nikola plugins so the folder paths can be read from the config and have them run each time I call build.

Anyway, not too sure what plugin type to use. I was thinking a signal task and I could hook in just after BUILD but there does not appear to be a signal for something of that.

Next idea was to write a command plugin, I think it could do what I want, but does mean manually having to call it, which is not what I want to do. I know I could write a script to do it, but was hoping there is a nikola way




tl;dr What plugin type should I use to run some code on the .rst files each build


Cheers

Chris Warrick

unread,
Jul 20, 2016, 7:38:24 AM7/20/16
to Nikola—Discuss
That might not be easy, but you might try a Task plugin that would
modify all changed .rst files. This would lead to a race condition
that careful dependencies should prevent (look at our posts/pages task
plugins). Or just use an outside script, or a plugin for your text
editor?

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

prosrcmedia

unread,
Jul 20, 2016, 9:15:53 AM7/20/16
to nikola-...@googlegroups.com
Thanks for your reply.

> but you might try a Task plugin that would
>> modify all changed .rst files. This would lead to a race condition
>> that careful dependencies should prevent

That sounds like solve one problem and make another


> or a plugin for your text
>> editor?

No that won't work as content is added to the posts folder from other
mechanisms



> . Or just use an outside script,

Yes, rather than trying to bend nikola to something it isn't really
supposed to do and make a mess of things in the process, sounds like an
outside script is the best way for this scenario


Cheers

tritiu...@sdamon.com

unread,
Jul 20, 2016, 3:49:25 PM7/20/16
to nikola-...@googlegroups.com
As of today there is a signal that fires just after the page is compiled. ...it is a good signal for adding in your own Teasers... since that’s what I submitted it for.
> --
> You received this message because you are subscribed to the Google Groups
> "nikola-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nikola-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Dave

unread,
Jul 22, 2016, 1:03:44 PM7/22/16
to nikola-discuss
Just saw this, interesting will take a look. Of course I just finished my own external plugin system to handle other requirements I have to modify the raw .rst files. But probably this new signal is better as my system is bound to be buggy :)
Reply all
Reply to author
Forward
0 new messages