diff --git a/Makefile b/Makefile index c6e154a..a7fd8b7 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,19 @@ -DISTDIR := $(shell pwd) -TEMPLATE_DIR := $(DISTDIR)/templates -SCRIPT_DIR := $(DISTDIR)/scripts -BUILDDIR := $(DISTDIR)/build +DISTDIR ?= $(shell pwd) +TEMPLATE_DIR ?= $(DISTDIR)/templates +SCRIPT_DIR ?= $(DISTDIR)/scripts +BUILDDIR ?= $(DISTDIR)/build export PAGES := $(wildcard pages/*) -all: $(PAGES) +all: $(PAGES) static $(PAGES): $(MAKE) -C $@ -.PHONY: all $(PAGES) +static: + @mkdir -p $(BUILDDIR) + cp -r static $(BUILDDIR) + +.PHONY: all $(PAGES) static diff --git a/scripts/mk/algorithmica.mk b/scripts/mk/algorithmica.mk index 5490c37..a7888c7 100644 --- a/scripts/mk/algorithmica.mk +++ b/scripts/mk/algorithmica.mk @@ -3,9 +3,9 @@ METADATA := $(METADATA) metadata.md PAGE := $(shell basename $(shell pwd)) -all: $(BUILDDIR)/$(PAGE)/index.html +all: $(BUILDDIR)/page/$(PAGE)/index.html -$(BUILDDIR)/$(PAGE)/index.html: main.md $(METADATA) +$(BUILDDIR)/page/$(PAGE)/index.html: main.md $(TEMPLATE) $(METADATA) @mkdir -p $(@D) pandoc $< $(METADATA) --to html --output $@ --standalone --template $(TEMPLATE) --mathjax diff --git a/static/css/pandoc.css b/static/css/pandoc.css new file mode 100644 index 0000000..f6cb6a3 --- /dev/null +++ b/static/css/pandoc.css @@ -0,0 +1,576 @@ +/* + * Forked from https://gist.github.com/killercup/5917178 + */ + +@font-face { + font-family: 'CMU'; + src: url('/static/fonts/cmu.woff2'); +} + +@font-face { + font-family: 'Lora'; + src: url('/static/fonts/lora.ttf'); +} + +@font-face { + font-family: 'Inconsolata'; + src: url('/static/fonts/inconsolata.woff2'); +} + +@font-face { + font-family: 'Garamond'; + src: url('/static/fonts/garamond.woff2'); +} + +@font-face { + font-family: "Open Sans"; + src: url('/static/fonts/opensans.woff2'); +} + +html { + font-size: 100%; + overflow-y: scroll; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +a { + white-space: pre; /* for some weird reason this affects pre blocks */ +} + +/* BEGIN ALGORITHMICA OLD STYLE */ + +.pagebody { + /* color: #444; */ + font-family: "Times New Roman", Times, "Tinos", serif; + font-size: 16px; + line-height: 1.7; + padding: 8px; + margin: auto; + max-width: 750px; + background: #fefefe; + text-align: justify; + padding-bottom: 25px; +} + +.pagebody .credits { + font-size: 14px; + margin: 25px 10px -40px 15px; + padding: 16px 50px 0 50px; + /* text-align: left; */ + border-top: 1px solid #666; + color: black; +} + +.pagebody .credits table { + border: none; + margin-left: 46px; + margin-bottom: 10px; +} + +.pagebody .credits table td{ + border: none; + padding: 0; + padding-left: 1.5em; +} + +.pagebody #header { + height: 55px; + margin-top: -8px; + margin-bottom: 20px; + border-bottom: 1px solid #666; +} + +.pagebody #links { + display: inline-block; + text-align: right; + font-size: 16px; + float: right; + margin-top: 17px; + margin-right: 12px; +} + +.pagebody #links a { + margin-left: 20px; +} + +.pagebody #header a:hover { + color: #0645ad!important; +} + +.pagebody #header a { + color: #111 !important; + display: inline-block; +} + +.pagebody #logo { + margin-top: 10px; + font-size: 22px; + height: 0; + font-family: 'Garamond', serif; +} + +.pagebody .contents { + position: inline-block; + float: left; + position: relative; + left: 12px; + width: 285px; + text-align: left; +} + +.pagebody .contents ul { + padding-left: 22px; + margin-top: 10px; + list-style-type: none; +} + +.pagebody .contents li { + font-size: 8px; + color: lightgrey; + font-family: 'Open Sans', sans; + height: 30px; + line-height: 8px; + list-style-type: none; + white-space: pre-line; +} + +.pagebody .contents li:hover { + color: black; +} + +.pagebody .contents li:first-letter { + font-size: 13px; + height: 0; +} + +.pagebody .contents a { + font-family: "Times New Roman", Times, "Tinos", serif; + font-size: 16px; + line-height: 1em; + display: inline-block; + width: 252px; +} + +.pagebody .contents a:first-letter { + font-size: 16px; /* the only way to fix */ +} + +.pagebody .contents a:after { + content: "\A"; + white-space: pre; +} + +.pagebody .contents li:before { + content: '•'; + display: inline-block; + position: absolute; + left: 11px; + margin-top: 5px; + color: black !important; + font-size: 18px; +} + +.pagebody a { + color: #0645ad; + text-decoration: none; +} + +.pagebody a:visited { + color: #0b0080; +} + +.pagebody a:hover { + color: #06e; +} + +.pagebody a:active { + color: #faa700; +} + +.pagebody a:focus { + outline: thin dotted; +} + +.pagebody p { + margin: 0.5em 0; +} + +.pagebody img { + max-width: 100%; +} + +.pagebody .title { + display: none; +} + +.pagebody h1 { + text-align: center; + margin-bottom: 0.8em !important; +} + +.pagebody h1, h2, h3, h4, h5, h6 { + font-family: 'Garamond', serif; + color: #111; + line-height: 125%; + margin-top: 1em; + margin-bottom: 0em; + font-weight: normal; +} + +.pagebody h2, h3 { + padding-bottom: 5px; + border-bottom: 1px solid #eaecef; +} + +.pagebody .contents h2, .contents h3 { + padding-bottom: 0; + border-bottom: none; + margin-top: 5px; +} + +.pagebody h4, h5, h6 { + font-weight: bold; +} + +.pagebody h1 { + font-size: 2.5em; + margin-top: 0.8em; +} + +.pagebody h2 { + font-size: 2em; +} + +.pagebody h3 { + font-size: 1.5em; +} + +.pagebody h4 { + font-size: 1.2em; +} + +.pagebody h5 { + font-size: 1em; +} + +.pagebody h6 { + font-size: 0.9em; +} + +.pagebody blockquote { + color: #666666; + margin: 0; + padding-left: 1em; + border-left: 0.5em #EEE solid; +} + +.pagebody hr { + display: block; + width: 100%; + height: 0px; + border: 0; + margin: 0; + padding: 0; + clear: both; +} + +.pagebody pre, code, kbd, samp { + color: #000; + font-family: 'Inconsolata', monospace; +} + +.pagebody pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +.pagebody b, strong { + font-weight: bold; +} + +.pagebody dfn { + font-style: italic; +} + +.pagebody ins { + background: #ff9; + color: #000; + text-decoration: none; +} + +.pagebody mark { + background: #ff0; + color: #000; + font-style: italic; + font-weight: bold; +} + +.pagebody sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +.pagebody sup { + top: -0.5em; +} + +.pagebody sub { + bottom: -0.25em; +} + +.pagebody ul, ol { + margin: 1em 0; + padding: 0 0 0 2em; +} + +.pagebody li p:last-child { + margin-bottom: 0; +} + +.pagebody li ul { + padding-left: 18px; + padding-top: 1px; +} + +.pagebody ul ul, ol ol { + margin: .3em 0; +} + +.pagebody dl { + margin-bottom: 1em; +} + +.pagebody dt { + font-weight: bold; + margin-bottom: .8em; +} + +.pagebody dd { + margin: 0 0 .8em 2em; +} + +.pagebody dd:last-child { + margin-bottom: 0; +} + +.pagebody img { + border: 0; + -ms-interpolation-mode: bicubic; + vertical-align: middle; +} + +.pagebody figure { + display: block; + text-align: center; + margin: 1em 0; +} + +.pagebody img { + border: none; + margin: auto; + display: block; + max-width: 85%; + max-height: 320px; +} + +.pagebody figcaption { + font-size: 0.8em; + font-style: italic; + margin: 0 0 .8em; +} + +.pagebody table { + margin-bottom: 2em; + border-bottom: 1px solid #ddd; + border-right: 1px solid #ddd; + border-spacing: 0; + border-collapse: collapse; +} + +.pagebody table th { + padding: .2em 1em; + background-color: #eee; + border-top: 1px solid #ddd; + border-left: 1px solid #ddd; +} + +.pagebody table td { + padding: .2em 1em; + border-top: 1px solid #ddd; + border-left: 1px solid #ddd; + vertical-align: top; +} + +.pagebody .author { + display: block; + width: 100%; + text-align: right; + margin-top: -30px; + margin-bottom: 40px; + padding-right: 20px; + /* position: absolute; */ + color: #444; + font-size: 0.8em; +} + +.pagebody code:not([class]) { + border: 1px solid #ddd !important; + background-color: #f8f8f8 !important; + border-radius: 3px !important; + padding-left: 2px !important; + padding-right: 2px !important; + font-size: 0.85em; +} + +.pagebody pre { + border: 1px solid #ddd !important; + background-color: #f8f8f8 !important; + border-radius: 3px !important; + padding: 2px !important; + padding-left: 8px !important; + font-size: 0.9em; +} + +@media print { + .pagebody { + font-size: 12pt; + width: 190mm; + margin: 0; + /*margin-left 10mm;*/ + } + + @page { margin: 15mm; } + + #header { + display: none; + } + + .pagebody pre, ul, ol { + page-break-inside: avoid; + } + + .pagebody h1::after, h2::after, h3::after { + /* page-break-after: avoid; */ + content: ""; + display: block; + height: 100px; + margin-bottom: -100px; + } + + /* + h1::before, h2::before, h3::before { + content: ""; + display: block; + height: 100px; + margin-top: 100px; + } + */ + + .pagebody a, a:visited { + text-decoration: underline; + } + + /* + abbr[title]:after { + content: " (" attr(title) ")"; + } + */ + + .pagebody p, h2, h3 { + orphans: 3; + widows: 3; + } +} + +.pagebody a[href^='https://neerc.ifmo.ru']:before { + content: url('https://neerc.ifmo.ru/favicon.ico'); + margin-right: 4px; + position: relative; + top: 4px; +} + +.pagebody a[href^='https://codeforces.com']:before { + content: url('http://codeforces.com/favicon.ico'); + margin-right: 4px; +} + +.pagebody a[href=''] { + color: black; + cursor: default; +} + +/* END OLD ALGORITHMICA STYLE */ + +/* BEGIN PANDOC EMBEDDED STYLE FOR CODE */ + +.pagebody code{white-space: pre-wrap;} +.pagebody span.smallcaps{font-variant: small-caps;} +.pagebody span.underline{text-decoration: underline;} +.pagebody div.column{display: inline-block; vertical-align: top; width: 50%;} +.pagebody div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} +.pagebody ul.task-list{list-style: none;} +.pagebody pre > code.sourceCode { white-space: pre; position: relative; } +.pagebody pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } +.pagebody pre > code.sourceCode > span:empty { height: 1.2em; } +.pagebody .sourceCode { overflow: visible; } +.pagebody code.sourceCode > span { color: inherit; text-decoration: inherit; } +.pagebody div.sourceCode { margin: 1em 0; } +.pagebody pre.sourceCode { margin: 0; } +@media screen { +.pagebody div.sourceCode { overflow: auto; } +} +@media print { +.pagebody pre > code.sourceCode { white-space: pre-wrap; } +.pagebody pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } +} +.pagebody pre.numberSource code { counter-reset: source-line 0; } +.pagebody pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } +.pagebody pre.numberSource code > span > a:first-child::before { content: counter(source-line); + position: relative; left: -1em; text-align: right; vertical-align: baseline; + border: none; display: inline-block; + -webkit-touch-callout: none; -webkit-user-select: none; + -khtml-user-select: none; -moz-user-select: none; + -ms-user-select: none; user-select: none; + padding: 0 4px; width: 4em; + color: #aaaaaa; + } +.pagebody pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } +.pagebody div.sourceCode { } +@media screen { +.pagebody pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } +} +.pagebody code span.al { color: #ff0000; font-weight: bold; } /* Alert */ +.pagebody code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ +.pagebody code span.at { color: #7d9029; } /* Attribute */ +.pagebody code span.bn { color: #40a070; } /* BaseN */ +.pagebody code span.bu { } /* BuiltIn */ +.pagebody code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ +.pagebody code span.ch { color: #4070a0; } /* Char */ +.pagebody code span.cn { color: #880000; } /* Constant */ +.pagebody code span.co { color: #60a0b0; font-style: italic; } /* Comment */ +.pagebody code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ +.pagebody code span.do { color: #ba2121; font-style: italic; } /* Documentation */ +.pagebody code span.dt { color: #902000; } /* DataType */ +.pagebody code span.dv { color: #40a070; } /* DecVal */ +.pagebody code span.er { color: #ff0000; font-weight: bold; } /* Error */ +.pagebody code span.ex { } /* Extension */ +.pagebody code span.fl { color: #40a070; } /* Float */ +.pagebody code span.fu { color: #06287e; } /* Function */ +.pagebody code span.im { } /* Import */ +.pagebody code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ +.pagebody code span.kw { color: #007020; font-weight: bold; } /* Keyword */ +.pagebody code span.op { color: #666666; } /* Operator */ +.pagebody code span.ot { color: #007020; } /* Other */ +.pagebody code span.pp { color: #bc7a00; } /* Preprocessor */ +.pagebody code span.sc { color: #4070a0; } /* SpecialChar */ +.pagebody code span.ss { color: #bb6688; } /* SpecialString */ +.pagebody code span.st { color: #4070a0; } /* String */ +.pagebody code span.va { color: #19177c; } /* Variable */ +.pagebody code span.vs { color: #4070a0; } /* VerbatimString */ +.pagebody code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ + +/* END PANDOC EMBEDDED STYLE FOR CODE */ diff --git a/static/fonts/cmu.woff2 b/static/fonts/cmu.woff2 new file mode 100644 index 0000000..190beaa Binary files /dev/null and b/static/fonts/cmu.woff2 differ diff --git a/static/fonts/garamond.woff2 b/static/fonts/garamond.woff2 new file mode 100644 index 0000000..fe233a1 Binary files /dev/null and b/static/fonts/garamond.woff2 differ diff --git a/static/fonts/inconsolata.woff2 b/static/fonts/inconsolata.woff2 new file mode 100644 index 0000000..f993237 Binary files /dev/null and b/static/fonts/inconsolata.woff2 differ diff --git a/static/fonts/opensans.woff2 b/static/fonts/opensans.woff2 new file mode 100644 index 0000000..c7273f3 Binary files /dev/null and b/static/fonts/opensans.woff2 differ diff --git a/templates/algorithmica.html b/templates/algorithmica.html index ed79c99..28c05b0 100644 --- a/templates/algorithmica.html +++ b/templates/algorithmica.html @@ -3,7 +3,7 @@ - +