Skip to content
Snippets Groups Projects
Verified Commit 93317435 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Fix few links

and add few command line options

use ./index.js --help to learn more
parent 6880c37d
No related branches found
No related tags found
No related merge requests found
......@@ -9,13 +9,15 @@ var cli = require('cli');
var options = cli.parse({
noserver: ['n', 'Dont run server'],
port: ['p', 'Port on which server should run', 'number', 1337],
uiport: [null, 'BrowserSync UI port', 'number', 'port+1']
uiport: [null, 'BrowserSync UI port', 'number', 'port+1'],
httpsonly: [null, 'Converts all http://ok1kvk.cz links to https'],
httponly: [null, 'Converts all https://ok1kvk.cz links to http']
});
module.exports = function() {
var builddir = 'build';
if(!options.noserver) builddir = 'build-debug';
if(options.uiport == 'port+1') {
options.uiport = options.port+1;
}
......
......@@ -30,6 +30,8 @@ renderer.paragraph = function(text) {
else return '<p>'+text+'</p>\n';
}
renderer._link = renderer.link;
marked.setOptions({
renderer: renderer,
gfm: true,
......@@ -42,6 +44,20 @@ marked.setOptions({
});
module.exports = function(obj) {
var options = obj.config.options;
renderer.link = function(href, title, text) {
if(options.httponly) {
if(href.match(/^https:\/\/ok1kvk.cz/))
href = href.replace('https://', 'http://');
}
if(options.httpsonly) {
if(href.match(/^http:\/\/ok1kvk.cz/))
href = href.replace('http://', 'https://');
}
return renderer._link(href,title,text);
};
obj.pages.forEach(function(article) {
renderer.image = function(href, title, text) {
href = href.split(path.sep).join('/');
......
......@@ -148,7 +148,7 @@
<footer class="page-footer blue">
<div class="container s6">
<a class="orange-text text-lighten-3" target="_blank" href="https://git.ok1kvk.cz/">Gitlab</a> |
<a class="orange-text text-lighten-3" target="_blank" href="https://forum.ok1kvk.cz/">Fórum</a> |
<a class="orange-text text-lighten-3" target="_blank" href="http://forum.ok1kvk.cz/">Fórum</a> |
<a class="orange-text text-lighten-3" href="/clanek/webkamera/">Webkamera</a> |
<a class="orange-text text-lighten-3" href="/clanek/jak-nahlasit-chybu/">Jak nahlásit chybu</a>
{% block footerlink %}
......
......@@ -12,4 +12,4 @@ echo "Site compiled"
chmod a+X build -R
echo "Uploading to nove.ok1kvk.cz"
lftp -c "set ftp:ssl-allow no; open --user ok1kvk.cz-nove --env-password ftp://ok1kvk.cz/; mirror -c --verbose=9 -e -R -L ./build /"
lftp -c "set ftp:ssl-allow no; open --user ok1kvk.cz-www-nove --env-password ftp://ok1kvk.cz/; mirror -c --verbose=9 -e -R -L ./build /"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment