Coder Social home page Coder Social logo

john-bokma / tumblelog Goto Github PK

View Code? Open in Web Editor NEW
110.0 5.0 6.0 13.37 MB

A static tumblelog generator available as both a Perl and Python version

License: MIT License

HTML 3.29% Perl 37.69% Python 33.49% SCSS 24.69% Dockerfile 0.84%
static-site-generator static-blog python3 perl5 tumblelog microblog blog perl

tumblelog's Introduction

tumblelog: a static microblog generator

tumblelog is a static microblog generator. There are two versions available, one written in Perl and one written in Python. Which version you use is up to you; I make an effort to keep the output of both versions identical.

The input is a single "Markdown" file divided into pages by starting a line with a date followed by a title. Each date page can further be split up into multiple articles using a single % on a line by itself.

Parameters to control the blog are given via command line arguments. The program creates the blog HTML5 pages and both a JSON and RSS feed.

Python Version Quick Start

Install sass and pip3 for Linux:

sudo apt install -y git sass python3-pip

For macOS:

brew install sass
brew install pip3

Then:

git clone https://github.com/john-bokma/tumblelog.git
cd tumblelog
python3 -m venv venv
pip3 install commonmark
pip3 install regex
source venv/bin/activate
mkdir htdocs

Generate a stylesheet. I use steel for example. See the directory styles for others you can use (except the ones that start with an underscore).

sass --sourcemap=none -t compressed styles/steel.scss htdocs/steel.css

To generate a version of the example site that does not use tags use:

python3 tumblelog.py --template-filename tumblelog.html \
        --output-dir htdocs/ \
        --author 'Test' --name 'Test Blog' --description 'This is a test' \
        --blog-url 'http://localhost:8000/' --css steel.css \
        tumblelog.md

To generate a version of the example site that uses tags (recommended) use:

python3 tumblelog.py --template-filename tumblelog-tags.html \
        --output-dir htdocs/ \
        --author 'Test' --name 'Test Blog' --description 'This is a test' \
        --blog-url 'http://localhost:8000/' --css steel.css --tags \
        tumblelog-tags.md

To view the generated site at http://localhost:8000/ enter:

cd htdocs
python3 -m http.server

Documentation

Style Examples

A screenshot of the four styles that come with tumblelog

A screenshot of four of the twelve styles that come with tumblelog.

The screenshots directory has 1:1 examples of themes that come with tumblelog.

Blogs

If you want your tumblelog generated site listed here, please let me know.

Docker (Experimental)

This assumes you have already used Sass to create a CSS file and copied it into a directory for your website.

To create a Perl image use:

docker build --tag tumblelog/perl -f perl.Dockerfile .

To run the container use (version with tags):

docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` \
       tumblelog/perl --template-filename tumblelog-tags.html \
       --output-dir htdocs/ \
       --author 'Test' --name 'Test Blog' --description 'This is a test' \
       --blog-url 'http://localhost:8000/' --css steel.css --tags \
       tumblelog-tags.md

To create a Python image use:

docker build --tag tumblelog/python -f python.Dockerfile .

To run the container use (version with tags):

docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` \
       tumblelog/python --template-filename tumblelog-tags.html \
       --output-dir htdocs/ \
       --author 'Test' --name 'Test Blog' --description 'This is a test' \
       --blog-url 'http://localhost:8000/' --css steel.css --tags \
       tumblelog-tags.md

Both containers run in a GMT timezone. To change this set the TZ variable, e.g. TZ="Europe/Amsterdam". See Timezones in Alpine Docker Containers.

tumblelog's People

Contributors

john-bokma avatar njacobs5074 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tumblelog's Issues

sass and libcmark-dev packages unavailable in Ubuntu 18.04

Hello!

I wanted to get your wonderful tumblelog up and running, but I'm not clear on the best way to handle sass and libcmark-dev not being available for 18.04.

Any suggestions?

I was planning to go the Perl route so I can serve static files.

Thank you!

ModuleNotFoundError: No module named 'yaml'

Hello.
I was looking for a static site generator and found this software.
When I tried it, I found that it requires PyYAML on my environment.
The environment is Debian sid amd64.

$ python3 tumblelog.py --template-filename tumblelog.html \
        --output-dir htdocs/ \
        --author 'Test' --name 'Test Blog' --description 'This is a test' \
        --blog-url 'http://localhost:8000/' --css steel.css \
        tumblelog.md
Traceback (most recent call last):
  File "/home/matoken/src/tumblelog/tumblelog.py", line 16, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

I was able to install it by following these steps.

$ git diff README.md
diff --git a/README.md b/README.md
index c73b036..4931be4 100644
--- a/README.md
+++ b/README.md
@@ -31,9 +31,10 @@ Then:
 git clone https://github.com/john-bokma/tumblelog.git
 cd tumblelog
 python3 -m venv venv
+source venv/bin/activate
 pip3 install commonmark
 pip3 install regex
-source venv/bin/activate
+pip3 install PyYAML
 mkdir htdocs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.