Skip to content

Commit

Permalink
Integrate wca-edudoc style into compiler toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Billing committed Nov 10, 2019
1 parent 347b573 commit 81c4317
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 5 deletions.
10 changes: 10 additions & 0 deletions assets/edudoc-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!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="https://www.worldcubeassociation.org/files/WCAlogo_notext.svg" height="50" alt="WCA logo" /></div>
<div style="float:right; text-align:right">Version: DATE</div>
</div>
</body></html>
26 changes: 26 additions & 0 deletions assets/edudoc-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
body {
margin 0;
padding 0;
font-family: arial;
}

h1 {
text-align: center;
}

img.logo {
float: left;
padding: 20px;
}

.important {
background: #f00;
border-style: solid;
font-weight: bold;
text-align: center;
}

.important p::before {
font-family: monospace;
content: 'IMPORTANT: ';
}
39 changes: 34 additions & 5 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,46 @@

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"

pdf_name="${file%.md}.pdf"

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
done

# Move pdf files to build directory
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"
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" | # 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 - "$pdf_name" # HTML -> PDF
done

# 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
find build/ -type f -not -name "*.pdf" -delete
# Remove target PDF from source folder
find documents/ -name "*.pdf" -delete
find edudoc/ -name "*.pdf" -delete
find edudoc/ -name "*.html" -delete
35 changes: 35 additions & 0 deletions edudoc/competitor-tutorial/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# WCA Competition Tutorial

## WCA Organization - General Introduction
![WCA logo](https://www.worldcubeassociation.org/files/WCAlogo_notext.svg){.logo height=133px}
The World Cube Association is the organization responsible for organizing speedcubing competitions all around the world.
Every competition that is sanctioned by the WCA has to follow the WCA Regulations and Guidelines,
so it's very important that you are familiar with them before going to a competition.

This document will guide you through the basics of competing and judging. Reading this document can be very helpful
to get a basic picture about official WCA competitions, but we still recommend you to read the WCA Regulations and Guidelines
and participate in the "Competition Tutorial" event at the competition if your competition has one.

## Roles at competitions
- **Delegate**: Delegates are the officials of the WCA, and they are responsible for ensuring the WCA Regulations
are followed during the competition. They also handle incidents and are responsible for scrambles and results.
If you ever have any doubts or questions, they should be your first choice for asking.

::::: {.important}
If you are not sure about something, always ask the Delegate!
:::::

- **Organizer**: Organizers are responsible for organizing the competition and for ensuring that it runs smoothly
through the day(s). Usually organizers are experienced cubers, so they also might be able to help you.
Just remember that only the Delegate can make official decisions.
- **Competitor**: Your basic role is that of a competitor. However, you may be called to judge or run
should it be required
- **Judge**: The judges ensure that attempts are performed according to the Regulations. At the end of each attempt,
they certify with their signature that everything was okay.
- **Runner**: Runners are responsible for moving puzzles between scramblers and judges.
- **Scrambler**: Scramblers are the ones who apply official scramble sequences on puzzles
and make sure that all the scrambles are correct.

## Objects at the competition
- **Stackmat timer**: This is the official device for measuring times at a competition.
It can look like any of the three versions below.

0 comments on commit 81c4317

Please sign in to comment.