From 13e69e437fbd562766386e7ec05d9e79b3698704 Mon Sep 17 00:00:00 2001 From: Orestis Malaspinas <orestis.malaspinas@hesge.ch> Date: Mon, 24 Aug 2020 11:26:47 +0200 Subject: [PATCH] project setup --- .gitignore | 7 +++++++ .gitlab-ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 00_macros.md | 5 +++++ Makefile | 35 +++++++++++++++++++++++++++++++++++ MathJax.js | 4 ++++ metadata.yaml | 23 +++++++++++++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 00_macros.md create mode 100644 Makefile create mode 100644 MathJax.js create mode 100644 metadata.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca0e1cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.aux +*.dvi +*.log +*.gz +*.backup +*.pdf +*.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..05a1e07 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,48 @@ +image: omalaspinas/pandoc:latest + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +before_script: + ## + ## Run ssh-agent (inside the build environment) + ## + - eval $(ssh-agent -s) + + ## + ## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store + ## We're using tr to fix line endings which makes ed25519 keys work + ## without extra base64 encoding. + ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556 + ## + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + + ## + ## Create the SSH directory and give it the right permissions + ## + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + + ## + ## Add host id to known_hosts + ## + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + + + +build_only: + script: + - make + - make deploy + - rsync -avzz phys ur1bg_malas@ur1bg.ftp.infomaniak.com:web/malaspinas/ + +build_artifacts: + script: + - make + artifacts: + paths: + - "cours.html" + - "cours.pdf" + only: + - tags diff --git a/00_macros.md b/00_macros.md new file mode 100644 index 0000000..7dd8daa --- /dev/null +++ b/00_macros.md @@ -0,0 +1,5 @@ + \newcommand{\ux}{\bm{x}} + \newcommand{\dd}{\mathrm{d}} + \newcommand{\real}{\mathbb{R}} + \newcommand{\grad}{\mathrm{grad}} + \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..87a06d8 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +STYLES := css/tufte-css/tufte.css \ + css/pandoc.css \ + css/pandoc-solarized.css \ + css/tufte-extra.css + +OPTIONS = --toc +OPTIONS += --filter=pandoc-numbering +OPTIONS += --filter=pandoc-crossref + +PDFOPTIONS = --highlight-style kate +PDFOPTIONS += --pdf-engine pdflatex +PDFOPTIONS += --number-sections +PDFOPTIONS += --template=./default.latex + + +HTMLOPTIONS += -t html5 +HTMLOPTIONS += -c css/tufte-css/tufte.css +HTMLOPTIONS += --self-contained +HTMLOPTIONS += --mathjax=MathJax.js + +all: cours.pdf cours.html + +cours.pdf: 00_macros.md + pandoc -s $(OPTIONS) $(PDFOPTIONS) -o $@ $^ --metadata-file metadata.yaml + +cours.html: 00_macros.md + pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $^ --metadata-file metadata.yaml + +deploy: all + mkdir -p phys + cp cours.html phys/index.html + cp cours.pdf phys/cours.pdf + +clean: + rm -rf *.html *.pdf diff --git a/MathJax.js b/MathJax.js new file mode 100644 index 0000000..3c5458c --- /dev/null +++ b/MathJax.js @@ -0,0 +1,4 @@ +var fileref=document.createElement('script') +fileref.setAttribute("type","text/javascript") +fileref.setAttribute("src", "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML") +document.getElementsByTagName("head")[0].appendChild(fileref) diff --git a/metadata.yaml b/metadata.yaml new file mode 100644 index 0000000..3113842 --- /dev/null +++ b/metadata.yaml @@ -0,0 +1,23 @@ +--- +author: +- Orestis Malaspinas +title: Physique appliquée +autoSectionLabels: false +autoEqnLabels: true +eqnPrefix: + - "éq." + - "éqs." +chapters: true +numberSections: false +chaptersDepth: 1 +sectionsDepth: 3 +lang: fr +documentclass: book +papersize: A4 +cref: false +urlcolor: blue +--- + + + + -- GitLab