Rename file extensions from the command line
The default file extension for a post or story in Nikola is .txt and this is also the designator that you are creating the content using Restructured Text.
That's fine except most text editors recognize the extension of the file and will present you with "options" based on that. With txt, there aren't really any helper tools.
Since I do use Restructured Text, I made the following changes.
- Modify conf.py.
Change:
post_pages = ( ("posts/*.txt", "posts", "post.tmpl", True), ("stories/*.txt", "stories", "story.tmpl", False),
To:
post_pages = ( ("posts/*.rst", "posts", "post.tmpl", True), ("stories/*.rst", "stories", "story.tmpl", False),
- Change the extension on all the files in the posts and stories directories to rst.
There are two ways to do this depending on what your terminal will allow. Within each directory, run one of the following commands.
The first is using the rename command:
rename .txt .rst *.txt
If your shell doesn't have the rename command, use a small script to do the same thing:
for file in *.txt ; do mv $file `echo $file | sed 's/\(.*\.\)txt/\1rst/'` ; done
Now when you create or edit a post or story, your editor will recognize the .rst extension and enable any Restructured Text plugins or syntax specific functionality.