Unverified Commit 6028b69d authored by Vanille-N's avatar Vanille-N
Browse files

a bunch of stuff

parent 3c1dc7b7
......@@ -2,23 +2,24 @@ TWICE = true
DOC = mail
BUILDER = texmake.py
all: $(DOC:%=%.pdf)
doc_%.tex.mk: cfg_%.tmk texmake.py
./texmake.py name=$* fail=WARNING
doc_%.tex.mk: cfg_%.tmk $(BUILDER)
./$(BUILDER) name=$* fail=WARNING
common.tex.mk: $(BUILDER)
./$(BUILDER) common
common.tex.mk: texmake.py
./texmake.py common
texwatch: $(BUILDER)
./$(BUILDER) watcher
-include $(DOC:%=doc_%.tex.mk)
-include common.tex.mk
clean:
rm -rf build
rm -f *.tex.mk
rm -f $(DOC:%=%.pdf)
force:
make clean && make
.PHONY: clean force
rm *.tex.mk
rm $(DOC:%=%.pdf)
......@@ -14,10 +14,14 @@ imap/
imap-flowchart.png
imap-flowchart-legend.png
fig:pop-interaction
raw-noproblem.png
raw-utf.png
raw-html.png
raw-image.png
smtp/
fig:ynerant-head
fig:ynerant-body
fig:ynerant-head
fig:mail-incorrect
fig:mail-correct
fig:example-mail
......
\section{Lecture directe}
\begin{frame}
\frametitle{IMAP}
\framesubtitle{Internet Message Access Protocol}
......@@ -7,27 +9,39 @@
&\text{serveur} & \xleftrightarrow{\quad\text{IMAP}\quad}\qquad & \text{client} \\
&(\ttt{imap.crans.org}) & & (\text{Evolution})
\end{align*}~\\
\end{frame}
\begin{frame}
\frametitle{Une première manière de consulter ses mails}
Mais avant \c ca...\\
Le corps du mail est stock\'e quelque part\\
Il suffit d'aller lire le fichier texte
\end{frame}
\begin{frame}
\frametitle{Lecture directe d'un mail: un mail gentil}
% un mail gentil
\frametitle{Lecture directe d'un mail: tout va bien}
\begin{center}
\includegraphics[width=8cm]{$(HERE)/raw-noproblem.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Lecture directe d'un mail: des caract\`eres sp\'eciaux \(\ddot\frown\)}
\begin{center}
\includegraphics[width=10cm]{$(HERE)/raw-utf.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Lecture directe d'un mail: du HTML \(\ddot\frown\)}
% un mail pas gentil
\frametitle{Lecture directe d'un mail: du HTML \(\ddot\frown \ddot\frown\)}
\begin{center}
\includegraphics[width=8cm]{$(HERE)/raw-html.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Lecture directe d'un mail: une pi\`ece jointe \(\ddot\frown \ddot\frown \ddot\frown\)}
% un mail avec pi\`ece jointe
\begin{center}
\includegraphics[width=5cm]{$(HERE)/raw-image.png}
\end{center}
46798 lignes...
\end{frame}
\begin{frame}
......@@ -40,6 +54,7 @@
\end{itemize}
\end{frame}
\section{IMAP}
\begin{frame}
\frametitle{IMAP}
......@@ -125,18 +140,5 @@
\end{center}
\end{frame}
\begin{frame}
\frametitle{Corps}
\begin{center}
\includegraphics[width=9cm]{$(HERE)/ynerant-body.pdf}
\end{center}
\end{frame}
\begin{frame}
\frametitle{En-t\^ete}
\begin{center}
\includegraphics[width=9cm]{$(HERE)/ynerant-head.pdf}
\end{center}
\end{frame}
......@@ -28,4 +28,6 @@
\begin{frame}
\frametitle{Plan}
\tableofcontents
Uniquement des protocoles de couche 7 (application)
\end{frame}
......@@ -21,10 +21,8 @@
\input{$(HERE)/intro/intro}
\section{Envoi}
\input{$(HERE)/smtp/smtp}
\section{R\'eception}
\input{$(HERE)/imap/imap}
......
\section{SMTP}
\begin{frame}
\frametitle{Corps}
\begin{center}
......@@ -12,8 +14,6 @@
\end{center}
\end{frame}
\begin{frame}
\frametitle{Enveloppe}
\begin{itemize}
......@@ -68,7 +68,7 @@
\end{frame}
\begin{frame}
\frametitle{\(\ddot\frown\)}
\frametitle{En fait le distributeur lit un peu le contenu... \(\ddot\frown\)}
\begin{center}
\includegraphics[width=7cm]{$(HERE)/undelivered.png}
\end{center}
......
# LaTeX Makefile
# Neven Villani <neven.villani@gmail.com>
# Jul. 2021
#
# Reusable make configuration for LaTeX compilation
# Features:
# * separate build directory
# * absolute paths relative to git root
# * real-time compilation
GITROOT = $(shell git rev-parse --show-toplevel)
TEXFLAGS = --interaction=nonstopmode --halt-on-error
TEXC = pdflatex $(TEXFLAGS)
BIBLIO = $(GITROOT)/docs/refs.bib
MAKES = Makefile $(GITROOT)/redac/tex.mk
main.pdf: \
$(FIGPDF:%=build/%.pdf) \
$(CHAPTERS:%=build/%.tex) \
$(HEADER:%=build/%.tex) \
build/main.tex \
$(BIBLIO) \
$(MAKES)
#
make compile-main
@if [ -n "$(HASBIB)" ] && [ -z "$(QUICK)" ]; then \
cp $(BIBLIO) build ; \
( cd build && bibtex main ) ; \
make compile-main ; \
fi
@if [ -n "$(TWICE)$(HASBIB)" ] && [ -z "$(QUICK)" ]; then \
make compile-main ; \
fi
cp build/main.pdf .
compile-main: build/main.tex
make FILE=main.tex compile
build/%.pdf: build/%.tex
make FILE=$(<:build/%=%) compile
compile:
cd build && $(TEXC) $(FILE) | \
grep -Ev 'texmf-dist|\.code\.tex|\.dict|^[^(]*\)' | \
sed '/^[[:space:]]*$$/d'
build/%.tex: src/%.tex |build
cp $< build
build/%.tex: figures/%.tex |build
cp $< build
build/%.tex: $(GITROOT)/redac/incl/%.tex |build
cp $< build
build:
mkdir -p build
TARGET = main.pdf
loop:
$(GITROOT)/redac/texwatch $(TARGET)
clean:
rm -rf build
reset: clean
rm -f main.pdf
force:
make reset
make main.pdf
.SUFFIXES:
.PHONY: compile-main clean reset force compile
......@@ -293,21 +293,21 @@ override MAKES_%name% = \\
$(HEADERS_%name%) \\
$(MAKES_%name%)
#
make compile-%name%
make %name%
@if [ -z \"$(QUICK)\" ]; then \\
%if% len(self.bib) > 0
cp $(BIBLIO_%name%) build && \\
( cd build && bibtex %name% ) && \\
make compile-%name%; \\
make %name%; \\
%endif%
make compile-%name%; \\
make %name%; \\
fi
cp build/%name%.pdf . &>/dev/null
compile-%name%:
%name%:
make DIR=build FILE=%name%.tex compile
.PHONY: compile-%name%
.PHONY: %name%
"""
with open(args.dest, 'w') as f:
isconditional = False
......@@ -325,7 +325,7 @@ compile-%name%:
elif "%else%" in line:
condition = not condition
continue
elif isconditional and condition:
elif isconditional and not condition:
continue
if "%iter%" in line:
_, files = line.split("%iter%", 1)
......@@ -373,24 +373,84 @@ build/%: src/%
build/%.pdf: build/%.tex
make DIR=$$(dirname $@) FILE=$$(basename $<) compile
.PHONY: compile
TARGET=all
loop:
./texwatch $(TARGET)
.PHONY: compile loop
"""
with open("common.tex.mk", 'w') as f:
f.write(common.replace(" ", "\t"))
def print_texwatch():
watch = """\
#! /bin/bash
#
# This is TeXWatch, by Neven Villani (https://github.com/Vanille-N)
# It can execute a PDFLaTeX Make target and transfer any error
# messages to notify-send
# This enables a workflow with real-time recompilation after each
# write to disk.
if [[ $# = 0 ]]; then
echo "LaTeX real-time compiler"
echo "Usage: texwatch [MAKE-TARGET]"
exit 1
fi
target="$1"
shift
logfile="/tmp/texwatch.log"
while true; do
make "$target" > "$logfile"
if grep Fatal "$logfile" &>/dev/null; then
msg=`cat "$logfile"`
msg="${msg#*!}"
msg=`printf "%q\\n" "$msg"`
notify-send "LaTeX Error" "$msg" -t 5000
sleep 4
fi
sleep 1
done
# Typical usage:
#
# Makefile
# | main: main.tex
# | pdflatex main.tex
# |
# | loop:
# | ./texwatch main
#
# $ make loop &>/dev/null
# $ xdg-open main.pdf &>/dev/null
# $ $EDITOR main.tex
"""
with open("texwatch", 'w') as f:
f.write(watch)
os.chmod("texwatch", 0o755)
def print_init():
init = """\
TWICE = true
DOC =
BUILDER = texmake.py
all: $(DOC:%=%.pdf)
doc_%.tex.mk: cfg_%.tmk ../texmake.py
../texmake.py name=$* fail=WARNING
doc_%.tex.mk: cfg_%.tmk $(BUILDER)
./$(BUILDER) name=$* fail=WARNING
common.tex.mk: $(BUILDER)
./$(BUILDER) common
common.tex.mk: ../texmake.py
../texmake.py common
texwatch: $(BUILDER)
./$(BUILDER) watcher
-include $(DOC:%=doc_%.tex.mk)
-include common.tex.mk
......@@ -446,7 +506,7 @@ class Args:
if a == "help":
print("Help unavailable at the moment")
sys.exit(255)
elif a == "common" or a == "init":
elif a == "common" or a == "init" or a == "watcher":
if self.action is not None:
Err.report(
kind="Argparse: Multiple Actions",
......@@ -487,6 +547,9 @@ def main(args):
if args.action == "common":
print_common()
return
elif args.action == "watcher":
print_texwatch()
return
elif args.action == "init":
print_init()
return
......
#! /bin/bash
#
# This is TeXWatch, by Neven Villani (https://github.com/Vanille-N)
# It can execute a PDFLaTeX Make target and transfer any error
# messages to notify-send
# This enables a workflow with real-time recompilation after each
# write to disk.
if [[ $# = 0 ]]; then
echo "LaTeX real-time compiler"
echo "Usage: texwatch [MAKE-TARGET]"
exit 1
fi
target="$1"
shift
logfile="/tmp/texwatch.log"
while true; do
make "$target" > "$logfile"
if grep Fatal "$logfile" &>/dev/null; then
msg=`cat "$logfile"`
msg="${msg#*!}"
msg=`printf "%q\n" "$msg"`
notify-send "LaTeX Error" "$msg" -t 5000
sleep 4
fi
sleep 1
done
# Typical usage:
#
# Makefile
# | main: main.tex
# | pdflatex main.tex
# |
# | loop:
# | ./texwatch main
#
# $ make loop &>/dev/null
# $ xdg-open main.pdf &>/dev/null
# $ $EDITOR main.tex
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment