diff options
Diffstat (limited to '')
-rwxr-xr-x | src/development/JEKYLL_COMPAT/copy-content.sh | 18 | ||||
-rwxr-xr-x | src/development/config.env | 5 | ||||
-rwxr-xr-x | src/development/dynmake.sh | 122 | ||||
-rwxr-xr-x | src/development/frontmatter-env.sh | 91 | ||||
-rwxr-xr-x | src/development/genhtml.sh | 179 | ||||
-rwxr-xr-x | src/development/lib.sh | 30 | ||||
-rwxr-xr-x | src/development/md2html.pl | 161 |
7 files changed, 0 insertions, 606 deletions
diff --git a/src/development/JEKYLL_COMPAT/copy-content.sh b/src/development/JEKYLL_COMPAT/copy-content.sh deleted file mode 100755 index 4857ac6..0000000 --- a/src/development/JEKYLL_COMPAT/copy-content.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -eu - -# JEKYLL_COMPAT: copy files while things under `src/content/` aren't the -# canonical source - -for f in _pastebins/*; do - NAME="$(basename "$f")" - DATE="$(echo "$NAME" | cut -d- -f-3 | tr '-' '/')" - FILENAME="$(echo "$NAME" | cut -d- -f4-)" - - DIR="src/content/pastebin/$DATE" - mkdir -p "$DIR" - - if [ ! -e "$DIR/$FILENAME" ]; then - cp "$f" "$DIR/$FILENAME" - fi -done diff --git a/src/development/config.env b/src/development/config.env deleted file mode 100755 index 9da0910..0000000 --- a/src/development/config.env +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -FQDN='euandre.org' -BASE_URL='/' # '/subfolder' -lang=en diff --git a/src/development/dynmake.sh b/src/development/dynmake.sh deleted file mode 100755 index 4098f46..0000000 --- a/src/development/dynmake.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - dynmake.sh - dynmake.sh -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s.\n' "$2" >&2 - exit 2 - fi -} - - - -varlist() { - sed -e 's/^/ /' \ - -e 's/$/ \\/' -} - -# -# Pastebins -# - -pastebins() { - find src/content/pastebin/ -name '*.md' -} - -printf 'pastebins.md = \\\n' -pastebins | varlist -printf '\n' - -pastebins | sed 's/^\(.*\)\.md$/\1.html: \1.env/' - - - -# -# torrent files -# - -torrents() { - find resources/ \ - -name '*.flac' -or \ - -name '*.webm' -} - -printf 'torrent-files = \\\n' -torrents | sed 's|$|.torrent|' | varlist -printf '\n' - -torrents | awk '{ printf "%s.torrent: %s\n", $0, $0 }' - - -# -# Lilypond files -# - -lilyponds() { - find music/ -name '*.ly' -} - -printf 'lilypond.ly = \\\n' -lilyponds | varlist -printf '\n' - -lilyponds | sed 's/^\(.*\)\.ly$/\1.pdf: \1.midi/' - - -# -# Podcasts -# - -podcasts() { - find resources/podcasts/ -name '*.flac' -} - -printf 'podcasts.flac = \\\n' -podcasts | varlist -printf '\n' diff --git a/src/development/frontmatter-env.sh b/src/development/frontmatter-env.sh deleted file mode 100755 index f79ad50..0000000 --- a/src/development/frontmatter-env.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -set -eu -. src/development/lib.sh - -usage() { - cat <<-'EOF' - Usage: - frontmatter-env.sh < STDIN - frontmatter-env.sh -h - EOF -} - -help() { - cat <<-'EOF' - - - Options: - -h, --help - - - Examples: - - FIXME: - - $ FIXME - EOF -} - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - -DELIM="$(uuid)" -awk -vDELIM="$DELIM" -vQUOTE="'" -F: ' - BEGIN { - separator = 0 - } - - /^---$/ { - separator++ - if (separator > 1) { - exit - } else { - next - } - } - - /^$/ { next } - - { - printf "%s=\"$(\n\tcat <<-%s%s%s\n\t\t", $1, QUOTE, DELIM, QUOTE - base_index = 1 - offset = base_index + length($1) + length(": ") - - # printf "\t%s\n", substr($0, offset + quote, length($0) - offset - quote) - # JEKYLL_COMPAT: quoted titles because of the frontmatter - if ($3 != "") { - quote = length("\"") - printf "%s", substr($0, offset + quote, length($0) - offset - quote) - } else { - printf "%s", substr($0, offset) - } - printf "\n\t%s\n)\"\n\n", DELIM - } -' diff --git a/src/development/genhtml.sh b/src/development/genhtml.sh deleted file mode 100755 index 2a5c611..0000000 --- a/src/development/genhtml.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' | sed "s|@NAME@|$0|g" - Usage: - @NAME@ FILENAME - @NAME@ -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - FILENAME the input markdown file - EOF -} - -for f in "$@"; do - case "$f" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) -F="${1:-}" - -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s.\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -assert_arg "$F" 'FILENAME' - -HTML="$(dirname "$F")/$(basename "$F" .md).html" - -escape() { - sed 's/a/a/' -} - -url_for() { - printf '%s%s' "$BASE_URL" "$1" -} - -absolute() { - printf 'https://%s%s' "$FQDN" "$(cat)" -} - -_() { - printf '%s' "$1" | escape -} - -# FIXME -langs='en pt fr eo es' -# langs='' -. src/development/config.env -. "${F%.md}.env" - -# src/development/md snippets "$F" - -cat <<-EOF - <!DOCTYPE html> - <html lang="$lang"> - <head> - <meta charset="UTF-8" /> - <meta viewport content="width=device-width, initial-scale=1" /> - <link rel="stylesheet" type="text/css" href="$(url_for 'styles.css')" /> - <link rel="icon" type="image/svg+xml" href="$(url_for 'static/lord-favicon.svg')" /> - <link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for 'feed.articles.en.atom')" title="$(_ "EuAndreh's blog")" /> - <link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for 'feed.tils.en.atom')" title="$(_ "EuAndreh's TIL")" /> - <link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for 'feed.podcasts.en.atom')" title="$(_ "EuAndreh's podcasts")" /> - <link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for 'feed.screencasts.en.atom')" title="$(_ "EuAndreh's screencasts")" /> - - <title>EuAndreh</title> - - <meta name="author" content="EuAndreh" /> - <meta property="og:site_name" content="$(_ 'FIXME 1')" /> - <meta property="og:locale" content="$lang" /> - <meta property="og:title" content="$(_ 'FIXME 2')" /> - - <link rel="canonical" href="$(url_for '' | absolute)" /> - <meta property="og:url" content="$(url_for '' | absolute)" /> - <!-- FIXME: link to next and prev --> - </head> - <body> - <header> - <nav> - <ul> - <a href="$(url_for "$lang/")">$(_ 'FIXME homepage link name')</a> - <a href="$(url_for "$(_ 'about.html')")">$(_ 'About')</a> - </ul> -EOF - -if [ -n "$langs" ]; then - printf ' <ul>\n' - for l in $langs; do - cat <<-EOF - <li> - <a href="FIXME 3">$l</a> - </li> - EOF - done - printf ' </ul>\n' -fi - -cat <<-EOF - </nav> - </header> - <main> - <article> -EOF - -awk ' - BEGIN { - separator = 0 - should_print = 0 - } - - /^---$/ { - separator++ - } - - should_print {print} - - separator == 2 && !should_print { should_print = !should_print } -' "$F" | - md2html - -# src/development/md render - -cat <<-EOF - </article> - </main> - <footer> - <ul> - <li> - <img class="FIXME" src="$(url_for 'static/envelope.svg' alt="FIXME")" /> - <a href="mailto:eu@euandre.org">eu@euandre.org</a> - </li> - <li> - <img class="FIXME" src="$(url_for 'static/lock.svg' alt="FIXME")" /> - <a href="$(url_for 'static/public.asc')">81F90EC3CD356060</a> - </li> - </ul> - <p> - $(_ 'The content for this site is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>. The <a href="https://euandre.org/git/website.git">code</a> is <a rel="license" href="https://euandre.org/git/euandre.org/tree/COPYING">AGPLv3 or later</a>. Patches welcome.') - </p> - </footer> - </body> - </html> -EOF diff --git a/src/development/lib.sh b/src/development/lib.sh deleted file mode 100755 index fb2c124..0000000 --- a/src/development/lib.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -assert_arg() { - if [ -z "$1" ]; then - echo "Missing $2" >&2 - exit 2 - fi -} - -uuid() { - od -xN20 /dev/urandom | - head -n1 | - awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' -} - -tmpname() { - echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)" -} - -mkstemp() { - name="$(tmpname)" - touch "$name" - echo "$name" -} - -mkdtemp() { - name="$(tmpname)" - mkdir "$name" - echo "$name" -} diff --git a/src/development/md2html.pl b/src/development/md2html.pl deleted file mode 100755 index de29e40..0000000 --- a/src/development/md2html.pl +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env perl - -use v5.34; -use warnings; -use feature 'signatures'; -no warnings 'experimental'; - -use Getopt::Std (); -use CommonMark (); -BEGIN { *CM:: = *CommonMark:: } - - - -sub usage($fh) { - print $fh <<~'EOF'; - Usage: - md - md -h - EOF -} - -sub help($fh) { - print $fh <<~'EOF'; - - Options: - -h, --help show this message - EOF -} - -for (@ARGV) { - last if $_ eq '--'; - if ($_ eq '--help') { - usage *STDOUT; - help *STDOUT; - exit; - } -} - -my %opts; -if (!Getopt::Std::getopts('h', \%opts)) { - usage *STDERR; - exit 2; -} - -if ($opts{h}) { - usage *STDOUT; - help *STDOUT; - exit; -} - -sub into_table($s) { - my @lines = (); - my $i = 1; - for (split "\n", $s) { - my $line = '<tr><td>' . $i++ . '</td><td>' . $_ . '</td></tr>'; - push @lines, $line; - } - return join "\n", @lines; -} - -sub with_file($f, $mode, $block) { - \$block(); - -} - -given (shift @ARGV) { - shift @ARGV if defined($ARGV[0]) and $ARGV[0] eq '--'; - when ('snippets') { - for (@ARGV) { - open my $fh, '<', $_ or die "Can't open $_"; - my $doc = CM->parse(file => $fh); - my $iter = $doc->iterator; - my $i = 0; - while (my ($event_type, $node) = $iter->next) { - next if $node->get_type != CM::NODE_CODE_BLOCK; - my $f = "$_.$i.txt"; - $i++; - say 123; - with_file $f, '>', sub { - say 456; - }; - open my $fh, '>', $f or die "Can't open $f"; - print $fh $node->get_literal; - close $fh or die "Can't close $f"; - } - close $fh or die "Can't close $_"; - } - } - when ('render') { - my $s = CM->parse(file => *STDIN)->render(format => 'html'); - my @ret = (); - my $in_block = 0; - for (split "\n", $s) { - if (/^<pre><code/) { - say $_; - } - push @ret, $_; - } - - break; - my $s2 = join("\n", @ret) . "\n"; - # say "antes: $s"; - # say "depois: " . join "\n", @ret; - open my $fh1, '>', 'antes'; - print $fh1 $s; - close $fh1; - open my $fh2, '>', 'depois'; - print $fh2 $s2; - close $fh2; - say '=========' if $s eq $s2; - - break; - say "$s"; - my $doc = CM->parse(file => *STDIN); - my $iter = $doc->iterator; - while (my ($event_type, $node) = $iter->next) { - # say $node->get_on_exit; - # say $node->get_type_string; - # next; - # next if $node->get_type == CM::NODE_DOCUMENT; - # next unless $event_type == CM::EVENT_ENTER; - if ($node->get_type == CM::NODE_CODE_BLOCK) { - # say $node->get_on_exit; - # say $node->get_on_enter; - # say 123; - # next; - # $node->set_literal(into_table($node->get_literal)); - # say 123; - } else { - # say $node->render(format => 'html'); - # use Data::Dumper; - # say Dumper($node->get_type_string); - } - } - say $doc->render(format => 'html', unsafe => 1); - } - default { - print STDERR "Bad ACTION \"$_\".\n\n"; - usage *STDERR; - exit 2; - } -} - - - -__END__ - -# use Data::Dumper; -# print Dumper(\%opts); - -# exit: extra newline in output -# no warnings ('experimental::signatures', ); -# no warnings ('experimental::when', ); -# $Getopt::Std::STANDARD_HELP_VERSION = 1; -perlcritic - -use builtin qw(true); -if (true) { - say 'true'; - exit 3; -} |