Untrack wiki files

master
Hektor Misplon 2023-05-01 15:27:25 +02:00
parent 8ce25ec22d
commit 5fd5686fd4
6 changed files with 0 additions and 2448 deletions

View File

@ -1,34 +0,0 @@
NOTES := $(wildcard *.md)
AUXFILES := ./img/
target=wiki
exports=$(NOTES:.md=.html)
WIKI_DIR=/home/h/.wiki
%.html : %.md
pandoc \
-f markdown+latex_macros-yaml_metadata_block+abbreviations+emoji+pipe_tables \
-t html5 \
-c pandoc.css \
--citeproc \
--metadata-file=meta.yaml \
--template=$(WIKI_DIR)/template \
--bibliography $(WIKI_DIR)/references.bib \
--resource-path=$(WIKI_DIR)/img/ \
--lua-filter=$(WIKI_DIR)/filters/html-links.lua \
--lua-filter=$(WIKI_DIR)/filters/tikz.lua \
--lua-filter=$(WIKI_DIR)/filters/zotero.lua \
--lua-filter=$(WIKI_DIR)/lua-filters/diagram-generator/diagram-generator.lua \
--lua-filter=$(WIKI_DIR)/lua-filters/lilypond/lilypond.lua \
--toc \
--markdown-headings=atx \
--extract-media=img \
--strip-comments \
--file-scope \
-s -o "$@" "$<"
.PHONY: all clean
all: $(exports)
clean: rm $(exports)

View File

@ -1,9 +0,0 @@
function Link(el)
--Replace markdown extension with html extension
if string.match(el.target, '.md$') then
el.target = string.gsub(el.target, "%.md", "")
--Add html extension
el.target = el.target .. '.html'
end
return el
end

View File

@ -1,63 +0,0 @@
local system = require 'pandoc.system'
local tikz_doc_template = [[
\documentclass{standalone}[border=0.2cm]
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows.meta}
\begin{document}
%s
\end{document}
]]
local function tikz2image(src, filetype, outfile)
system.with_temporary_directory('tikz2image', function (tmpdir)
system.with_working_directory(tmpdir, function()
local f = io.open('tikz.tex', 'w')
f:write(tikz_doc_template:format(src))
f:close()
os.execute('pdflatex tikz.tex')
if filetype == 'pdf' then
os.rename('tikz.pdf', outfile)
else
os.execute('pdf2svg tikz.pdf ' .. outfile)
end
end)
end)
end
extension_for = {
html = 'svg',
html4 = 'svg',
html5 = 'svg',
latex = 'pdf',
beamer = 'pdf' }
local function file_exists(name)
local f = io.open(name, 'r')
if f ~= nil then
io.close(f)
return true
else
return false
end
end
local function starts_with(start, str)
return str:sub(1, #start) == start
end
function RawBlock(el)
if starts_with('\\begin{tikzpicture}', el.text) then
local filetype = extension_for[FORMAT] or 'svg'
local fbasename = pandoc.sha1(el.text) .. '.' .. filetype
-- Save to './img' if it does not exist yet
local fname = system.get_working_directory() .. '/img/' .. fbasename
if not file_exists(fname) then
tikz2image(el.text, filetype, fname)
end
-- Return `<img src="img/<file-name>" />` wrapped in a paragraph
return pandoc.Para({pandoc.Image({}, 'img/' .. fbasename)})
else
return el
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,207 +0,0 @@
@font-face {
font-family: Inter;
src: /* font might be installed locally */ local('Inter');
/* TODO: fallback to url imports */
}
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
display: flex;
flex-direction: column;
color: #ccc;
background: #111;
font-family: Inter, serif;
font-size: 1rem;
line-height: 1.5;
padding: 3.2rem;
margin: 0 auto;
max-width: 48rem;
}
a {
color: inherit;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
margin-top: 1.6rem;
}
h1 {
font-size: 24px;
}
h2 {
font-size: 20px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
p {
margin: 0.4rem 0;
max-width: 32rem;
}
p + h1,
p + h2,
p + h3,
p + h4 {
margin-top: 1.6rem;
}
h1 + p,
h1 + ul,
h1 + ol {
margin-top: 1.2rem;
}
h2 + p,
h2 + ul,
h2 + ol {
margin-top: 0.8rem;
}
h3 + p,
h3 + ul,
h3 + ol {
margin-top: 0.4rem;
}
h4 + p,
h4 + ul,
h4 + ol {
margin-top: 0.4rem;
}
p + p {
margin-top: 0.8rem;
}
td {
padding: 0.4rem 0;
}
th {
padding: 0.4rem 0;
text-align: left;
}
ul,
ol {
list-style-position: outside;
padding: 0;
margin: 0;
margin-bottom: 0.8rem;
}
ul ul,
ol ol,
ul ol,
ol ul {
padding-left: 0.8rem;
}
img {
max-width: 100%;
}
figure > img {
filter: hue-rotate(180deg) invert(1);
mix-blend-mode: screen;
}
/* Minimal scrollbars */
::-webkit-scrollbar {
width: 0.2rem;
}
::-webkit-scrollbar-thumb {
background: #333;
}
hr {
border: none;
border-top: 1px solid #222;
margin: 0.8rem 0;
}
figcaption {
text-align: right;
font-size: 10px;
font-style: italic;
}
/* Tables */
table {
border-collapse: collapse;
min-width: 16rem;
margin: 0.8rem 0;
}
th,
td {
padding: 0.8rem;
padding-left: 0.2rem;
}
th {
border-bottom: 1px solid #222;
}
/* Footnotes */
.footnote-ref {
color: #888;
font-size: 0.8rem;
}
/* References and citations */
.citation {
font-size: 0.8rem;
color: #555;
transition: 0.15s cubic-bezier(0.19, 1, 0.22, 1);
}
.references {
color: #555;
border-top: 1px solid #222;
padding: 1.6rem;
margin: 1.6rem 0;
transition: 0.15s cubic-bezier(0.19, 1, 0.22, 1);
}
.citation:hover,
.references:hover {
color: #888;
}
.list-grid {
display: flex;
flex-wrap: wrap;
}
.list-grid > ul,
.list-grid > ol {
flex: 1 0 16rem;
padding: 1.6rem 0;
border-top: 1px solid #222;
list-style: none;
}

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
#
# Script to create a markdown file containing links to all filenames prefixed
# with "<prefix>-":
#
# Example usage: generate-md-index "book" "Books" "my-books.md"
#
# Creates a file my-books.md in the wiki with a title of "Books" This file
# contains titled links to every markdown file starting with "books-"
wiki="$HOME/.wiki"
prefix="$1"
title="$2"
filename="$3"
if [ $# == 2 ]; then
echo "$0 <prefix> <title> <filename>"
exit 0
fi
find "$wiki"/"$prefix"-*.md -printf "%f\n" > "$wiki/scripts/$prefix/$prefix-links"
find "$wiki"/"$prefix"-*.md -exec head -n 1 {} \; > "$wiki/scripts/$prefix/$prefix-titles"
sed -i -e 's/^/(/' "$wiki/scripts/$prefix/$prefix-links" -e 's/$/)/' # Wrap links in parentheses
sed -i -e 's/^/[/' "$wiki/scripts/$prefix/$prefix-titles" -e 's/$/]/' # Wrap titles in square brackets
sed -i -e 's/^\[#\ /* \[/' "$wiki/scripts/$prefix/$prefix-titles" # Remove '#' and add list bullet
echo -e "# $title\n" > "$wiki/$filename" # Clear file and add markdown title
paste "$wiki/scripts/$prefix/$prefix-titles" "$wiki/scripts/$prefix/$prefix-links" -d "" >> "$wiki/$filename" # Concatenate & append to file
paste "$wiki/scripts/$prefix/$prefix-titles" "$wiki/scripts/$prefix/$prefix-links" -d ""