As often, I have many ideas of useful tools that could ease software users’ life. I’m a new user of Pelican, and I already have some ideas for it too. But as usual, I don’t have much time to translate my ideas into proper software. So the simplest approach is to write something in the middle, trying to get most of the convenience for shorter time.
So here we go, hacking a (preferably) small Python script to do as much work for me as possible. The first contraint was to not introduce any dependency except Python 3. The tasks the script should do are:
- initiating an article ;
- asking the user for a title, a summary and a category ;
- adding the current date automatically ;
- initiating the article as draft.
Small disclaimer: I’m probably not the best Python developer around, but I always try to do my best. You’ll be able to see what I did at the Pelistart Github’s page. So, in order, here what it does:
- first, it detects the format you use (Markdown, reStructuredText or AsciiDoc) depending on existing files into
contentdirectory ; if no format is found, one is picked (almost) randomly, it is not completely satisfying I know, this is something I should probably do better…
- next step is to build the header with every metatdata:
dateis easy and straightforward to get ;
tagsare not set, it is up to you ;
titleis asked to the user ;
summaryis asked to the user too ;
categoryis asked to the user, but to make it easy, existing categories are found through articles and proposed, but you can create a new one.
- a file is written into the right directory and open into the user’s editor.
To use (and love) it, just put the
pelistart.py file into your Pelican’s directory and invoke it.
Nothing fancy after all, right? Hope you’ll like and use it!