-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from leonopulos/Delegate-+-Staff-Crash-Course
Delegate + Staff crash course Markdown files
- Loading branch information
Showing
23 changed files
with
990 additions
and
10 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head></head> | ||
<body> | ||
<div style="border-bottom:1px solid black; text-align:center; width:100%; height:100%"> | ||
<div style="float:left; text-align:left">DOCUMENT_TITLE</div> | ||
<div style="display:inline-block; margin:0 auto"><img src="../../assets/WCAlogo_notext.svg" height="50" alt="WCA logo" /></div> | ||
<div style="float:right; text-align:right">Version: DATE</div> | ||
</div> | ||
<div style="padding-bottom:10px"> </div> | ||
</body></html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
body { | ||
margin 0; | ||
padding 0; | ||
font-family: arial; | ||
font-size: 18px; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
} | ||
|
||
img.logo { | ||
float: left; | ||
padding: 20px; | ||
} | ||
|
||
li { | ||
padding: 5px 0 5px 0; | ||
} | ||
|
||
.box { | ||
border-style: solid; | ||
font-weight: bold; | ||
text-align: center; | ||
margin: 20px; | ||
padding: 5px; | ||
} | ||
|
||
.attention { | ||
background: #fbe5a3; | ||
} | ||
|
||
.important { | ||
background: #d26d6a; | ||
} | ||
|
||
.important p::before { | ||
font-family: monospace; | ||
content: 'IMPORTANT: '; | ||
} | ||
|
||
.centered { | ||
margin-left: auto; | ||
margin-right: auto; | ||
display: block; | ||
} | ||
|
||
.page-break-before { | ||
page-break-before: always; | ||
} | ||
|
||
.page-break-after { | ||
page-break-after: always; | ||
} | ||
|
||
.text-right { | ||
text-align: right; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,57 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
wca_url="https://worldcubeassociation.org/" | ||
|
||
# Find all Markdown files and build PDFs out of them. | ||
# Find formal and legal Markdown files and build PDFs out of them. | ||
find 'documents' -name '*.md' | while read file; do | ||
echo "Processing $file, vanilla style" | ||
|
||
html_name="${file%.md}.html" | ||
pdf_name="${file%.md}.pdf" | ||
|
||
# deliberately NOT using the pipe | operator here because wkhtml tries to resolve image links | ||
# based on the location of its input file. If piping is used, wkhtml assumes /tmp as location | ||
# and links like "./dummy-image.png" become "/tmp/dummy-image.png" instead of "edudoc/$project/dummy-image.png" | ||
sed -r "s#wca\{([^}]*)\}#$wca_url\1#g" "$file" | # Replace wca{...} with absolute WCA URL. | ||
pandoc | # Markdown -> HTML | ||
wkhtmltopdf --encoding 'utf-8' --user-style-sheet 'assets/style.css' -T 15mm -B 15mm -R 15mm -L 15mm --quiet - "$pdf_name" # HTML -> PDF | ||
pandoc -o "$html_name" # Markdown -> HTML | ||
wkhtmltopdf --encoding 'utf-8' --user-style-sheet 'assets/style.css' -T 15mm -B 15mm -R 15mm -L 15mm --quiet "$html_name" "$pdf_name" # HTML -> PDF | ||
done | ||
|
||
compile_date=$(date '+%Y-%m-%d') | ||
|
||
# Find educational Markdown files and build PDFs out of them. | ||
find 'edudoc' -name '*.md' | while read file; do | ||
echo "Processing $file, edudoc style" | ||
|
||
pdf_name="${file%.md}.pdf" | ||
html_name="${file%.md}.html" | ||
|
||
header_html="${file%.md}-header.html" | ||
|
||
file_headline=$(head -n 1 "$file") | ||
document_title=$(echo "$file_headline" | sed -E "s/#+\s*//") | ||
|
||
sed -E "s#DOCUMENT_TITLE#$document_title#g" "assets/edudoc-header.html" | | ||
sed -E "s#DATE#$compile_date#g" > "$header_html" | ||
|
||
pandoc -s --from markdown --to html5 --metadata pagetitle="$document_title" "$file" -o "$html_name" # Markdown -> HTML | ||
wkhtmltopdf --encoding 'utf-8' --user-style-sheet 'assets/edudoc-style.css' -T 15mm -B 15mm -R 15mm -L 15mm --header-html "$header_html" --footer-center "[page]" --quiet "$html_name" "$pdf_name" # HTML -> PDF | ||
done | ||
|
||
# Move pdf files to build directory | ||
# Remove potentially cached PDFs from last build run | ||
rm -rf build | ||
cp -r documents build | ||
find build -name '*.md' -exec rm {} + | ||
find documents -name '*.pdf' -exec rm {} + | ||
# Create build dir so that the following cp operations maintain folder structure | ||
mkdir build | ||
# Copy generated content into build folder | ||
cp -r documents build/ | ||
cp -r edudoc build/ | ||
# Remove source files from target build and trim empty directories | ||
find build/ -type f -not -name "*.pdf" -delete | ||
find build/ -type d -empty -delete | ||
# Remove target PDF from source folder | ||
find documents/ -name "*.pdf" -delete | ||
find edudoc/ -name "*.pdf" -delete | ||
find documents/ -name "*.html" -delete | ||
find edudoc/ -name "*.html" -delete |
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.