This commit is contained in:
Phyks 2013-11-17 00:19:21 +01:00
parent 5bb9e3af05
commit 0c99b44c9a
6 changed files with 54 additions and 129 deletions

11
LICENSE
View File

@ -1,11 +0,0 @@
/*
* --------------------------------------------------------------------------------
* "THE NO-ALCOHOL BEER-WARE LICENSE" (Revision 42):
* Phyks (webmaster@phyks.me) wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff (and you can also do whatever you want
* with this stuff without retaining it, but that's not cool...). If we meet some
* day, and you think this stuff is worth it, you can buy me a --beer-- soda in
* return.
* Phyks
* ---------------------------------------------------------------------------------
*/

View File

@ -1,76 +0,0 @@
Blogit
======
A git based blogging software. Just as Jekyll and so, it takes your articles as
html files and computes them to generate static page and RSS feed to serve
behind a webserver. It uses git as a backend file manager (as git provide some
useful features like history and hooks) and Python for scripting the conversion
process. You can customize the python scripts to handle special tags (ie, not
standard HTML tags) just as <code> for example. See params file in raw
dir to modify this.
This project is still a WIP.
How it works ?
==============
There are three directories under the tree : raw for your raw HTML articles and
header/footer, gen (created by the script) for the temporary generated files
and blog for the blog folder to serve behind the webserver.
Articles must be in folders year/month/ARTICLE.html (ARTICLE is whatever you
want) and some extras comments must be put in the article file for the script
to handle it correctly. See the test.html example file for more info on how to
do it.
You can put a file in "wait mode" and don't publish it yet, just by adding
.ignore at the end of its filename; Every file that you put in raw and that is
not a .html file is just copied at the same place in the blog dir (to put
images in your articles, for example, just put them beside your articles and
make a relative link in your HTML article).
You should change the params file (raw/params) before starting to correctly set
your blog url, your email address and the blog title (among other parameters).
When you finish editing an article, just git add it and commit. The
pre-commit.py hook will run automatically and generate your working copy.
Note about tags : Tags are automatically handled and a page for each tag is
automatically generated. A page with all the articles for each month and each
year is also automatically generated.
Note : Don't remove gen/ content unless you know what you're doing. These files
are temporary files for the blog generation but they are useful to regenerate
the RSS feed for example. If you delete them, you may need to regenerate them.
Important note : This is currently a beta version and the hook isn't set to run
automatically for now. You have to manually run pre-commit.py (or move it to
.git/hooks but this has never been tested ^^).
Example of syntax for an article
================================
```HTML
<!--
@tags=*** //put here the tags for your article, comma-separated list
@titre=***i //Title for your article
@author=Phyks //Name of the author (not displayed by now)
@date=23062013-1337 //Date in the format DDMMYYYY-HHMM
->
<article content> (== Whatever you want)</article>
```
LICENSE
=======
TLDR; I don't give a damn to anything you can do using this code. It would just
be nice to quote where the original code comes from.
* -----------------------------------------------------------------------------
* "THE NO-ALCOHOL BEER-WARE LICENSE" (Revision 42):
* Phyks (webmaster@phyks.me) wrote this file. As long as you retain this notice
* you can do whatever you want with this stuff (and you can also do whatever
* you want with this stuff without retaining it, but that's not cool...). If we
* meet some day, and you think this stuff is worth it, you can buy me a
* <del>beer</del> soda in return.
* Phyks
* ------------------------------------------------------------------------------

View File

@ -537,8 +537,8 @@ for filename in added_files+modified_files:
if tags_comma != "":
tags_comma += ", "
tags_comma += ("<a href=\""+params["BLOG_URL"]+"/tags/"+tag+".html\">" +
tag+"</a>")
tags_comma += ("<a href=\""+params["BLOG_URL"] +
"/tags/"+tag+".html\">"+tag+"</a>")
# Write generated HTML for this article in gen /
article = replace_tags(article, search_list, replace_list)
@ -556,7 +556,8 @@ for filename in added_files+modified_files:
"\">"+title+"</a></h1>\n"
"\t\t"+article+"\n"
"\t\t<p class=\"date\">"+date_readable+"</p>\n"
"\t\t<p class=\"tags\">"+tags_comma+"</p>\n"
"\t\t<p class=\"tags\">Tags : "+tags_comma +
"</p>\n"
"\t</div>\n"
"</article>\n")
print("[INFO] (GEN ARTICLES) Article "+filename[4:]+" generated")
@ -567,7 +568,7 @@ for filename in added_files+modified_files:
# Starting to generate header file (except title)
tags_header = ""
for tag in tags_full_list:
tags_header += "<div class=\"categories\">"
tags_header += "<div class=\"tag\">"
tags_header += ("<img alt=\"test\" " +
"src=\""+params["BLOG_URL"]+"/tags/"+tag[9:-4]+".png\"/>")
tags_header += ("<span class=\"popup\">"+tag[9:-4]+"</span>")
@ -580,7 +581,7 @@ except IOError:
header = header.replace("@tags", tags_header, 1)
header = header.replace("@blog_url", params["BLOG_URL"])
articles_header = "<ul id=\"last_articles\">"
articles_header = ""
articles_index = ""
rss = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@ -651,8 +652,8 @@ for i, article in enumerate(["gen/"+x[4:-5]+".gen" for x in last_articles]):
# Finishing header gen
articles_header += ("</ul><p><a "+"href=\""+params["BLOG_URL"] +
"/archives.html\">"+"Archives</a></p>")
articles_header += ("<li><a "+"href=\""+params["BLOG_URL"] +
"/archives.html\">"+"Archives</a></li>")
header = header.replace("@articles", articles_header, 1)
try:

View File

@ -1,4 +1,4 @@
</div>
</div>
</body>
</div>
</div>
</body>
</html>

View File

@ -1,30 +1,41 @@
<!doctype html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>@titre</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="wrapper">
<div id="left">
<h1 id="head_title">Phyks' Blog</h1>
<hr/><hr/>
<h2>Catégories</h2>
<div id="categories">
@categories
</div>
<hr/>
<h2>Derniers articles</h2>
<div id="last_articles">
@articles
</div>
<hr/>
<h2>Liens</h2>
<ul class="links">
<li><a href="contact.html">Me contacter</a></li>
<li><a href="http://links.phyks.me">Mon shaarli</a></li>
<li><a href="http://projet.phyks.me">Mes projets</a></li>
</ul>
</div>
<div id="articles">
<head>
<meta charset="utf-8">
<title>@titre</title>
<link rel="stylesheet" href="design.css"/>
<link type="text/plain" rel="author" href="humans.txt"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<h1 id="sidebar-title"><a href="#base_url">~Phyks</a></h1>
<h2>Catégories</h2>
<nav id="sidebar-tags">
@tags
</nav>
<h2>Derniers articles</h2>
<ul id="sidebar-articles">
@articles
</ul>
<h2>Liens</h2>
<ul id="sidebar-links">
<li><a href="contact.html" title="Contact">Me contacter</a></li>
<li class="monospace"><a href="//links.phyks.me" title="Mon Shaarli">find ~phyks -type l</a></li>
<li><a href="https://github.com/phyks/" title="Github">Mon Github</a></li>
<li><a href="divers.html" title="Divers">Divers</a></li>
</ul>
</div>
<!-- Page content -->
<div id="header">
<h1><a href="#base_url">~Phyks</a></h1>
</div>
<div id="articles">

View File

@ -1,12 +1,12 @@
BLOG_TITLE = Phyks' blog
NB_ARTICLES_INDEX = 20
BLOG_URL = file:///home/lucas/Blog/git/blog/
BLOG_URL = http://localhost/Blog_test/blog/
#RSS params
WEBMASTER = webmaster@phyks.me (Phyks)
LANGUAGE = fr
DESCRIPTION =
COPYRIGHT =
DESCRIPTION = Test de desc
COPYRIGHT = CC L0
#Personal replacements
#Items are passed as arguments to a python regex,