Renommage bundle JS

This commit is contained in:
Lucas Cimon 2019-02-13 21:02:26 +01:00
parent fef873996f
commit 8e23860b4f
No known key found for this signature in database
GPG Key ID: 08DA831E717571EE
5 changed files with 54 additions and 46 deletions

14
run.sh
View File

@ -5,12 +5,12 @@
set -o pipefail -o errexit -o nounset -o xtrace set -o pipefail -o errexit -o nounset -o xtrace
install () { install () {
pip install pelican markdown beautifulsoup4 pillow pip install beautifulsoup4 html5lib html5validator markdown pelican pillow
./gen_statics_bundles.py || true ./gen_statics_bundles.py || true
} }
install_dev () { install_dev () {
npm install -g eslint eslint-config-strict eslint-plugin-filenames stylelint npm install -g eslint eslint-config-strict eslint-plugin-filenames htmlhint stylelint
npm install stylelint-config-standard npm install stylelint-config-standard
pip install pre-commit pip install pre-commit
pre-commit install pre-commit install
@ -18,24 +18,22 @@ install_dev () {
test_ludochaordic () { test_ludochaordic () {
cd .. cd ..
if ! [ -d pelican-plugins ]; then
git clone https://github.com/getpelican/pelican-plugins.git git clone https://github.com/getpelican/pelican-plugins.git
cd pelican-plugins cd pelican-plugins
git submodule update --init image_process representative_image tag_cloud git submodule update --init image_process representative_image tag_cloud
cd .. cd ..
git clone https://github.com/Lucas-C/ludochaordic.git fi
[ -d ludochaordic ] || git clone https://github.com/Lucas-C/ludochaordic.git
cd ludochaordic cd ludochaordic
npm install -g htmlhint
pip install html5lib html5validator
../pelican-mg/gen_imgs_from_mds.py content/*.md ../pelican-mg/gen_imgs_from_mds.py content/*.md
make DEBUG=1 OUTPUTDIR=output publish make DEBUG=1 OUTPUTDIR=output publish
# Too many missing img alt attributes in thoses: # Too many missing img alt attributes in thoses:
rm output/street-art-and-hedonogeolostism-in-london.html output/variante-2-joueurs-pour-bang-le-jeu-de-des.html rm output/street-art-and-hedonogeolostism-in-london.html output/variante-2-joueurs-pour-bang-le-jeu-de-des.html
html5validator --root output/ --ignore-re='.*(Element "style" not allowed as child of element.*|Text not allowed in element "iframe" in this context.|No "p" element in scope but a "p" end tag seen.)' # issue with pelican renderer: <p> contains legally only inline-/inline-block-elements html5validator --root output/ --ignore-re='.*(Element "style" not allowed as child of element.*|Text not allowed in element "iframe" in this context.|No "p" element in scope but a "p" end tag seen.|End tag "p" implied, but there were open elements.|Unclosed element "a".|End tag "div" seen, but there were open elements.)' # issue with pelican renderer: <p> contains legally only inline-/inline-block-elements
cp ../pelican-mg/.htmlhintrc output/ cp ../pelican-mg/.htmlhintrc output/
htmlhint output/ htmlhint output/

View File

@ -21,12 +21,14 @@ if(e=u.split("-"),h=d[u]?d[u]:d["bottom-left"],this.justified&&this.justified.le
window.tagFilters = {}; window.tagFilters = {};
function parseQuery(queryString) { function parseQuery(queryString) {
let query = {}; const query = {};
(queryString[0] === '?' ? queryString.substr(1) : queryString).split('&').forEach(pair => { (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&').forEach((pair) => {
pair = pair.split('='); pair = pair.split('=');
let name = decodeURIComponent(pair[0]); const name = decodeURIComponent(pair[0]);
let values = decodeURIComponent(pair[1] || '').split(','); const values = decodeURIComponent(pair[1] || '').split(',');
if (!query[name]) { query[name] = []; } if (!query[name]) {
query[name] = [];
}
Array.prototype.push.apply(query[name], values); Array.prototype.push.apply(query[name], values);
}); });
return query; return query;
@ -97,16 +99,19 @@ if(e=u.split("-"),h=d[u]?d[u]:d["bottom-left"],this.justified&&this.justified.le
updateArticlesVisibility(); updateArticlesVisibility();
}; };
// This is a bit redundant with /tag/$tag.html pages, but is slightly more powerful as it allow to combine multiple filters // This is a bit redundant with /tag/$tag.html pages,
let queryParams = parseQuery(window.location.search); // but is slightly more powerful as it allow to combine multiple filters
for (let [qpName, qpValue] of Object.entries(queryParams)) { const queryParams = parseQuery(window.location.search);
if (!qpValue) { continue; } for (const [ qpName, qpValue ] of Object.entries(queryParams)) {
if (!qpValue) {
continue;
}
if (qpName === 'lang') { if (qpName === 'lang') {
let buttonElem = document.getElementById('lang-tag-filter'); const buttonElem = document.getElementById('lang-tag-filter');
window.toggleLangTagFilter.bind(buttonElem)(qpValue[0]); window.toggleLangTagFilter.bind(buttonElem)(qpValue[0]);
} else if (qpName === 'tags') { } else if (qpName === 'tags') {
qpValue.forEach(tag => { qpValue.forEach((tag) => {
let buttonElem = document.getElementById(tag + '-tag-filter'); const buttonElem = document.getElementById(`${ tag }-tag-filter`);
window.toggleTagFilter.bind(buttonElem)(tag); window.toggleTagFilter.bind(buttonElem)(tag);
}); });
} }

View File

@ -267,12 +267,14 @@ $(document).ready(() => {
window.tagFilters = {}; window.tagFilters = {};
function parseQuery(queryString) { function parseQuery(queryString) {
let query = {}; const query = {};
(queryString[0] === '?' ? queryString.substr(1) : queryString).split('&').forEach(pair => { (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&').forEach((pair) => {
pair = pair.split('='); pair = pair.split('=');
let name = decodeURIComponent(pair[0]); const name = decodeURIComponent(pair[0]);
let values = decodeURIComponent(pair[1] || '').split(','); const values = decodeURIComponent(pair[1] || '').split(',');
if (!query[name]) { query[name] = []; } if (!query[name]) {
query[name] = [];
}
Array.prototype.push.apply(query[name], values); Array.prototype.push.apply(query[name], values);
}); });
return query; return query;
@ -343,16 +345,19 @@ $(document).ready(() => {
updateArticlesVisibility(); updateArticlesVisibility();
}; };
// This is a bit redundant with /tag/$tag.html pages, but is slightly more powerful as it allow to combine multiple filters // This is a bit redundant with /tag/$tag.html pages,
let queryParams = parseQuery(window.location.search); // but is slightly more powerful as it allow to combine multiple filters
for (let [qpName, qpValue] of Object.entries(queryParams)) { const queryParams = parseQuery(window.location.search);
if (!qpValue) { continue; } for (const [ qpName, qpValue ] of Object.entries(queryParams)) {
if (!qpValue) {
continue;
}
if (qpName === 'lang') { if (qpName === 'lang') {
let buttonElem = document.getElementById('lang-tag-filter'); const buttonElem = document.getElementById('lang-tag-filter');
window.toggleLangTagFilter.bind(buttonElem)(qpValue[0]); window.toggleLangTagFilter.bind(buttonElem)(qpValue[0]);
} else if (qpName === 'tags') { } else if (qpName === 'tags') {
qpValue.forEach(tag => { qpValue.forEach((tag) => {
let buttonElem = document.getElementById(tag + '-tag-filter'); const buttonElem = document.getElementById(`${ tag }-tag-filter`);
window.toggleTagFilter.bind(buttonElem)(tag); window.toggleTagFilter.bind(buttonElem)(tag);
}); });
} }