diff --git a/Makefile b/Makefile deleted file mode 100644 index 5e57306..0000000 --- a/Makefile +++ /dev/null @@ -1,15 +0,0 @@ - - -all: template.html content.txt timeline.css - python microblog.py ./template.html ./content.txt > result.html - -# for people who don't want to read the README -# and want to hit `make` to see how things work. -template.html: - cp ./example/template-generic.html ./template.html - -timeline.css: - cp ./example/timeline-generic.css ./timeline.css - -content.txt: - cp ./example/demo.txt ./content.txt diff --git a/README.md b/README.md index 92b087f..afa10a1 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,33 @@ Simple and stylish text-to-html microblog generator. ## Requirements - python3 make date + python3 date make curl pycurl urllib -`date` is `date` from GNU Core Utilities. +`date` is `date` from GNU Core Utilities. `make` is only used to demonstrate the examples in `example/`. The latter three are optional; `curl`, `pycurl` and `urllib` are only used for the uploader script. -## Usage +### Usage -Invoke `make`. +Send three arguments minimum to `python`. The fourth argument for an e-mail address is optional. -This script reads content from a text file and applies the content to an html template. It will format hashtags, links, and images automatically. The template must contain three placeholders, in order, for the post count, tag cloud, and timeline content. + python microblog.py ./template.html ./content.txt user@mailhost.tld + +The resulting web page is outputted from standard output. Therefore: + + python microblog.py ./template.html ./content.txt user@mailhost.tld > result.html + +Use a Makefile (or another script) to simplify invocation. + + cp example/Makefile . + +This script generates three text files after operation. + +* `postsperpage.txt`, holds an integer for the number of posts to render per page (default: 20). Thi is a configuration file that is created if it does not exist). +* `lastfullpage.txt`, holds an integer for the last page rendered by the paginator. +* `updatedfiles.txt`, a list of files updated by the script for use in automated uploads. ### Writing Content -See example.txt. +See `example/demo.txt`. The content file is a plain text file of posts. Each post has two types of information: timestamp and message. For example: @@ -37,18 +51,6 @@ The content file is a plain text file of posts. Each post has two types of infor * the two last lines of the file must be empty * html can be placed in the message for embedded videos and rich text -### Generation - -Send three arguments minimum to `python`. The fourth argument for an e-mail address is optional. - - python microblog.py ./template.html ./content.txt user@mailhost.tld - -The resulting web page is outputted from standard output. Therefore: - - python microblog.py ./template.html ./content.txt user@mailhost.tld > result.html - -Use the Makefile (or another script) to simplify invocation. - ## Anything else This is a script I wrote for personal use. The output can be seen on [https://likho.neocities.org/microblog/index.html](https://likho.neocities.org/microblog/index.html). I figure someone else may want to use it for their own personal websites, so it is published. diff --git a/example/Makefile b/example/Makefile new file mode 100644 index 0000000..f25dbc5 --- /dev/null +++ b/example/Makefile @@ -0,0 +1,22 @@ + + +all: template.tpl content.txt timeline.css + python microblog.py ./template.tpl ./content.txt > result.html + +# for people who don't want to read the README +# and want to hit `make` to see how things work. +template.tpl: + cp ./example/default.tpl ./template.tpl + +timeline.css: + cp ./example/timeline.css ./timeline.css + +content.txt: + cp ./example/demo.txt ./content.txt + +.PHONY: clean +clean: + rm ./pages/*.html + rm ./tags/*/*.html + rm lastfullpage.txt + rmdir ./pages ./tags/* ./tags diff --git a/example/template-generic.html b/example/default.tpl similarity index 68% rename from example/template-generic.html rename to example/default.tpl index 5fad48c..8a9e2a2 100644 --- a/example/template-generic.html +++ b/example/default.tpl @@ -13,25 +13,30 @@
%s
+{tags}
%s
+{pages}