http://itb.me/Blog/gfx/ITB.png

itb.me


blog_maker..

First thoughts were to write each entry 'a la' by 'Pelican' to standardize on a format, this would involve writing the entry in markdown in a .txt (or .md) file with the first few lines being metadata eg

Title: My Blog Entry   
Date: 2012-01-01 
Tags: blog, markdown, python
Status: Draft

Then I wondered about just writing the entries as .content files as normal in the maker, keeping all the editing in the existing workflows.

The blog_maker.py script would perform the following:

  1. Extract metadata from the .content file and reformat in a consitent way.
  2. Rename the file as Title+Date and the same with the associated .head file.
  3. Any entry with metadata Status: set to draft would have the distribution table entry removed.
  4. Any entry with metadata Status: set to timed would efectively be draft until the Date: was passed.
  5. Status would only be displayed for 'Draft' and 'Timed'.
  6. Generate a list of entries page. (this would be the blog home page)
  7. Generate a list of tags page.
  8. Generate a page for each tag, listing all the entries with that tag.
  9. Manage updates to the distribution table and create .head files for any new file created.
  10. reformat some elements in the page to make use of the kickstart.css
  11. Optionally generate a single .md file containing all entries in 'Pelican' format for export and search purposes. with each entry being delimited by a space, double horozontal line, then a space as below:
white space  
--- (markdown for horizontal line)
white space
--- (markdown for horizontal line)
white space  

e.g. the following initial .content entry.

Title: My Blog Entry    
Date: 2012-01-01    
Tags: blog, markdown, python   

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

would become:

Date: 1st Jan 2012

My Blog Entry

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

*Tags: [blog](tag_blog_en.htm),[markdown](tag_markdown_en.htm), [python](tag_python_en.htm)*

which would generate the following HTML:

Date: 1st Jan 2012

My Blog Entry

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Tags: blog,markdown, python


So the workflow would be as follows for non-draft entries:

  1. Create an new .content file (you could call it 'blog' as it will be renamed)
  2. include the relevant metadata at the top.
  3. write your entry in markdown and html.
  4. close the file.
  5. run the blog_maker.py script.
  6. close then reopen the maker (so that it registers the new files and changes)
  7. preview - edit - preview, unitil satisfied.
  8. 'publish' to push to your web host.

For draft entries being made non-draft you would have to repeat steps 4 to 8 after you edited the .content file

(Basically! every time you run the script, you should close the file and restart the maker)

"Perhaps I'm old and tired, but I think that the chances of finding out what's actually going on are so absurdly remote that the only thing to do is to say, "Hang the sense of it," and keep yourself busy. I'd much rather be happy than right any day. ":
...Slartibartfast

http://itb.me/Blog/gfx/Newtons_cradle.gif

© 2012

Blog