WIP: redesign pandoc template from scratch

This commit is contained in:
marko
2024-12-30 13:14:50 +01:00
parent b4f70df7c8
commit a1f2e70780
6 changed files with 161 additions and 241 deletions

View File

@@ -1,8 +1,6 @@
#! /usr/bin/env make -f
CSSO = node_modules/csso-cli/bin/csso
RES_LIST = 64 128 256 512
include Makefile.heliohost.config
cssFiles = $(wildcard src/css/*.css)
mdFiles = $(wildcard src/md/*.md)
@@ -11,13 +9,10 @@ ampFiles = $(patsubst src/md/%.md, build/amp/%.php, $(mdFiles))
phpLibFiles = $(wildcard phpLib/cwsvJudo/*.php) phpLib/phpcount/phpcount.php
configFiles = $(wildcard config/*.php)
distDir=./build/dist/heliohost
pandocTemplate=pandocTemplate/materialize.pandocTemplate
LN = ln -f
.PHONY: all
all: pages
all: build/css/cwsvJudo.css pages
# @todo This should only be temporary. Better outsource the graphics to it's own Makefile.
make -j graphiken
make build/css/cwsvJudo.css
@@ -29,16 +24,19 @@ clean:
.PHONY: installDependencies
installDependencies:
if [ ! -d "submodules" ]; then mkdir submodules; fi
# - nodejs
# if [ ! -d "submodules/node" ]; then cd submodules; git clone https://github.com/nodejs/node.git; fi
# cd submodules/node; git fetch; git checkout v22.12.0; ./configure; make -j4;
# - bulma
# - bulma.css
if [ ! -d "submodules/bulma" ]; then cd submodules; git clone https://github.com/jgthms/bulma; fi
cd submodules/bulma; git fetch; git checkout 1.0.2;
# if [ ! -d "submodules/bulma" ]; then cd submodules; git clone https://github.com/jgthms/bulma; fi
# cd submodules/bulma; git fetch; git checkout 1.0.2;
# - bulma templates
if [ ! -d "submodules/bulma-templates" ]; then cd submodules; git clone https://github.com/BulmaTemplates/bulma-templates; fi
cd submodules/bulma-templates; git fetch; git checkout 0.9.4.2;
# if [ ! -d "submodules/bulma-templates" ]; then cd submodules; git clone https://github.com/BulmaTemplates/bulma-templates; fi
# cd submodules/bulma-templates; git fetch; git checkout 0.9.4.2;
# - materialize-css
if [ ! -d "submodules/materialize" ]; then cd submodules; git clone https://github.com/materializecss/materialize; fi
cd submodules/materialize; git fetch; git checkout v2.2.1; npm install; npm run release;
cd submodules/materialize; git fetch; git checkout $(VERSION_MATERIALIZE); npm install; npm audit fix; npm run release;
# copy/link all together to get a "distributable" package
# (distributable means: That directory can be uploaded va ftp)
@@ -51,8 +49,8 @@ dist: all
mkdir -p $(distDir)/httpdocs/ressourcen/css
mkdir -p $(distDir)/httpdocs/ressourcen/js
# - bulma
$(LN) ./submodules/bulma/css/bulma.min.css $(distDir)/httpdocs/ressourcen/css/
$(LN) ./submodules/bulma-templates/css/hello-parallax.css $(distDir)/httpdocs/ressourcen/css/
# $(LN) ./submodules/bulma/css/bulma.min.css $(distDir)/httpdocs/ressourcen/css/
# $(LN) ./submodules/bulma-templates/css/hello-parallax.css $(distDir)/httpdocs/ressourcen/css/
# - materializeCss
$(LN) ./submodules/materialize/dist/css/materialize.min.css $(distDir)/httpdocs/ressourcen/css/
$(LN) ./submodules/materialize/dist/css/materialize.min.css.map $(distDir)/httpdocs/ressourcen/css/
@@ -64,6 +62,10 @@ dist: all
mkdir -p $(distDir)/httpdocs/pages/shared
find ./src/shared/ -type f -exec $(LN) {} $(distDir)/httpdocs/pages/shared \;
# structured data
mkdir -p $(distDir)/httpdocs/ressourcen/structuredData/json
find src/jsonSd -type f -exec $(LN) {} $(distDir)/httpdocs/ressourcen/structuredData/json \;
# php libs
mkdir -p $(distDir)/httpdocs/ressourcen/phpLib/cwsvJudo
find ./phpLib/cwsvJudo -type f -exec $(LN) {} $(distDir)/httpdocs/ressourcen/phpLib/cwsvJudo \;
@@ -109,10 +111,10 @@ dist: all
docker-compose restart
.PHONY: pages
pages: $(pandocTemplate) $(phpFiles)
pages: Makefile.heliohost.config $(pandocTemplate) $(phpFiles)
# build the materialize version of the page
build/materialize/%.php: src/md/%.md build/yaml/%.yaml $(pandocTemplate)
build/materialize/%.php: src/md/%.md build/yaml/%.yaml $(pandocTemplate) Makefile.heliohost.config
mkdir -p build/materialize
# create html/php code
pandoc \
@@ -130,6 +132,10 @@ build/yaml/%.yaml: src/yaml/images.yaml src/yaml/navTargets.yaml src/yaml/mainNa
mkdir -p build/yaml
python tools/yamlMerge.py $^ > $@
# combine css files into one
build/css/cwsvJudo.css: $(cssFiles)
cat $^ | $(CSSO) -o $@
.PHONY: upload
upload: all
lftp -f scripts/upload-heliohost

View File

@@ -0,0 +1,15 @@
# Config settings
# versions (git branches) to use
VERSION_MATERIALIZE = v2.1.1
# where to put the distribution
distDir = ./build/dist/heliohost
# which pandoc template to use
pandocTemplate = pandocTemplate/materialize-fromScratch.html
# css optimizer to use
CSSO = node_modules/csso-cli/bin/csso
# resolution list for the fav icons
RES_LIST = 64 128 256 512

View File

@@ -0,0 +1,116 @@
<?php
// server specific variables:
require_once("./config.inc.php");
// database specific variables
require_once($$home."/.local/db.config.php");
// cwsvJudo lib
foreach(["miscAssis", "newsLib", "wkKalender", "galTable", "newsTableHtml", "newsLib", "galleryRedirector"] as $$sublib){
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/".$$sublib.".php");
}
// @todo remove galleries
galleryRedirector();
?>
<!DOCTYPE html>
<html $if(lang)$lang="$lang$" $endif$ $if(dir)$dir="$dir$" $endif$>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
$for(author-meta)$
<meta name="author" content="$author-meta$">$endfor$
$if(date-meta)$
<meta name="dcterms.date" content="$date-meta$">$endif$
$if(keywords)$
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$">
$endif$
$if(canonicalPath)$
<link rel="canonical" href="<?php echo($$canonicalBaseUrl);?>/$canonicalPath$">
$endif$
$if(ampVersionLink)$
<link rel="amphtml" href="$ampVersionLink$">
$endif$
$if(phpTitleString)$
<title>
<?php echo( $phpTitleString$ );?>
</title>
$else$$if(title)$
<title>$if(title-prefix)$$title-prefix$ $endif$$pagetitle$</title>
$endif$$endif$
$if(phpDescriptionString)$
<meta name="description" content="<?php echo( $phpDescriptionString$ );?>">
$else$$if(description)$
<meta name="description" content="$description$">
$endif$$endif$
$if(css)$$for(css)$
<link rel="stylesheet" href="/$css$">
$endfor$$endif$
<link rel="stylesheet" href="/ressourcen/css/materialize.min.css">
$if(extraCss)$$for(extraCss)$
<link rel="stylesheet" href="/$extraCss$">
$endfor$$endif$
$if(jsLibs)$$for(jsLibs)$
<script src="$jsLibs$" type="text/javascript"></script>
$endfor$$endif$
<script type='application/ld+json'>
{
"@context": "http://www.schema.org",
"@type": "WebSite",
$if(phpTitleString)$
"name": "<?php echo( $phpTitleString$ );?>",
$else$
"name": "$title$",
$endif$
"alternateName": "$description$",
$if(canonicalPath)$
"url": "<?php echo($$canonicalBaseUrl);?>/$canonicalPath$",
$else$
"url": "<?php echo($$canonicalBaseUrl);?>",
$endif$
"image": <?php echo($$canonicalBaseUrl);?>/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png"
}
</script>
</head>
<body>
<header>
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo">
<img style="height:var(--navbar-height);width:auto;" width="128" height="104"
title="Judo im Chemnitzer WSV" alt="Judo im Chemnitzer WSV - Logo"
src="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.128w.png"
srcset="/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png 2x">
</a>
$if(mainNav)$
<ul id="nav-mobile" class="right hide-on-med-and-down">
$for(mainNav)$
<li>
<a href="$mainNav.url$" $if(mainNav.caption)$title="$mainNav.caption$" $endif$
$if(mainNav.active)$class="active" $endif$>
$if(mainNav.caption)$<span>$mainNav.caption$</span>$endif$
</a>
</li>
$endfor$
</ul>
$endif$
</div>
</nav>
</header>
<main>
</main>
<footer>
</footer>
<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="ressourcen/js/materialize.min.js"></script>
</body>
</html>

View File

@@ -1,225 +0,0 @@
<?php
// server specific variables:
require_once("./config.inc.php");
// database specific variables
require_once($$home."/.local/db.config.php");
// cwsvJudo lib
foreach(["miscAssis", "newsLib", "wkKalender", "galTable", "newsTableHtml", "newsLib", "galleryRedirector"] as $$sublib){
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/".$$sublib.".php");
}
// @todo remove galleries
galleryRedirector();
?>
<!DOCTYPE html>
<html $if(lang)$lang="$lang$"$endif$ $if(dir)$dir="$dir$"$endif$>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
$for(author-meta)$
<meta name="author" content="$author-meta$">
$endfor$
$if(date-meta)$
<meta name="dcterms.date" content="$date-meta$">
$endif$
$if(keywords)$
<meta
name="keywords"
content="$for(keywords)$$keywords$$sep$, $endfor$"
>
$endif$
$if(canonicalPath)$
<link rel="canonical" href="<?php echo($$canonicalBaseUrl);?>/$canonicalPath$">
$endif$
$if(ampVersionLink)$
<link rel="amphtml" href="$ampVersionLink$">
$endif$
$if(phpTitleString)$
<title><?php echo( $phpTitleString$ );?>
</title>
$else$$if(title)$
<title>$if(title-prefix)$$title-prefix$ $endif$$pagetitle$</title>
$endif$
$endif$
$if(phpDescriptionString)$
<meta name="description" content="<?php echo( $phpDescriptionString$ );?>">
$else$$if(description)$
<meta name="description" content="$description$">
$endif$$endif$
<style>
@font-face {
font-family: Orbitron-Medium;
font-display: fallback;
src: url(/ressourcen/fonts/Orbitron-Medium.otf);
}
</style>
$if(css)$
<style>
$for(css)$
<?php include_once($$basePath."/$css$");?>
$endfor$
</style>
$endif$
<style>
code {
white-space: pre;
}
</style>
$if(quotes)$
<style>
q {
quotes: "“" "”" "" "";
}
</style>
$endif$
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$for(extraCss)$
<link rel="stylesheet" href="$extraCss$">
$endfor$
$if(math)$
$math$
$endif$
<script type='application/ld+json'>
{
"@context": "http://www.schema.org",
"@type": "WebSite",
$if(phpTitleString)$
"name": "<?php echo( $phpTitleString$ );?>",
$else$
"name": "$title$",
$endif$
"alternateName": "$description$",
$if(canonicalPath)$
"url": "<?php echo($$canonicalBaseUrl);?>/$canonicalPath$",
$else$
"url": "<?php echo($$canonicalBaseUrl);?>",
$endif$
"image": <?php echo($$canonicalBaseUrl);?>/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png"
}
</script>
$if(jsonSdFiles)$
$for(jsonSdFiles)$
<script type='application/ld+json'>
<?php include($$basePath."/ressourcen/structuredData/json/$jsonSdFiles$");?>
</script>
$endfor$
$endif$
$if(jsLibs)$
$for(jsLibs)$
<script src="$jsLibs$" type="text/javascript"></script>
$endfor$
$endif$
<link rel="alternate" type="application/rss+xml" href="/rss">
<?php // @todo reactivate require_once($$basePath."/pages/shared/favicon.html.inc");?>
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
<!-- Kopfzeile mit Titel, Promobildern und Breadcrumbs -->
<header class="cwsvHeader">
<img width="200" height="140" title="Judo im Chemnitzer WSV" alt="Judo im Chemnitzer WSV - Promo"
src="<?php echo($$canonicalBaseUrl);?>/ressourcen/graphiken/banner/bannerlogo.1.jpg">
<span>
<span>Judo</span>
<span>
<?php $$zitat = getRandomCite( getCwsvJudoDbConn() ); echo($$zitat['zitat']);?>
</span>
</span>
<img width="128" height="104" title="Judo im Chemnitzer WSV" alt="Judo im Chemnitzer WSV - Logo"
src="<?php echo($$canonicalBaseUrl);?>/ressourcen/graphiken/logos/cwsvJudoLogoWappen.128w.png"
srcset="<?php echo($$canonicalBaseUrl);?>/ressourcen/graphiken/logos/cwsvJudoLogoWappen.256w.png 2x">
</header>
$if(mainNav)$
<nav id="mainNav">
$for(mainNav)$
<a href="$mainNav.url$" $if(mainNav.caption)$title="$mainNav.caption$" $endif$
$if(mainNav.active)$class="activeNav" $endif$>
$if(mainNav.icon)$
<span><img src="$if(mainNav.icon.src)$$mainNav.icon.src$$else$$mainNav.icon$$endif$"
$if(mainNav.caption)$ alt="$mainNav.caption$" $else$ $if(mainNav.icon.alt)$
alt="$mainNav.icon.alt$" $endif$ $endif$ $if(mainNav.icon.width)$ width="$mainNav.icon.width$"
$endif$ $if(mainNav.icon.height)$ height="$mainNav.icon.height$" $endif$
$if(mainNav.icon.title)$ title="$mainNav.icon.title$" $endif$ $if(mainNav.icon.srcset)$
srcset="$mainNav.icon.srcset$" $endif$>
</span>
$endif$
$if(mainNav.caption)$<span>$mainNav.caption$</span>$endif$
</a>
$endfor$
</nav>
$endif$
$if(subNav)$
<nav class="subNav">
$for(subNav)$
<a href="$subNav.url$" $if(subNav.caption)$title="$subNav.caption$" $endif$
$if(subNav.active)$class="activeNav" $endif$>
$if(subNav.icon)$
<img src="$if(subNav.icon.src)$$subNav.icon.src$$else$$subNav.icon$$endif$" $if(subNav.caption)$
alt="$subNav.caption$" $else$ $if(subNav.icon.alt)$ alt="$subNav.icon.alt$" $endif$ $endif$
$if(subNav.icon.width)$ width="$subNav.icon.width$" $endif$ $if(subNav.icon.height)$
height="$subNav.icon.height$" $endif$ $if(subNav.icon.title)$ title="$subNav.icon.title$" $endif$
$if(subNav.icon.srcset)$ srcset="$subNav.icon.srcset$" $endif$>
$endif$
$if(subNav.caption)$<span>$subNav.caption$</span>$endif$
</a>
$endfor$
<a href="#mainNav" title="Hauptnavigation">
<img src="<?php echo($$canonicalBaseUrl);?>/ressourcen/graphiken/icons/arrowRightDown.svg" alt="Menü">
<span>zur Hauptnavigation</span>
</a>
</nav>
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
<nav id="$idprefix$TOC">
$toc$
</nav>
$endif$
<main id="content">
$body$
</main>
<aside class="sideNotes">
<?php include_once( $$basePath."/pages/shared/sponsorlist.inc.html" );?>
</aside>
<footer class="footerBar">
<a class="touchLink" title="Seite auf HTML 5 Konformität prüfen"
href="http://validator.w3.org/check?uri=<?php echo(urlencode(getCurPagesUrl()));?>" rel="nofollow">Valid
<img src="/ressourcen/graphiken/icons/HTML5_1Color_Black.svg" alt="HTML 5" title="HTML 5 Logo"
class="charImg">
</a>
<a class="touchLink"
title="Möglichkeiten mit dem Chemnitzer Freizeit- und Wohngebietssportverein in Kontakt zu treten"
href="/kontakt">Kontakt</a>
<a class="touchLink" title="Impressum" href="<?php echo($$baseUrl);?>/impressum">Impressum</a>
<a class="touchLink" title="Datenschutz" href="<?php echo($$baseUrl);?>/datenschutz">Datenschutz</a>
<a class="touchLink" title="News-Feed Abonnieren" href="<?php echo($$canonicalBaseUrl);?>/rss"><img
src="/ressourcen/graphiken/icons/newsFeedIcon.svg" alt="Newsfeed" title="News Feed Icon"
class="charImg">
</a>
</footer>
$for(include-after)$
$include-after$
$endfor$
</body>
</html>

View File

@@ -0,0 +1,3 @@
code {
white-space: pre;
}

View File

@@ -0,0 +1,5 @@
@font-face {
font-family: Orbitron-Medium;
font-display: fallback;
src: url(/ressourcen/fonts/Orbitron-Medium.otf);
}