This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# create Hugo content files from random Wikipedia articles; | |
# requires Pandoc to convert HTML to Markdown | |
# | |
read -r -d '' USAGE <<'EOF' | |
Usage: wikiblog.sh [options] | |
-a list of possible authors for an article (selects 1) | |
-c list of possible categories (select up to N-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ $pag := $.Paginator }} | |
{{ if gt $pag.TotalPages 1 }} | |
<ul class="pagination"> | |
{{ with $pag.First }} | |
<li class="first {{ if not $pag.HasPrev }}disabled{{ end }}"><a href="{{ .URL }}" aria-label="First"><span aria-hidden="true">««</span></a></li> | |
{{ end }} | |
<li class="previous {{ if not $pag.HasPrev }}disabled{{ end }}"><a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">«</span></a></li> | |
<li class="active"><a href="{{ $pag.URL }}">{{ $pag.PageNumber }}</a></li> | |
<li class="next {{ if not $pag.HasNext }}disabled{{ end }}" aria-label="Next"><a href="{{ if $pag.HasNext }}{{ $pag.Next.URL }}{{ end }}"><span aria-hidden="true">»</span></a></li> | |
{{ with $pag.Last }}<li class="last {{ if not $pag.HasNext }}disabled{{ end }}"><a href="{{ .URL }}" aria-label="Last" title="{{$pag.TotalPages}}"><span aria-hidden="true">»»</span></a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# work around Hugo's lack of monthly archives by filling the archive | |
# section with stub articles, one for each month referenced in the | |
# front matter of articles in the "post" category: | |
# +++ | |
# date = "2017-04-01T00:00:00" | |
# title = "April 2017" | |
# month = "2017-04" | |
# +++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# take a list of Hugo content files and add random taxonomies | |
# to their TOML front matter: | |
# find content -name '*.md' | taxonomies.pl -T 5 -t 1000 | |
use strict; | |
use List::Util qw(shuffle); | |
use Getopt::Long qw(:config no_ignore_case bundling); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# add smart quotes to Hugo Markdown source files, using the | |
# reference implementation of CommonMark's CLI tool: | |
# https://github.com/commonmark/commonmark-spec | |
# Notes: | |
# - assumes TOML front matter | |
# - converts footnote-style links to inline | |
# - normalizes ordered/unordered list formatting | |
# |