Skip to content

Commit b7ca7d0

Browse files
committed
initial commit
0 parents  commit b7ca7d0

36 files changed

Lines changed: 1749 additions & 0 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.sw?
2+
_site
3+
_pages

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[Pippo](http://pippo.ro) site repository.
2+
3+
How to build
4+
-------------------
5+
Requirements:
6+
- [Git](http://git-scm.com/)
7+
- [Jekyll](http://jekyllrb.com/)
8+
9+
Steps:
10+
- create a local clone of this repository (with `git clone https://github.com/decebals/pippo-site.git`)
11+
- go to project's folder (with `cd pippo-site`)
12+
- make some modifications
13+
- test on your computer the modifications (see below section)
14+
- commit and push the modifications on github
15+
16+
Install Jekyll (Ubuntu 12.04 LTS)
17+
-------------------
18+
- `sudo apt-get install ruby1.9.3 ruby1.9.1-dev nodejs`
19+
- `sudo gem install jekyll`
20+
21+
Be sure that ruby 1.8 is not installed on your system, if so you have to remove it from the system.
22+
23+
Create a new page
24+
-------------------
25+
We are using [jekyll-docs-template](https://github.com/bruth/jekyll-docs-template) to generate the site.
26+
27+
The template follows a very simple convention of defining categories that correspond to sections in the navigation. Here are the default ones (they are listed in the `_config.yml`):
28+
29+
- `doc` - Documentation
30+
- `ref` - Reference
31+
- `tut` - Tutorial
32+
- `dev` - Developers
33+
- `post` - Posts
34+
35+
Since Jekyll is more geared towards blog posts, specifiying a date and setting up the front-matter can get tedious. Supplied in the `bin` directory is a simple Ruby scripy for creating a new _page_:
36+
37+
```bash
38+
ruby bin/jekyll-page title category [filename] [--edit]
39+
```
40+
41+
where `title` is the title of page, `category` is one of the categories defined in the `_config.yml`. By default the `filename` will be derived from the `title`, but you can specify an explicit filename (without the date) by passing the third agument. Finally the `--edit` (or just `-e`) will launch the editor defined by the `$EDITOR` environment variable.
42+
43+
#### Example
44+
45+
```bash
46+
./bin/jekyll-page "My New Page" ref
47+
```
48+
49+
Will produce a file `_posts/2013-06-05-my-new-page.md` with the [front-matter](http://jekyllrb.com/docs/frontmatter/) already defined:
50+
51+
```html
52+
---
53+
layout: page
54+
title: "My New Page"
55+
category: ref
56+
date: 2013-06-05 12:00:00
57+
---
58+
```
59+
60+
Simply add an `order` attribute to the front-matter of the page and the navigation links will be sorted accordingly (within it's section).
61+
62+
```html
63+
---
64+
layout: page
65+
title: "My New Page"
66+
category: ref
67+
date: 2013-06-05 12:00:00
68+
order: 1
69+
---
70+
```
71+
72+
For convenience, a new directory will be created called `_pages` which contains symlinks to the posts without the data prefix, e.g. `2013-04-13-foo.md` → `foo.md`. This makes it a tad easier when opening files to edit.
73+
74+
Start the server
75+
-------------------
76+
77+
Start the server with: `jekyll serve &; jekyll build -watch`
78+

_config.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Site title and subtitle. This is used in _includes/header.html
2+
title: 'Pippo'
3+
subtitle: 'Micro Java Web Framework'
4+
5+
# if you wish to integrate disqus on pages set your shortname here
6+
disqus_shortname: ''
7+
8+
# if you use google analytics, add your tracking id here
9+
google_analytics_id: ''
10+
11+
# Enable/show navigation. There are there options:
12+
# 0 - always hide
13+
# 1 - always show
14+
# 2 - show only if posts are present
15+
navigation: 2
16+
17+
# URL to source code, used in _includes/footer.html
18+
codeurl: 'https://github.com/decebals/pippo'
19+
20+
# Default categories (in order) to appear in the navigation
21+
sections: [
22+
['doc', 'Documentation'],
23+
['tut', 'Tutorial'],
24+
['ref', 'Reference'],
25+
['dev', 'Developers'],
26+
['post', 'Posts']
27+
]
28+
29+
# Keep as an empty string if served up at the root. If served up at a specific
30+
# path (e.g. on GitHub pages) leave off the trailing slash, e.g. /my-project
31+
baseurl: ''
32+
33+
# Dates are not included in permalinks
34+
permalink: none
35+
36+
# Syntax highlighting
37+
highlighter: pygments
38+
39+
# Since these are pages, it doesn't really matter
40+
future: true
41+
42+
# Exclude non-site files
43+
exclude: ['bin', 'README.md']
44+
45+
# Use the redcarpet Markdown renderer
46+
markdown: redcarpet
47+
redcarpet:
48+
extensions: [
49+
'no_intra_emphasis',
50+
'fenced_code_blocks',
51+
'autolink',
52+
'strikethrough',
53+
'superscript',
54+
'with_toc_data',
55+
'tables',
56+
'hardwrap'
57+
]

_includes/disqus.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div id="disqus_thread"></div>
2+
<script type="text/javascript">
3+
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
4+
var disqus_shortname = '{{ site.disqus_shortname }}'; // required: replace example with your forum shortname
5+
6+
/* * * DON'T EDIT BELOW THIS LINE * * */
7+
(function() {
8+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
9+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
10+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
11+
})();
12+
</script>
13+
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

_includes/footer.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Documentation for <a href="{% if site.codeurl %}{{ site.codeurl }}{% else %}{{ site.baseurl }}{% endif %}">{{ site.title }}</a>

_includes/google_analytics.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
3+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
4+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
5+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
6+
7+
ga('create', '{{ site.google_analytics_id }}', 'auto');
8+
ga('send', 'pageview');
9+
</script>

_includes/header.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h4><a class=brand href="{{ site.baseurl }}/">{{ site.title }}</a>
2+
{% if site.subtitle %}<small>{{ site.subtitle }}</small>{% endif %}
3+
</h4>
4+

_includes/navigation.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<ul class="nav nav-list">
2+
<li><a href="{{ site.baseurl }}/">Home</a></li>
3+
{% for section in site.sections %}
4+
{% assign attr = section[0] %}
5+
{% assign label = section[1] %}
6+
7+
{% for page in site.categories[attr] %}
8+
{% if forloop.first %}
9+
<li class=nav-header>{{ label }}</li>
10+
{% endif %}
11+
<li data-order="{{ page.order }}"><a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a></li>
12+
{% endfor %}
13+
{% endfor %}
14+
<!-- List additional links. It is recommended to add a divider
15+
e.g. <li class=divider></li> first to break up the content. -->
16+
</ul>

_layouts/default.html

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6+
<meta name="viewport" content="width=device-width">
7+
8+
<title>{{ site.title }}{% if page.title %} : {{ page.title }}{% endif %}</title>
9+
<meta name="description" content="{{ site.subtitle }}">
10+
11+
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
12+
<link rel="stylesheet" href="{{ site.baseurl }}/css/syntax.css">
13+
<link rel="stylesheet" href="{{ site.baseurl }}/css/main.css">
14+
</head>
15+
<body>
16+
17+
<div class="container">
18+
<div class=row-fluid>
19+
<div id=header class=span12>
20+
{% include header.html %}
21+
</div>
22+
</div>
23+
24+
<div class=row-fluid>
25+
{% assign post_count = site.posts|size %}
26+
{% if site.navigation != 0 and site.navigation == 1 or post_count > 0 %}
27+
<div id=navigation class=span2>
28+
{% include navigation.html %}
29+
</div>
30+
31+
<div id=content class=span10>
32+
{{ content }}
33+
</div>
34+
{% else %}
35+
<div id=content class=span12>
36+
{{ content }}
37+
</div>
38+
{% endif %}
39+
</div>
40+
41+
{% if page.disqus == 1 %}
42+
<div class=row-fluid>
43+
{% if site.navigation == 1 or post_count > 0 %}
44+
<div id=navigation class=span2></div>
45+
<div id=disqus class=span10>
46+
{% include disqus.html %}
47+
</div>
48+
{% else %}
49+
<div id=disqus class=span12>
50+
{% include disqus.html %}
51+
</div>
52+
{% endif %}
53+
</div>
54+
{% endif %}
55+
56+
<div class=row-fluid>
57+
<div id=footer class=span12>
58+
{% include footer.html %}
59+
</div>
60+
</div>
61+
</div>
62+
63+
<script>
64+
function orderNav() {
65+
var list,
66+
section,
67+
header,
68+
sections = [],
69+
lists = {},
70+
headers = {};
71+
72+
var navUl = document.querySelectorAll('#navigation ul')[0],
73+
navLis = document.querySelectorAll('#navigation ul li');
74+
75+
if (!navUl) return;
76+
77+
for (var i = 0; i < navLis.length; i++) {
78+
var order, li = navLis[i];
79+
80+
if (li.classList.contains('nav-header')) {
81+
section = li.textContent || li.innerText;
82+
sections.push(section);
83+
headers[section] = li;
84+
continue;
85+
}
86+
87+
if (!lists[section]) {
88+
lists[section] = [];
89+
}
90+
91+
order = parseFloat(li.getAttribute('data-order'))
92+
lists[section].push([order, li]);
93+
}
94+
95+
for (var i = 0; i < sections.length; i++) {
96+
section = sections[i];
97+
list = lists[section].sort(function(a, b) {
98+
return a[0] - b[0];
99+
});
100+
101+
if (header = headers[section]) {
102+
navUl.appendChild(header);
103+
}
104+
for (var j = 0; j < list.length; j++) {
105+
navUl.appendChild(list[j][1]);
106+
}
107+
}
108+
}
109+
110+
if (document.querySelectorAll) orderNav();
111+
</script>
112+
{% if site.google_analytics_id != "" %}
113+
{% include google_analytics.html %}
114+
{% endif %}
115+
</body>
116+
</html>

_layouts/page.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
layout: default
3+
---
4+
5+
<div class=page-header>
6+
<h2>{{ page.title }}
7+
{% if page.subtitle %}<small>{{ page.subtitle }}</small>{% endif %}
8+
</h2>
9+
</div>
10+
11+
{{ content }}

0 commit comments

Comments
 (0)