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

22
run.sh
View File

@ -5,12 +5,12 @@
set -o pipefail -o errexit -o nounset -o xtrace
install () {
pip install pelican markdown beautifulsoup4 pillow
pip install beautifulsoup4 html5lib html5validator markdown pelican pillow
./gen_statics_bundles.py || true
}
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
pip install pre-commit
pre-commit install
@ -18,24 +18,22 @@ install_dev () {
test_ludochaordic () {
cd ..
git clone https://github.com/getpelican/pelican-plugins.git
cd pelican-plugins
git submodule update --init image_process representative_image tag_cloud
cd ..
git clone https://github.com/Lucas-C/ludochaordic.git
if ! [ -d pelican-plugins ]; then
git clone https://github.com/getpelican/pelican-plugins.git
cd pelican-plugins
git submodule update --init image_process representative_image tag_cloud
cd ..
fi
[ -d ludochaordic ] || git clone https://github.com/Lucas-C/ludochaordic.git
cd ludochaordic
npm install -g htmlhint
pip install html5lib html5validator
../pelican-mg/gen_imgs_from_mds.py content/*.md
make DEBUG=1 OUTPUTDIR=output publish
# 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
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/
htmlhint output/

View File

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

View File

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