ZZBlogX A static blog generator

Q&A's, tips, howto's
Locked
didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

ZZBlogX A static blog generator

Post by didi »

I wrote another newLISP programm - ” ZZBlogX – A Static Blog Generator

ZZBlogX generates dozens of blog like html-pages in a second. I wrote this program as an easier and more flexible replacement for my Wordpress blogs. In contrast to eg. Wordpress the pages are ’static’ that means you do not need a database on your webspace and the pages are loading faster.

The only thing what you have to do, is to store your articles as simple text files. In the next article “Quick Start” you’ll find all you need for a first try.

ZZBlogX is an easy to use, very small and fast “textbased static blog generator” , currently only for Windows, written in the funtastic “newLISP” programming language and it’s Opensource.

ZZBlogX …

reads the “settings.lsp” file
reads your text files for example “01.txt” “02.txt” and so on.
takes the first line as headline
takes the last line as categories separated by commas
takes the text between first and last line as the article
takes the file-date as the post date (alternatives possible)
generates a temporary database
sorts all articles by time
generates a main-page “index.html”
if necessary “index1.html” “index2.html” ..
generates a side-page for each category with at least 2 articles
inserts possible links to previous and next pages
inserts possible links to all category start pages

More about it here : http://www.ZZBlogX.com

PS: This ZZBlogX-Website is generated by ZZBlogX

PPS: Happy New Year to all !

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: ZZBlogX A static blog generator

Post by rickyboy »

There's no reason why this only runs in Windows; after all, it's written in newLISP. After changing the config items in settings.lsp (especially the directory names), I can invoke your software successfully, like this, on cygwin, Linux, or OS X (Darwin):

Code: Select all

ZZBlogX $ ./newlisp settings.lsp
saved the database in MyDataBase.txt
02
03
04
05
201301021750
201301031180
saved the database in MyDataBase.txt
database is generated !
HTML Pages without links generated !
Links generated and inserted - all finished - Bye! ..
I bet Norman can run it on OS2 also. :)

Also, I used the newLISP I already had installed on these machines. (They are at v 10.4.5. You shipped the v10.0.0 Windows binary.)

Good job and happy new year to you also!
(λx. x x) (λx. x x)

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: ZZBlogX A static blog generator

Post by cormullion »

Hey, Didi, this is good work. As ricky said, it's easy enough to run this on MacOS X or Unix, just ignore the .BAT and .EXE files, and run settings.lsp directly using

Code: Select all

newlisp settings.lsp
However, there are some issues with line breaks, since (on Mac) I'm using LFs rather than CRLFs. The line I changed to make something work was:

Code: Select all

191 ( set 'inlines ( parse intext "\\r|\\n" 0))    ; divide text into lines
which prevents an error. But also, there's an issue with the trailing CRLF at the end of each text file. This worked:

Code: Select all

Motivation

This is a test text - you can delete or change it

About
but this didn't go so well:

Code: Select all

Motivation

This is a test text - you can delete or change it

About
 
(I think this is a common problem with cross-platform code.)

I hope you've tested that nldb.lsp well - it seems to work OK for ZZBlogX, but I remember making some changes to some of the code when I realised that some things didn't work properly... :) The latest version is up on github. I was always worried by this line:

Code: Select all

(if (list? selection-function)
    (dolist (field columns) 
               (set-ref-all (expand ''field 'field) 
                      selection-function 
                      (row (find field columns)))))
which I eventually abandoned, for reasons that escape me now...!

And what's the thinking behind the name?! :)

didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Re: ZZBlogX A static blog generator

Post by didi »

Hi Ricky and Cormullion,

thankyou very much for looking at the program on different platforms - and the tipps what to change for that.

Cormullion, I use nldb since 4 years in my ShortNotizer-program nearly every day and so far it worked without problems, so I am quite confident that there is no problem but I'll make a new release with the newLISP 10.4.5 and with the new nldb.lsp from github.

PS:
Blog-X means Blog-Generator
ZZ is in german a shortcut for "ziemlich zuegig" what means "quite speedy" :)

didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Re: ZZBlogX A static blog generator

Post by didi »

Thank you for your Tipps, I made an update:

ZZBlogX New Version
Updated to newLIPS Version 10.4.5
Updated to nldb.lsp from Cormullion @version 2010-01-14 14:57:28

@Cormullion
First it didn't work with the new nldb, I had to change this functions:

Code: Select all

( select-rows 'myBlog '(= xdate 'datevalue)'( titel mtext mdate mcat )))) 
( select-rows 'myBlog '( find xcat 'mcat)'( datevalue ) 'datevalue '> ))
to

Code: Select all

( select-rows 'myBlog '(= xdate datevalue)'( titel mtext mdate mcat )))) 
( select-rows 'myBlog '( find xcat mcat)'( datevalue ) 'datevalue '> ))
That means I had to remove one quote ' before datevalue and mcat

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: ZZBlogX A static blog generator

Post by cormullion »

Good job! I actually found some change notes too...

http://newlisper.wordpress.com/category/newlisp/page/2/

Locked