From dfa41b2af885e8b51327064d0789dd02f53f635a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 17 Nov 2024 19:49:22 -0300 Subject: rm- rf src/development/ --- src/development/JEKYLL_COMPAT/copy-content.sh | 18 --- src/development/config.env | 5 - src/development/dynmake.sh | 122 ------------------ src/development/frontmatter-env.sh | 91 ------------- src/development/genhtml.sh | 179 -------------------------- src/development/lib.sh | 30 ----- src/development/md2html.pl | 161 ----------------------- 7 files changed, 606 deletions(-) delete mode 100755 src/development/JEKYLL_COMPAT/copy-content.sh delete mode 100755 src/development/config.env delete mode 100755 src/development/dynmake.sh delete mode 100755 src/development/frontmatter-env.sh delete mode 100755 src/development/genhtml.sh delete mode 100755 src/development/lib.sh delete mode 100755 src/development/md2html.pl (limited to 'src/development') 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 - - - - - - - - - - - - - EuAndreh - - - - - - - - - - - -
- -
-
-
-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 -
-
- - - -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 = '' . $i++ . '' . $_ . ''; - 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 (/^
', '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;
-}
-- 
cgit v1.2.3