Skip to content

Commit

Permalink
Merge pull request #57 from HE-Arc/feat/make-all
Browse files Browse the repository at this point in the history
feat: pdfs are back
  • Loading branch information
grunenwald authored Oct 25, 2023
2 parents 8acbdcd + 5189a02 commit 0a71035
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 58 deletions.
71 changes: 45 additions & 26 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,67 @@
name: html generation with pandoc
run-name: ${{ github.actor }} is generating new slides
name: Generation with pandoc
run-name: ${{ github.actor }} is generating new slides
on: [push]

env:
PANDOC_VERSION: 3.1.8
# EMOJIONE_VERSION: 8.0.0

jobs:
md2html:
runs-on: ubuntu-latest
build:
runs-on: ubuntu-22.04
concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: true
steps:
- run: echo "🎉 Job triggered by a ${{ github.event_name }}, running on ${{ runner.os }}"
- run: |
wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-1-amd64.deb -O pandoc.deb
sudo dpkg -i pandoc.deb
# - run: |
# wget https://github.com/joypixels/emoji-assets/archive/v${EMOJIONE_VERSION}.tar.gz -O emojione-assets.tgz
# tar xf emojione-assets.tgz
# mv emoji-assets-${EMOJIONE_VERSION} emojione-assets
# wget https://raw.githubusercontent.com/mreq/xelatex-emoji/master/xelatexemoji.sty
# wget https://raw.githubusercontent.com/mreq/xelatex-emoji/master/xelatexemoji-flags.sty
# sed -i 's/^\(\\usepackage{amsmath}\)/%\1/' xelatexemoji.sty
# sed -i 's/^\(\\providecommand{\\xelatexemojipath}\)/%\1/' xelatexemoji.sty

- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4

- run: echo "💡 The branch ${{ github.ref }} from ${{ github.repository }} has been cloned to the runner."

- name: Update apt
run: >-
sudo apt-get update -q
- name: Upgrade apt
run: >-
sudo apt-get upgrade -qy
- name: Install dependencies
run: >-
sudo apt-get install -qy
fonts-inconsolata
fonts-linuxlibertine
fonts-noto
fonts-texgyre
latexmk
lmodern
make
texlive-fonts-extra
texlive-fonts-recommended
texlive-lang-french
texlive-latex-base
texlive-latex-recommended
texlive-luatex
texlive-plain-generic
texlive-science
wget
- run: |
wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-1-amd64.deb -O pandoc.deb
sudo dpkg -i pandoc.deb
- name: Run the Makefile
run: make slides # XeTeX : I can't find the format file `xelatex.fmt'!
# 2do : https://github.com/pandoc/pandoc-action-example

run: make slides pdfs # book is not ready

- name: Add index
run: |
echo ${{ github.workspace }}
ls ${{ github.workspace }}
cp ${{ github.workspace }}/templates/index.html ${{ github.workspace }}/build
cp ${{ github.workspace }}/templates/style.css ${{ github.workspace }}/build
echo "🖥️ build dir :"
ls ${{ github.workspace }}/build
cp ./templates/index.html build/
cp ./templates/style.css build/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/master'
with:
folder: build # The folder the action should deploy.
branch: gh-pages

- run: echo "🍏 This job's status is ${{ job.status }}."
2 changes: 2 additions & 0 deletions .latexmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$pdf_mode = 4;
$lualatex = 'lualatex %O %S'
1 change: 0 additions & 1 deletion .latexmkrc

This file was deleted.

17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ SOURCEDIR = src
TEMPLATES = templates
BUILDDIR = build

PDFENGINE = lualatex
PDFENGINE_OPT = --shell-escape

SOURCES=$(wildcard $(SOURCEDIR)/*.md)
SLIDES=$(patsubst $(SOURCEDIR)/%.md,$(BUILDDIR)/%.html,$(SOURCES))
PDFS=$(patsubst $(SOURCEDIR)/%.md,$(BUILDDIR)/%.pdf,$(SOURCES))
Expand Down Expand Up @@ -34,7 +37,7 @@ $(SLIDES): $(BUILDDIR)/%.html : $(SOURCEDIR)/%.md
sed -e 's/(\(img\/\)/($(SOURCEDIR)\/\1/g' "$^" \
| sed -e "\$$a# Sources" \
| pandoc -s \
-f markdown \
-f markdown \
-t dzslides \
--embed-resources \
--standalone \
Expand All @@ -51,16 +54,18 @@ $(PDFS): $(BUILDDIR)/%.pdf : $(SOURCEDIR)/%.md
sed -e 's/(\(img\/\)/($(SOURCEDIR)\/\1/g' "$^" \
| sed -e "\$$a# Sources" \
| pandoc -s \
-f markdown \
-f markdown+emoji \
-t latex \
--pdf-engine=xelatex \
--pdf-engine=$(PDFENGINE) \
--pdf-engine-opt=$(PDFENGINE_OPT) \
--lua-filter=meta.lua \
--lua-filter=english.lua \
--citeproc \
-H $(TEMPLATES)/header.tex \
-V documentclass="scrartcl" \
-V links-as-notes=true \
-o "$@"


$(BOOKS): $(BUILDDIR)/%.tex: $(SOURCEDIR)/%.md
mkdir -p $(BUILDDIR)
Expand All @@ -69,15 +74,15 @@ $(BOOKS): $(BUILDDIR)/%.tex: $(SOURCEDIR)/%.md
| sed -e 's/<footer>.*<\/footer>//g' \
| sed -e 's/^----*//g' \
| sed -e "\$$a# Sources" \
| pandoc -f markdown \
| pandoc -f markdown+emoji \
-t latex \
--lua-filter=meta.lua \
--lua-filter=english.lua \
--filter=pandoc-citeproc \
--citeproc \
> $@

$(BUILDDIR)/book.pdf: $(TEMPLATES)/book.tex $(BOOKS)
latexmk -pdf $<
latexmk -pdflua $<
latexmk -c $<
mv book.pdf build/

Expand Down
4 changes: 0 additions & 4 deletions src/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@ lang: fr
bibliography: src/bibliographie.yaml
csl: iso690-numeric-fr.csl

mainfont: Linux Libertine O
sansfont: Linux Biolinum O
monofont: Inconsolata
monofontoptions: Scale=0.9
linkcolor: blue
---
52 changes: 39 additions & 13 deletions templates/book.tex
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
\documentclass[a4paper,12pt]{scrbook}
\KOMAoptions{twoside=false}

% Emoji
\directlua{luaotfload.add_fallback
("emojifallback",
{
"NotoColorEmoji:mode=harf;"
}
)}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\setmonofont[Scale=0.9]{Inconsolata}
\defaultfontfeatures{Scale=MatchLowercase, Mapping=tex-text, Numbers=OldStyle, Ligatures={Common,Rare,Discretionary,Historic}}
\setmainfont{Linux Libertine O}[RawFeature={fallback=emojifallback}]
\setsansfont{Linux Biolinum O}[RawFeature={fallback=emojifallback}]
\setmonofont{Inconsolata}[Scale=0.9]
\defaultfontfeatures{Scale=MatchLowercase, Mapping=tex-text, Numbers=OldStyle, Ligatures={Common,Rare,Discretionary}}

\usepackage{csquotes}
\usepackage{polyglossia}
Expand All @@ -25,8 +33,7 @@

\usepackage{longtable}
\usepackage{booktabs}


\usepackage{array}

\usepackage{hyperref}
\urlstyle{same}
Expand Down Expand Up @@ -87,7 +94,7 @@
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

\titlehead{2020-2021}
\titlehead{2023-2024}
\subject{Haute-École Arc}
\title{Développement Web}
\subtitle{Technologies d'interaction}
Expand All @@ -110,14 +117,33 @@

\input{templates/header.tex}

\begin{document}

\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newenvironment{cslreferences}%
{$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
{\par}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslentryspacingunit} % times entry-spacing
\setlength{\cslentryspacingunit}{\parskip}
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\let\oldpar\par
\def\par{\hangindent=\cslhangindent\oldpar}
\fi
% set entry spacing
\setlength{\parskip}{#2\cslentryspacingunit}
}%
{}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}

\usepackage{soul}

\begin{document}

\maketitle

Expand Down
19 changes: 13 additions & 6 deletions templates/header.tex
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
% Emoji's
\usepackage{xltxtra}
\usepackage{xelatexemoji}
% Emoji
% via https://tex.stackexchange.com/a/572220
\directlua{luaotfload.add_fallback
("emojifallback",
{
"NotoColorEmoji:mode=harf;"
}
)}

% setting the fonts here instead of metadata.yml to set the emojifallback.
\setmainfont{Linux Libertine O}[RawFeature={fallback=emojifallback}]
\setsansfont{Linux Biolinum O}[RawFeature={fallback=emojifallback}]
\setmonofont{Inconsolata}[Scale=.9]

% Headings
\usepackage{sectsty}
\allsectionsfont{\sffamily}

% customize the path
\providecommand{\xelatexemojipath}[1]{./emojione-assets/png/64/#1.png}
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ <h1>Slides Dev Web<span>HE-Arc 2023/24</span></h1>
<div class=chapter><a href='12-risques.html' class='left'>
Risques
</a><a href='12-risques.pdf' class='right'>PDF</a></div>
<!--
<div class=chapter><a href='13-rails.html' class='left'>
Rails
</a><a href='13-rails.pdf' class='right'>PDF</a></div>
<!--
<a href='book.pdf' class='book'>Livre complet</a>
-->
</nav>
Expand Down
1 change: 0 additions & 1 deletion templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ a.left{
a.right{
float:right;
clear:right;
display: none;
}

a.book{
Expand Down

0 comments on commit 0a71035

Please sign in to comment.