项目作者: paulohrpinheiro

项目描述 :
Blog Generator - my own static site generator
高级语言: Ruby
项目地址: git://github.com/paulohrpinheiro/gerablog.git
创建时间: 2016-12-26T23:26:13Z
项目社区:https://github.com/paulohrpinheiro/gerablog

开源协议:MIT License

下载


GeraBlog

Gem Version
Code Climate
Test Coverage
Issue Count
travis-CI

Blog Generator - my own static site generator

Write in Markdown, publish in HTML.

I'm GeraBlog
Image created by https://robohash.org/

Rules

  • The texts must be written in markdown.
  • The first line of file will be the post title # mark.
  • The second line is a blank line.
  • The third line will be the description of text, with ## mark. Will be in meta description of generated html.
  • The filename MUST begin with a date: 2016-12-31-this-is-a-post.md.
  • The texts must be in a subdirectory of texts. Each subdirectory will be assigned a category.
  • Change the layout by changing files in templates dir, which uses Tenjin as template system.
  • JS andCSS files put in assets/{css, js}.
  • The images used in the posts should be placed in a images subdirectory, within the category directory:texts/ruby/images/pinkpanter.jpg. In the post, put the reference as ![Pink Panter](images/pinkpanter.jpg).
  • Images used in posts MUST be placed in the same levelCATEGORY/images.
  • By default, GeraBlog uses prism to highlight the syntax of the codes. The language indicated will be the category in which the text is. For example, the file ruby/2016-12-31-ruby-rocks.md if it has some source code, it will be marked as lang-ruby.

Sample text:

  1. # This is the title
  2. ## This is the description
  3. Here the text.
  4. Show-me the code:
  5. puts 'Hello world!'

Install

  1. gem install gerablog

Hacking

  • clone the repo;
  • bundle install;
  • make changes (with tests!)
  • run all the tests (rake) and fix anything that appears wrong
  • run rubocop and fix all offenses!
  • send me a PR.

Using

The executable gerablog has this options:

-h or --help

Yes, we have a --help option:

  1. gerablog --help
  2. Usage: optparse [options]
  3. -h, --help Display this screen
  4. -n, --new FILENAME Create a new project.
  5. -g, --generate FILENAME Generate the static blog.

-n or --new

Create a new project:

  1. gerablog --new /tmp/test

How the project looks like?

  1. tree /tmp/test
  2. /tmp/test
  3. ├── assets
  4. └── assets
  5. ├── css
  6. ├── gerablog.css
  7. └── prism.css
  8. └── js
  9. └── prism.js
  10. ├── gerablog.conf
  11. ├── output
  12. ├── templates
  13. └── templates
  14. ├── categories.rbhtml
  15. ├── category.rbhtml
  16. ├── feed.rbxml
  17. ├── footer.rbhtml
  18. ├── header.rbhtml
  19. ├── index.rbhtml
  20. └── post.rbhtml
  21. └── texts

If --root is not informed, root will be ./.

-g or --generate

Deploy

For my blog:

  1. gerablog --generate ~/Dropbox/projetos/paulohrpinheiro.xyz/blog/gerablog.conf
  2. ruby
  3. diversos
  4. programadorbipolar
  5. javascript
  6. c
  7. perl
  8. rust
  9. python

Copy output directory to your server :)

History

This project started with a script I made to generate my site https://paulohrpinheiro.xyz.

The script is in this gist:

https://gist.github.com/paulohrpinheiro/20130e06355fc5bffe5865ce903dce63