Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fyrsta útgáfa af pdf útgáfu #13

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ temp
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# pdf output
/pdf
22 changes: 22 additions & 0 deletions chapters/pdf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Bókin um vefforritun"
subtitle: "Lærðu að smíða vefi með HTML og CSS ✨"
author: "Ólafur Sverrir Kjartansson"
toc: true
toc-title: Efnisyfirlit
papersize: a4
lang: is-IS
geometry:
- top=40mm
- right=30mm
- bottom=40mm
- left=30mm
header-includes:
# Wrappa kóðablokkir
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
- \usepackage{fvextra}
# Wrappa inline kóða
- \usepackage[htt]{hyphenat}
# Færa footnotes lengra frá efni
- \addtolength{\skip\footins}{2pc}
---
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"scripts": {
"generate": "node src/generate.js",
"clean": "rm -rf ./cache ./build",
"wordlist": "find ./chapters/*.md -type f | xargs grep --color=always -w -Ff ./wordlist.txt | awk '{print $0,\"\\n\"}'"
"wordlist": "find ./chapters/*.md -type f | xargs grep --color=always -w -Ff ./wordlist.txt | awk '{print $0,\"\\n\"}'",
"pdf": "pandoc -s ./chapters/pdf.md $(cat pdffiles.txt) -o ./pdf/bok.pdf --pdf-engine=xelatex --number-sections --resource-path=./chapters --lua-filter=./pandoc-filters.lua"
},
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions pandoc-filters.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--[[
Strip out images that are not local, some chapters use YouTube embeds that otherwise break while building
See
https://github.com/jgm/pandoc/issues/4893
https://pandoc.org/lua-filters.html
https://github.com/pandoc/lua-filters
]]--
function Image(element)
if element.src.sub(element.src, 1, string.len('http')) == 'http' then
return {}
end
end
25 changes: 25 additions & 0 deletions pdffiles.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
./chapters/00.inngangur.md
./chapters/01.internetid.md
./chapters/02.saga.md
./chapters/03.html.md
./chapters/04.element.md
./chapters/05.toflur-listar-form.md
./chapters/06.ad-skrifa-html.md
./chapters/07.adgengi.md
./chapters/08.seo.md
./chapters/09.css.md
./chapters/10.css-malfraedi.md
./chapters/11.css-box-model.md
./chapters/12.css-specifity-cascade.md
./chapters/13.css-best-practices.md
./chapters/14.visual-formatting.md
./chapters/15.css-letur-litir.md
./chapters/16.css-studningur.md
./chapters/17.css-flexbox.md
./chapters/18.skalanlegir.md
./chapters/19.kvikun.md
./chapters/20.honnun.md
./chapters/21.grid.md
./chapters/22.css-verkefni.md
./chapters/23.css-taeki-tol.md
./chapters/24.npm-taeki-tol.md