Commit c72434ea authored by Calcul Bot's avatar Calcul Bot
Browse files

Merge branch 'master' into WIP-job-form

parents fa662289 cb724177
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/pelican
image: python:3-alpine
stages:
- build
- deploy
pages:
build:
stage: build
tags:
- docker
- pages
only:
- master
- pelican
script:
- pip install -r requirements.txt
- pelican -s publishconf.py
- mv output public
artifacts:
paths:
- public/
- pelican -s publishconf.py --fatal errors
apache:
stage: deploy
tags:
- pelican
only:
- master
- apache
- WIP-job-form
script:
- pelican -s publishconf.py -o /var/www/html
- pelican -s publishconf.py -o /var/www/html --fatal errors
tr.focal td{
border-top: 1px solid grey;
line-height: 1.2;
}
td.focal_title{
width: 35%;
}
td.focal_title > a{
text-decoration: none;
}
td.focal_date {
margin-left: 5px;
\ No newline at end of file
.indico_event{
color: black;
clear: both;
}
.indico_1{margin-left: 0px; border-top: 1px solid grey;}
.indico_2{margin-left: 90px; border-top: 1px solid grey;}
.indico_date{
width: 100%;
padding-left:10px;
font-weight: bold;
font-size: larger;
background-color: #D3DCE3;
}
.indico_header{
/* width: 100%; */
/* padding-left:10px; */
/* border-top: 1px solid grey; */
}
.indico_contain{
display: inline-flex;
}
.indico_time{
display: table;
/* display: inline; */
}
.indico_title{
/* display: inline; */
padding-left: 20px;
font-weight: bold;
}
.indico_desc{
padding-left: 20px;
/* margin: 0; */
font-style: italic;
max-width: 800px;
}
.indico_conveners, .indico_loc, .indico_doc{
/* padding-left: 20px; */
margin: 0;
}
title: Focal data
slug: focal
date: 2018-01-09
type: text
Scripts: focal_manage.js
Styles: focal.css
<div id="focal_data"></div>
Title: Un titre
Date: 2018-01-11 09:14
Petite description de cette offre
[attachment]({filename}job_0x2aaea2284ca6e943_attachment)
\ No newline at end of file
Title: Journée "runtime"
Date: 2016-01-20
Category: journees
Scripts: void_script.js
Indico: 44
Indico: https://indico.math.cnrs.fr
Indico_event: 940
Les architectures OpenPower et Many Integrated Cores (MIC) annoncées pour les systèmes HPC pre-exascale en 2018 ont d’ores et déjà fait leur apparition dans le paysage en 2016. L’utilisation efficace de ces architectures par les applications scientifiques comprend plusieurs défis à relever. Pour n’en citer que deux, une très grande scalabilité ainsi qu’un déploiement sur une architecture hétérogène sont indispensables.
L’emploi d’un modèle de programmation par tâches couplé à un système "runtime" dans les applications scientifiques permet-il de relever ces défis ? Ceux qui ont tenté l’expérience, ont-ils été couronnés de succès ? Voici deux questions auxquelles cette
......
"use strict";
function read(data){
return data;
}
function MakeUpFocalElement(json_entry,base){
let newevent = document.createElement('tr');
newevent.className = 'focal';
moment.locale('fr');
let title = json_entry.tra_title,
date = moment(json_entry.tra_dtstart.split('T')[0], ['YYYYMMDD']).format('DD-MM-YYYY'),
urbanArea = json_entry.tra_urbanArea.split(',')[0],
web = json_entry.tra_web,
type = json_entry.tra_type
;
newevent.innerHTML = '' +
'<td class="focal_title"><a href="'+web+'">'+ title + '</a></td>' +
'<td class="focal_date">'+ date + '</td>' +
'<td class="focal_urbanArea">'+ urbanArea + '</td>' +
'<td class="focal_type">'+ type + '</td>'
;
base.appendChild(newevent);
};
function read_focal_data(url, nb_event)
{
$.ajax( {
type: "GET",
url: "http://formation-calcul.fr/api/training/trainings/?format=jsonp",
dataType: "jsonp",
// jsonp: false,
jsonpCallback: "read",
success: function(jsonp) {
},
error: function(event) {
alert("unable to read the event " + nb_event + " from " + url);
},
complete: function(data){
var results = data.responseJSON.results;
var base_element = document.getElementById('focal_data');
for(var ii in results){
MakeUpFocalElement(results[ii],base_element);
}
//FocalParse(data.responseJSON, nb_event,'focal_data');
}
});
}
read_focal_data();
"use strict";
function read(data){
return data;
}
function parse_event(data, nb_event,where){
var element = "indico";
var output = '';
var indico_event = data.results[0];
var titre =document.getElementsByTagName("h2");
titre[0].innerHTML = indico_event.title;
output += '<h1>' + indico_event.title + '</h1>';
output += '<h1>' + indico_event.location + '</h1>';
output += '<h1>' + indico_event.address + '</h1>';
output += '<h1>' + indico_event.room + '</h1>';
output += '<h1>' + indico_event.description + '</h1>';
document.getElementById(where).innerHTML += output;
}
function read_indico_timetable(url, nb_event)
{
$.ajax( {
type: "GET",
url: url + "/export/timetable/" + nb_event + ".jsonp?callback=read?",
dataType: "jsonp",
jsonp: false,
jsonpCallback: "read",
success: function(jsonp) {
},
error: function(event) {
alert("unable to read the event " + nb_event + " from " + url);
},
complete: function(data){
IndicoPlanning.parse(data.responseJSON, nb_event,'indico');
}
});
}
function read_indico_event(url, nb_event)
{
$.ajax( {
type: "GET",
url: url + "/export/event/" + nb_event + ".jsonp?callback=read?",
dataType: "jsonp",
jsonp: false,
jsonpCallback: "read",
success: function(jsonp) {
read_indico_timetable(url,nb_event);
},
error: function(event) {
alert("unable to read the event " + nb_event + " from " + url + "/export/event/" + nb_event + ".jsonp?callback=read?");
},
complete: function(data){
parse_event(data.responseJSON, nb_event,'indico');
}
});
}
var url = $('#indico').html().trim(),
event = $('#indico_event').html().trim();
read_indico_event(url,event);
$('#indico').show();
"use strict";
/*
Script to parse JSON arriving from indico "timetable" and to insert
these information in a div.
*/
(function(exports){
function create_authors_str(collab){
let result = collab.name;
if(collab.affiliation !==''){ result += ' ('+collab.affiliation+')';}
return result;
};
function create_time_str(t_start, t_end){
let start = t_start.time.split(':');
start.pop(); start = start.join(':');
let result = start;
if(t_end){
let end = t_end.time.split(':');
end.pop(); end = end.join(':');
result += '-' + end;
}
return result;
}
function serialize_Indico(base, level, obj)
{
// convert object into array
let sortable = [];
for(let key in obj){
if(obj[key].hasOwnProperty('startDate')){
let newkey = base + ':' + obj[key]['startDate']['time'];
obj[key].level = level;
if(obj[key].hasOwnProperty('presenters')){
obj[key].orators_str = obj[key].presenters.map(create_authors_str).join(', ') + '';
}
if(level === 1){
obj[key].times_str = create_time_str(obj[key].startDate,obj[key].endDate);
}
else{
obj[key].times_str = create_time_str(obj[key].startDate);
}
sortable.push([newkey, obj[key]]); // each item is an array in format [key, value]
}
if(obj[key].hasOwnProperty('entries')){
obj[key]['entries'] = serialize_Indico(base, level+1, obj[key]['entries']);
}
}
// sort items by value
sortable.sort(function(a, b){
let x=a[0].toLowerCase(),
y=b[0].toLowerCase();
return x<y ? -1 : x>y ? 1 : 0;
});
return sortable.map(function(d){return d[1];}); // array
}
var template = ''+
'{{#data}}'+
'<div class="indico_1">' +
' <div class="indico_contain">'+
' <div class="indico_time">{{times_str}}</div>' +
' <div class="indico_header">' +
' <div class="indico_title">{{title}}</div>' +
' <div class="indico_desc">{{description}}</div>' +
' </div>' +
' </div>' +
' {{#entries}}'+
' <div class="indico_2">'+
' <div class="indico_contain">'+
' <div class="indico_time">{{times_str}}</div>'+
' <div class="indico_header">'+
' <div class="indico_title">{{title}}</div>'+
' <div class="indico_desc">{{description}}</div>'+
' </div>'+
' </div>'+
' {{#orators_str}}'+
' <div class="indico_conveners">Contributeurs : {{orators_str}}</div>'+
' {{/orators_str}}'+
' {{#material}}'+
' <div class="indico_doc"> Document : '+
' <a href="{{resources.0.url}}">{{title}}</a>'+
' </div>'+
' {{/material}}'+
' </div>'+
' {{/entries}}'+
' <div class="indico_loc">Lieu : {{room}}</div>' +
'</div>'+
'{{/data}}';
function MakeUp_Indico(key,data){
// day level
moment.locale('fr');
let m = moment(key, ['YYYYMMDD']).format('dddd DD MMMM YYYY');
//date
let newele = document.createElement('div');
newele.className = 'indico_event';
let date = document.createElement('div');
date.className = 'indico_date';
date.innerHTML = m;
newele.appendChild(date);
newele.innerHTML += Mustache.to_html(template,{ data : data});
return newele;
console.log(data);
}
function parse_indico_json(data, nb_event, where){
let event = data.results[nb_event],
element = document.getElementById(where),
newdiv = document.createElement('div');
// loop on days
for (let key in event){
// any day is serialized
let day_event = serialize_Indico(key,1,event[key]);
// for any day the div is created and appended in where element
newdiv.appendChild( MakeUp_Indico(key,day_event));
}
element.appendChild(newdiv);
}
/* Exported fuctions */
exports.parse = parse_indico_json;
})(this.IndicoPlanning = {});
(function defineMustache(global,factory){if(typeof exports==="object"&&exports&&typeof exports.nodeName!=="string"){factory(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],factory)}else{global.Mustache={};factory(global.Mustache)}})(this,function mustacheFactory(mustache){var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function typeStr(obj){return isArray(obj)?"array":typeof obj}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile==="string")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error("Invalid tags: "+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i<valueLength;++i){chr=value.charAt(i);if(isWhitespace(chr)){spaces.push(tokens.length)}else{nonSpace=true}tokens.push(["text",chr,start,start+1]);start+=1;if(chr==="\n")stripSpace()}}if(!scanner.scan(openingTagRe))break;hasTag=true;type=scanner.scan(tagRe)||"name";scanner.scan(whiteRe);if(type==="="){value=scanner.scanUntil(equalsRe);scanner.scan(equalsRe);scanner.scanUntil(closingTagRe)}else if(type==="{"){value=scanner.scanUntil(closingCurlyRe);scanner.scan(curlyRe);scanner.scanUntil(closingTagRe);type="&"}else{value=scanner.scanUntil(closingTagRe)}if(!scanner.scan(closingTagRe))throw new Error("Unclosed tag at "+scanner.pos);token=[type,value,start,scanner.pos];tokens.push(token);if(type==="#"||type==="^"){sections.push(token)}else if(type==="/"){openSection=sections.pop();if(!openSection)throw new Error('Unopened section "'+value+'" at '+start);if(openSection[1]!==value)throw new Error('Unclosed section "'+openSection[1]+'" at '+start)}else if(type==="name"||type==="{"||type==="&"){nonSpace=true}else if(type==="="){compileTags(value)}}openSection=sections.pop();if(openSection)throw new Error('Unclosed section "'+openSection[1]+'" at '+scanner.pos);return nestTokens(squashTokens(tokens))}function squashTokens(tokens){var squashedTokens=[];var token,lastToken;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];if(token){if(token[0]==="text"&&lastToken&&lastToken[0]==="text"){lastToken[1]+=token[1];lastToken[3]=token[3]}else{squashedTokens.push(token);lastToken=token}}}return squashedTokens}function nestTokens(tokens){var nestedTokens=[];var collector=nestedTokens;var sections=[];var token,section;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];switch(token[0]){case"#":case"^":collector.push(token);sections.push(token);collector=token[4]=[];break;case"/":section=sections.pop();section[5]=token[2];collector=sections.length>0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===""};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){value=context.view;names=name.split(".");index=0;while(value!=null&&index<names.length){if(index===names.length-1)lookupHit=hasProperty(value,names[index]);value=value[names[index++]]}}else{value=context.view[name];lookupHit=hasProperty(context.view,name)}if(lookupHit)break;context=context.parent}cache[name]=value}if(isFunction(value))value=value.call(this.view);return value};function Writer(){this.cache={}}Writer.prototype.clearCache=function clearCache(){this.cache={}};Writer.prototype.parse=function parse(template,tags){var cache=this.cache;var tokens=cache[template];if(tokens==null)tokens=cache[template]=parseTemplate(template,tags);return tokens};Writer.prototype.render=function render(template,view,partials){var tokens=this.parse(template);var context=view instanceof Context?view:new Context(view);return this.renderTokens(tokens,context,partials,template)};Writer.prototype.renderTokens=function renderTokens(tokens,context,partials,originalTemplate){var buffer="";var token,symbol,value;for(var i=0,numTokens=tokens.length;i<numTokens;++i){value=undefined;token=tokens[i];symbol=token[0];if(symbol==="#")value=this.renderSection(token,context,partials,originalTemplate);else if(symbol==="^")value=this.renderInverted(token,context,partials,originalTemplate);else if(symbol===">")value=this.renderPartial(token,context,partials,originalTemplate);else if(symbol==="&")value=this.unescapedValue(token,context);else if(symbol==="name")value=this.escapedValue(token,context);else if(symbol==="text")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;j<valueLength;++j){buffer+=this.renderTokens(token[4],context.push(value[j]),partials,originalTemplate)}}else if(typeof value==="object"||typeof value==="string"||typeof value==="number"){buffer+=this.renderTokens(token[4],context.push(value),partials,originalTemplate)}else if(isFunction(value)){if(typeof originalTemplate!=="string")throw new Error("Cannot use higher-order sections without the original template");value=value.call(context.view,originalTemplate.slice(token[3],token[5]),subRender);if(value!=null)buffer+=value}else{buffer+=this.renderTokens(token[4],context,partials,originalTemplate)}return buffer};Writer.prototype.renderInverted=function renderInverted(token,context,partials,originalTemplate){var value=context.lookup(token[1]);if(!value||isArray(value)&&value.length===0)return this.renderTokens(token[4],context,partials,originalTemplate)};Writer.prototype.renderPartial=function renderPartial(token,context,partials){if(!partials)return;var value=isFunction(partials)?partials(token[1]):partials[token[1]];if(value!=null)return this.renderTokens(this.parse(value),context,partials,value)};Writer.prototype.unescapedValue=function unescapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return value};Writer.prototype.escapedValue=function escapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return mustache.escape(value)};Writer.prototype.rawValue=function rawValue(token){return token[1]};mustache.name="mustache.js";mustache.version="2.3.0";mustache.tags=["{{","}}"];var defaultWriter=new Writer;mustache.clearCache=function clearCache(){return defaultWriter.clearCache()};mustache.parse=function parse(template,tags){return defaultWriter.parse(template,tags)};mustache.render=function render(template,view,partials){if(typeof template!=="string"){throw new TypeError('Invalid template! Template should be a "string" '+'but "'+typeStr(template)+'" was given as the first '+"argument for mustache#render(template, view, partials)")}return defaultWriter.render(template,view,partials)};mustache.to_html=function to_html(template,view,partials,send){var result=mustache.render(template,view,partials);if(isFunction(send)){send(result)}else{return result}};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context;mustache.Writer=Writer;return mustache});
......@@ -60,6 +60,14 @@ def add_tags(gen, metadata):
The registered handler for the dynamic resources plugin. It will
add the scripts and/or styles to the article
"""
if 'indico' in metadata.keys():
indico = '{1}'
metadata['indico'] = format_resource(gen, metadata['indico'], indico)
if 'indico_event' in metadata.keys():
indico_event = '{1}'
metadata['indico_event'] = format_resource(gen, metadata['indico_event'], indico_event)
if 'scripts' in metadata.keys():
script = '<script src="{0}/js/{1}"></script>'
metadata['scripts'] = format_resource(gen, metadata['scripts'], script)
......
This diff is collapsed.
{% extends "base.html" %}
{% block content %}
<div class="row">
<div class="12u">
<section>
<div>
<div class="row">
<div class="12u skel-cell-mainContent">
<!-- Content -->
<article class="box is-post">
{% if article.picture is defined %}
<div class="image image-full"><img src="{{ SITEURL }}/{{ article.picture }}"/><a href="{{ article.picturecopyrights }}" class="img-copy">{{ article.picturecopyrights }}</a></div>
{% endif %}
<div class="post-infos">
<ul class="tags">
{% if article.category %}
<li><a class="button" href="{{ article.category.url }}">{{ article.category|capitalize }}</a></li>
<!-- Add Translation Function -->
{% if article.translations %}
{% for translation in article.translations %}
<li><a href="{{ SITEURL }}/{{ translation.url }}"> <img src="{{ SITEURL }}/{{ translation.lang }}_flag.png"></a></li>
{% endfor %}
{% endif %}
<!-- End Translation Function -->
{% endif %}
{% for tag in article.tags %}
<li><a class="button button-alt" href="{{ tag.url }}">{{ tag|capitalize }}</a></li>
<div class="12u">
<section>
<div>
<div class="row">
<div class="12u skel-cell-mainContent">
<!-- Content -->
<article class="box is-post">
{% if article.picture is defined %}
<div class="image image-full"><img src="{{ SITEURL }}/{{ article.picture }}"/><a href="{{ article.picturecopyrights }}" class="img-copy">{{ article.picturecopyrights }}</a></div>
{% endif %}
<div class="post-infos">
<ul class="tags">
{% if article.category %}
<li><a class="button" href="{{ article.category.url }}">{{ article.category|capitalize }}</a></li>
<!-- Add Translation Function -->
{% if article.translations %}
{% for translation in article.translations %}
<li><a href="{{ SITEURL }}/{{ translation.url }}"> <img src="{{ SITEURL }}/{{ translation.lang }}_flag.png"></a></li>
{% endfor %}
{% endif %}
<!-- End Translation Function -->
{% endif %}
{% for tag in article.tags %}
<li><a class="button button-alt" href="{{ tag.url }}">{{ tag|capitalize }}</a></li>
{% endfor %}
</ul>
</div>
{% endfor %}
</ul>
</div>
<div class="pennant pennant-alt date">{{ article.locale_date }}</div>
<h2>{{ article.title }}</h2>
{{ article.content }}
</article>
{% include 'disqus_script.html' %}
</div>
</div>
</div>
</section>
<div class="pennant pennant-alt date">{{ article.locale_date }}</div>
<h2>{{ article.title }}</h2>
{{ article.content }}
{% if article.indico %}
<div id="indico" style="display:none" >{{article.indico[0]}}</div>
{% endif %}
{% if article.indico_event %}
<div id="indico_event" style="display:none" >{{article.indico_event[0] }}</div>
{% endif %}
</article>
{% include 'disqus_script.html' %}
</div>
</div>
</div>
</section>
</div>
</div>
{% endblock %}
......@@ -14,6 +14,9 @@
{{ style }}
{% endfor %}
{% endif %}
{% if article.indico %}
<link rel="stylesheet" href="/css/indico.css" />
{% endif %}
{% endif %}
<title>{% block title %}{{ SITENAME }}{% endblock title %}</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
......@@ -44,6 +47,7 @@
{% endif %}
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,900,300italic" rel="stylesheet" />
<link rel="stylesheet" href="/theme/css/pygment.css" />
<noscript>
<link rel="stylesheet" href="/theme/css/skel-noscript.css" />
<link rel="stylesheet" href="/theme/css/style.css" />
......@@ -242,20 +246,24 @@
<script src="/theme/js/config.js"></script>
<script src="/theme/js/skel.min.js"></script>
<script src="/theme/js/skel-panels.min.js"></script>
<script src="/theme/js/moment-with-locales.min.js"></script>