Commit b308780d authored by Floréal Toumikian's avatar Floréal Toumikian

Merge branch 'new-theme' into 'master'

New theme

See merge request !1
parents 1b1bdb66 586f9fc6
Pipeline #26455 passed with stage
in 1 minute and 11 seconds
image: ruby:2.3
image: ruby:2.4.2
before_script:
- gem install nanoc -v 4.1.1
- gem install coderay -v 1.1.0
- gem install kramdown -v 1.9.0
- gem install builder -v 3.2.2
- gem install nokogiri -v 1.6.7.1
- gem install w3c_validators -v 1.2
- gem install i18n -v 0.7.0
- gem install nanoc -v 4.8.10
- gem install coderay -v 1.1.2
- gem install kramdown -v 1.15.0
- gem install builder -v 3.2.3
- gem install nokogiri -v 1.8.1
- gem install w3c_validators -v 1.3.3
- gem install i18n -v 0.9.0
- gem install rubocop -v 0.51.0
stages:
- build
- checks
build_site:
script:
- echo http://comments.example.com > isso.url
- nanoc
- nanoc check internal_links external_links mixed_content
stage: build
stage: checks
static-analysis:
script:
- rubocop lib
stage: checks
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), then you will want to move
## the Guardfile to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
guard 'nanoc' do
watch('nanoc.yaml') # Change this to config.yaml if you use the old config file name
watch('Rules')
watch(%r{^(content|layouts|lib)/.*$})
end
......@@ -6,19 +6,34 @@ Code source du site https://www.nimukaito.net/.
## Dépendances
- Ruby 2.1.3
- Ruby 2.4.2
Gems:
This will also require some gems:
- nanoc 4.1.1
- coderay 1.1.0
- krawdown 1.9.0
- builder 3.2.2
- i18n 0.7.0
For site generation:
- nanoc 4.8.10
- coderay 1.1.2
- kramdown 1.15.0
- builder 3.2.3
For content validation:
- nokogiri 1.8.1
- w3c_validators 1.3.3
- i18n 0.9.0
For library code smell detections:
- rubocop 0.51.0
For developing:
- guard-nanoc 2.1.2
## CI build status
[![build status](https://git.framasoft.org/ci/projects/65/status.png?ref=master)](https://git.framasoft.org/ci/projects/65?ref=master)
[![pipeline status](https://framagit.org/floreal/www.nimukaito.net/badges/master/pipeline.svg)](https://framagit.org/floreal/www.nimukaito.net/commits/master)
## Licence
......
/*!
* Start Bootstrap - Blog Post HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
body {
padding-top: 70px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
a {
color: #689f38;
}
footer {
margin: 50px 0;
blockquote {
border-color: #33691e;
}
.footnotes {
margin-top: 3em;
border-style: solid;
border-color: rgb(204, 204, 204);
border-width: 1px;
border-radius: 4px;
padding-right: 1em;
footer {
padding-bottom: 1rem;
}
.footnotes:before {
content: "Notes de bas de page";
padding-left: 1em;
font-style: italic;
font-weight: bolder;
color: rgb(152, 152, 152);
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
dt {
margin-top: 1em;
main {
flex: 1 0 auto;
}
dd {
margin-left: 1em;
.content > ul > li {
list-style-type: initial;
list-style-position: inside;
}
img {
max-width: 100%;
height: auto;
max-width: 100%;
height: auto;
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(/fonts/material-icons.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
---
title: Tags
---
<%= all_tag_links %>
<ul>
<% for tag_link in (all_tag_links class: 'chip') %>
<li><%= tag_link %></li>
<% end %>
</ul>
......@@ -4,53 +4,27 @@
<%= render '/partials/head.html' %>
<body>
<%= render '/partials/nav.html' %>
<!-- Page Content -->
<div class="container">
<div class="row">
<!-- Blog Entries Column -->
<div class="col-md-8">
<%= yield %>
<hr>
<h2>Derniers billets</h2>
<% for post in sorted_articles[0..3] do %>
<h3><%= link_to(post[:title], post) %></h3>
<p class="lead">
par <%= authors(post) %>
</p>
<p><span class="glyphicon glyphicon-time"></span> Publié le <%= localize_date attribute_to_time(post[:created_at]) %></p>
<p><span class="glyphicon glyphicon-tag"></span>Tags: <%= tag_links_for(post) %></p>
<p><%= excerptize(strip_html(post.compiled_content(snapshot: :pre)), length: 140) %></p>
<a class="btn btn-primary" href="<%= post.path %>">Lire l'article <span class="glyphicon glyphicon-chevron-right"></span></a>
<hr>
<% end %>
</div>
<div class="flow-text">
<%= yield %>
</div>
<!-- Blog Sidebar Widgets Column -->
<div class="col-md-4">
<%= render '/partials/sidebar.html' %>
</div>
<h2>Derniers billets</h2>
<% for post in sorted_articles[0..3] do %>
<div class="card-panel hoverable">
<h3><%= post[:title] %></h3>
<%= render '/partials/article-meta.html', article: post %>
<p><%= excerptize(strip_html(post.compiled_content(snapshot: :pre)), length: 140) %></p>
<a class="waves-effect waves-light btn light-green darken-4" href="<%= post.path %>"><i class="small material-icons right">chevron_right</i>Lire l'article</a>
</div>
<!-- /.row -->
<hr>
<% end %>
<%= render '/partials/footer.html' %>
</div>
<!-- /.container -->
<%= render '/partials/footer.html' %>
<%= render '/partials/scripts.html' %>
</body>
......
<div class="valign-wrapper">
<i class="small material-icons">person</i>
<% for author in authors(article) %><div class="chip left"><img src="/images/person/<%= author %>.jpg" alt="avatar (<%= author %>)" /> <%= author %></div><% end %>
</div>
<div class="valign-wrapper"><div class="left"><i class="small material-icons">access_time</i></div><div><%= localize_date attribute_to_time(article[:created_at]) %></div></div>
<div class="valign-wrapper"><div class="left"><i class="small material-icons">label</i></div><div><%= tag_links_for(article, ' ', class: "chip") %></div></div>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" />
</a>
Cette œuvre est mise à disposition selon les termes de la <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Licence Creative Commons Attribution 4.0 International</a>.
</div>
</div>
<!-- /.row -->
</footer>
<!-- Footer -->
<footer class="page-footer light-green darken-4">
<div class="container center-align">
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
<img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" />
</a>
</div>
</footer>
......@@ -3,7 +3,12 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="<%= authors(item) %>">
<meta name="author" content="<%= authors(item).join(', ') %>">
<% if @item[:kind] == 'article' %>
<meta property="og:title" content="<%= @item[:title] %>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<%= url_for(@item) %>" />
<% end %>
<link rel="author" href="/humans.txt" />
<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Flux ATOM de Nimukaito" />
<link rel="icon"
......@@ -13,11 +18,12 @@
<title>Nimukaito <%= "- #{@item[:title]}" if @item[:title] %></title>
<!-- Bootstrap Core CSS -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/coderay.css" rel="stylesheet">
<link href="/css/materialize.min.css" rel="stylesheet" />
<link href="/css/coderay.css" rel="stylesheet" />
<link href="/css/material-icons.css" rel="stylesheet" />
<!-- Custom CSS -->
<link href="/css/blog.css" rel="stylesheet">
<link href="/css/blog.css" rel="stylesheet" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
......
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<nav class="z-depth-3 light-green darken-4">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to('Nimukaito', '/', class: "navbar-brand") %>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<%= link_to('Tags', '/tags') %>
</li>
<li>
<%= link_to('À propos', '/about') %>
</li>
<li>
<%= link_to('Me contacter', 'mailto:floreal+blog@nimukaito.net') %>
</li>
<div class="nav-wrapper">
<%= link_to('Nimukaito', '/', class: "brand-logo") %>
<a href="#" data-activates="side-mobile-menu" class="button-collapse right"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><%= link_to('Tags', '/tags') %></li>
<li><%= link_to('À propos', '/about') %></li>
<li><%= link_to('Me contacter', 'mailto:floreal+blog@nimukaito.net') %></li>
</ul>
<ul class="side-nav" id="side-mobile-menu">
<li><%= link_to('Tags', '/tags') %></li>
<li><%= link_to('À propos', '/about') %></li>
<li><%= link_to('Me contacter', 'mailto:floreal+blog@nimukaito.net') %></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
......@@ -2,4 +2,10 @@
<script src="/js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="/js/bootstrap.min.js"></script>
<script src="/js/materialize.min.js"></script>
<script>
$( document ).ready(function(){
$(".button-collapse").sideNav();
});
</script>
......@@ -7,52 +7,18 @@
<%= render '/partials/nav.html' %>
<!-- Page Content -->
<div class="container">
<div class="container content">
<div class="row">
<!-- Title -->
<h1><%= @item[:title] %></h1>
<!-- Blog Post Content Column -->
<div class="col-lg-8">
<%= render '/partials/article-meta.html', article: @item %>
<%= yield %>
<%= comments_section %>
<!-- Blog Post -->
<!-- Title -->
<h1><%= @item[:title] %></h1>
<!-- Author -->
<p class="lead">
par <%= authors(@item) %>
</p>
<hr>
<!-- Date/Time -->
<p><span class="glyphicon glyphicon-time"></span> Publié le <%= localize_date attribute_to_time(@item[:created_at]) %></p>
<p><span class="glyphicon glyphicon-tag"></span> Tags: <%= tag_links_for(@item) %></p>
<hr>
<!-- Post Content -->
<%= yield %>
<hr>
<%= comments_section %>
</div>
<!-- Blog Sidebar Widgets Column -->
<div class="col-md-4">
<%= render '/partials/sidebar.html' %>
</div>
</div>
<!-- /.row -->
<hr>
<%= render '/partials/footer.html' %>
</div>
<!-- /.container -->
<%= render '/partials/footer.html' %>
<%= render '/partials/scripts.html' %>
<%= comments_script %>
</body>
......
......@@ -7,38 +7,17 @@
<%= render '/partials/nav.html' %>
<!-- Page Content -->
<div class="container">
<div class="container content">
<!-- Title -->
<h1><%= @item[:title] %></h1>
<div class="row">
<!-- Content -->
<%= yield %>
<div class="col-lg-8">
<!-- Title -->
<h1><%= @item[:title] %></h1>
<hr>
<!-- Content -->
<%= yield %>
<hr>
</div>
<!-- Blog Sidebar Widgets Column -->
<div class="col-md-4">
<%= render '/partials/sidebar.html' %>
</div>
</div>
<!-- /.row -->
<hr>
<%= render '/partials/footer.html' %>
</div>
<!-- /.container -->
<%= render '/partials/footer.html' %>
<%= render '/partials/scripts.html' %>
</body>
......
def authors item
authors = item[:author_name]
return authors unless authors.respond_to? :join
authors.join(', ')
# frozen_string_literal: true
def authors(item)
[item[:author_name]].flatten
end
# frozen_string_literal: true
# Will insert external comment app "isso"
module Comments
ISSO_URL = "isso.url"
ISSO_URL = 'isso.url'
def comments_base_url
@comments_base_url = File.read(ISSO_URL).rstrip if @comments_base_url.nil?
@comments_base_url
end
def comments_section
'<section id="isso-thread"></section>'
'<section id="isso-thread"></section>'
end
def comments_script
<<-eos
<<-HTML
<script data-isso="#{comments_base_url}/"
data-isso-lang="fr"
src="#{comments_base_url}/js/embed.min.js"></script>
eos
HTML
end
end
......
# frozen_string_literal: true
include Nanoc::Helpers::Tagging
include Nanoc::Helpers::Blogging
include Nanoc::Helpers::LinkTo
......
# frozen_string_literal: true
require 'i18n'
# Helper allowing to localize date and time
module Localization
def localize_date date
# Localises a given date
def localize_date(date)
setup_locales unless locales_loaded?
I18n.l date, format: :short
I18n.l date, format: :long
end
# Checks wheter locale is loaded or not
def locales_loaded?
!I18n.load_path.empty?
end
# Configures locale
def setup_locales
I18n.load_path = Dir.glob(locale_config[:pattern])
I18n.locale = locale_config[:default].to_sym
I18n.default_locale = locale_config[:default].to_sym
end
# Returns locale section configuration
def locale_config
@config[:locale]
end
......
# frozen_string_literal: true
require 'erb'
# Provides feature related to page tagging
#
module TagPages
include ERB::Util
# finds out every item containing tags
# @return Array an array of Nanoc::Item
def tagged_items
......@@ -10,7 +16,7 @@ module TagPages
end
# finds each tags from every page. Each tag appears once in the result
# which is sorted
# which is sorted
# @return Array an array of String (tag)
def all_tags
# keeps from rebuilding tag list each time this method is called
......@@ -26,28 +32,31 @@ module TagPages
# finds all tags for every pages and create a link for each
#
# @return String
def all_tag_links attributes = {}
all_tags.map { |tag| tag_link tag, attributes }.join(', ')
def all_tag_links(attributes = {})
all_tags.map { |tag| tag_link tag, attributes }
end
# finds out what should tag pages base path should be
# will read configuration in nanorc.yml file or provide
# a default path (/tags)
# @example Configuring tag prefix
# @example Configuring tag prefix
#
# tag_pages:
# prefix: /keywords
#
# @return String the tag page prefix
def tag_pages_prefix
default = "/tags"
return @config[:tag_pages][:prefix] || default unless @config[:tag_pages].nil?
default = '/tags'
tag_pages_conf = @config[:tag_pages]
return @config[:tag_pages][:prefix] || default unless tag_pages_conf.nil?
default
end
# provide a link to a tag page. Uses #tag_page_pefix to build the tag page path
# provide a link to a tag page. Uses #tag_page_pefix to build the tag page
# path
#
# @see #tag_pages_prefix
def tag_link tag, attributes = {}
def tag_link(tag, attributes = {})
link_to tag, @items["#{tag_pages_prefix}/#{tag}.html"], attributes
end
......@@ -55,8 +64,8 @@ module TagPages
# to the tag pages
#
# @return String
def tag_links_for item, links_attributes = {}
item[:tags].map { |tag| tag_link tag, links_attributes }.join(', ') unless item[:tags].nil?
def tag_links_for(item, separator = ' ', links_attributes = {})
item[:tags].map { |tag| tag_link tag, links_attributes }&.join(separator)
end
# Creates one Nanoc::Item for each tag
......@@ -66,12 +75,10 @@ module TagPages
def create_tags_pages
all_tags.map do |tag|
@items.create(
"<ul>
<% items_with_tag(\"#{tag}\").each do |item| %>
"<ul><% items_with_tag(\"#{tag}\").each do |item| %>
<li><%= link_to item[:title], item %></li>
<% end %>
</ul>",
{ :title => "Tag: #{tag}" },
<% end %></ul>",
{ title: "Tag: #{tag}" },
"#{tag_pages_prefix}/#{tag}.html"
)
end
......
......@@ -202,6 +202,6 @@ fr:
am: am
formats:
default: "%d %B %Y %Hh %Mmin %Ss"
long: "%A %d %B %Y %Hh%M"
long: "%A %d %B %Y à %Hh%M"
short: "%d %b %Hh%M"
pm: pm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment