Un générateur de site statique - retour accueil
git clone git://bebou.netlib.re/catium
Log | Files | Refs | README |
commit 1288d35c17d0f51d625c4fe5844814cec64a9a13 parent fb1a5566f538dc57cbb90e787c852c876d1c292b Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Sat, 2 Mar 2024 12:32:01 +0100 Supression de bin Contenait outils que l'on n'utilise pas/plus On pourrait éventuellement les réécrire à l'avenir Notamment atomic Diffstat:
D | bin/atomic | | | 60 | ------------------------------------------------------------ |
D | bin/pug | | | 103 | ------------------------------------------------------------------------------- |
D | bin/pug2cat | | | 26 | -------------------------- |
D | bin/shylus | | | 14 | -------------- |
4 files changed, 0 insertions(+), 203 deletions(-)
diff --git a/bin/atomic b/bin/atomic @@ -1,60 +0,0 @@ -#! /bin/sh - -entry() { -<<% cat -<entry>\ -<title><![CDATA[$time-$until | $title]]></title>\ -<id>http://people.netlib.re#${updated:=${published?publication date (%P) required}}</id>\ -<author>\ -<name>${author?author required (%A)}</name>\ -${email+<email>$email</email>}\ -</author>\ -<published>$published</published><updated>$updated</updated>\ -<content type="html"><![CDATA[<h1>Lieu</h1><br>$(echo $location | lowdown)<h1><h1>Ressources</h1>$(echo $ressources | lowdown)<h1>Description</h1>$(lowdown)]]></content>\ -</entry> -% -title= published= author= updated= time= until= -} - -alias %T='title' -title() title="$*" - -alias %P='published' -published() published="$*" - -alias %L='location' -location() location="$*" - -alias %A='by' -by() author="$*" - -alias %D='at' -at() time=$(date -d "$*" +"%a %d %b %y %Hh%M") - -alias %U='end' -end() until=$(date -d "$*" +"%Hh%M") - -alias %R='ressources' -ressources() ressources="$*" - -alias %H='url' -url() url="$*" - -alias %S='<<\% entry' -alias %SS='<<\% entries' - -entries() { feed=true -<<% cat -<?xml version="1.0" encoding="UTF-8"?>\ -<feed xmlns="http://www.w3.org/2005/Atom">\ -<title type="text"><![CDATA[$title]]></title>\ -<updated>${updated-$(date -Is)}</updated>\ -<link rel="alternate" type="text/html" href="$url" />\ -<id>$url</id>\ -<link rel="self" type="application/atom+xml" href="$url/events.atom"/> -% -title= published= updated= -} - -. ${1:-/dev/stdin} -${feed-false} && echo -n "</feed>" diff --git a/bin/pug b/bin/pug @@ -1,103 +0,0 @@ -#! /usr/bin/perl -# Pugjs (https://pugjs.org/) was by far my prefered xml template system -# until v2 but required god knows how many javascript lines to run. -# Pugish is meant to be -# * with some syntax improvements -# * without template features (you can generate a template instead) -# * written in perl so there is no need for js anymore -# * rewritten in C ( or zig or C++) in the future -# -# example of final usage: -# svg(xmlns=http://www.w3.org/2000/svg width=320 height=320) -# path/ (style stroke: none; fill: blue) (d M 0 0 L 320 320) -# path/ (style stroke: red; fill: none) (d M 30 30 a 10 10 0 1 1 50 50) -# size/ (width 23) (height 34) - -# Known Bug: -# input#pour< name="pour" type="checkbox" checked > -# input#contre< name="contre" type="checkbox" checked > - -use warnings; -use strict; - -# TODO: handle -h, --help, --version -# TODO: support html section (using indent as well) - -my @indent; -my @to_close; - -my ( $indent, $text, $tag, $i ); - -sub get { - return unless defined ($_ = <>); - ($indent,$text) = /^(\s*)(.*)/; - 1; -} - -sub empty { not length $text } - -sub text { - for ($text) { - return 1 if - /^(# |$)/ - || ( /^[<]/ && print ) - || ( /^[|](.*)/ && print "$1\n" ) - } - 0; -} - -sub release { - pop @indent; - print "</", (pop @to_close) ,">" -} - -sub undeep { - $i = length $indent; - release while @indent && $indent[$#to_close] >= $i -} - -sub kvs { - my @pairs = split /;?\s+/, $1; - while (@pairs > 1) { - print qq( $pairs[0]="$pairs[1]"); - splice @pairs,0,2; - } -} - -sub node_open { - # TODO: multiline text when tailing '.' - for ($text) { - print '<', ($tag = m{^[^.#/\s(<]+}cg ? $& : 'div'); - print qq( id="$1") if m{\G[#]([^.#/\s(]+)}cg; - my @class; push @class, $1 while m{\G[.]([^.#/\s(]+)}cg; - @class and print qq( class="@class"); - # TODO: quoted values - if(m{\G[(](.*)[)] *(.*)}cg) { kvs $1 ; print ">$2" } - elsif(m{\G[/]\s*(.*)}cg) { print " $1/>" ; return } - elsif(m{\G(/?)<}cg) { - $_ = substr $_, (pos); - while (not />/) { - s/^(\S)/ $1/ or s/ +/ /g; - print; - defined ($_ = <>) - or die "you can't leave < alone! not now!"; - chomp; - s/^\t+ */ /; - } - s/^(\S)/ $1/ or s/ +/ /g; - print; - } - elsif(m{\G$}cg) { print '>' } - elsif(m{\G\s(.*)}cg) { print '>',$1 } - else { die "unexpected situation: $_"; } - } - push @indent , $i; - push @to_close, $tag; -} - -while (get) { - undeep; - next if empty || text; - node_open -} -release while @indent; diff --git a/bin/pug2cat b/bin/pug2cat @@ -1,26 +0,0 @@ -#! /bin/sh - -# for example: -# @@ layout -# html -# body ${title?title} -# @@ -# -# @@ another -# html -# body ${title?title} -# @@ - -# will be transformed as heredoc templates this way -# layout() <<@@ cat -# <html><body>${title?title}</body></html> -# @@ -# another() <<@@ cat -# <html><body>${title?title}</body></html> -# @@ - -sed -E ' - s/^@@ *(.+)/|\1() <<@@ cat/ - s/^@@$/|\n|&/ -' -- "$@" | bin/pug - diff --git a/bin/shylus b/bin/shylus @@ -1,14 +0,0 @@ -#! /bin/sh -set -eu -rule() RULES="${RULES:+$RULES;}$*" -attr() { RULES="${RULES:+$RULES;}$1:" ; shift; RULES="$RULES$*" ; } -DUMP() echo -n "$SELECTOR{${1+$@;}$RULES}" -alias DUMPS='echo -n "$*{$RULES}"' -SELECTOR() { - test $# = 0 && set "${DSELECTOR?a CSS selector is required}" - DSELECTOR= RULES= SELECTOR="${SELECTOR:+$SELECTOR }$@" -} -alias '?'='trap DUMP EXIT;SELECTOR' -alias '??'='trap DUMPS EXIT; set "${SELECTOR}"; set' -alias '@media'='trap DUMP EXIT;SELECTOR @media' -. "${1-/dev/stdin}"