summaryrefslogtreecommitdiffstats
path: root/configuration
diff options
context:
space:
mode:
authorFabrice (iLiburu) <Fabrice.Orgogozo@gmail.com>2011-04-07 07:42:52 (GMT)
committerFabrice (iLiburu) <Fabrice.Orgogozo@gmail.com>2011-04-07 07:42:52 (GMT)
commit3a2b0769e83a2bffee5fde991598f976ffd6d398 (patch)
tree2a072c42b66719456bb761db3c2e16a76f700acb /configuration
parenta616eae662598ac03683b99273b9e8a7d8ccca06 (diff)
downloadgalois-3a2b0769e83a2bffee5fde991598f976ffd6d398.zip
galois-3a2b0769e83a2bffee5fde991598f976ffd6d398.tar.gz
galois-3a2b0769e83a2bffee5fde991598f976ffd6d398.tar.bz2
[config] ajout de macros pour affichage version dans le pdf
Diffstat (limited to 'configuration')
-rwxr-xr-xconfiguration/cv26
-rw-r--r--configuration/cv-git.awk71
-rw-r--r--configuration/encoredesmacros.tex2
3 files changed, 99 insertions, 0 deletions
diff --git a/configuration/cv b/configuration/cv
new file mode 100755
index 0000000..4822aa0
--- /dev/null
+++ b/configuration/cv
@@ -0,0 +1,26 @@
+#!/bin/sh
+# This is file 'vc' from the vc bundle for TeX.
+# The original file can be found at CTAN:support/vc.
+# This file is Public Domain.
+
+# ☡ Si l'on fait un git checkout versionprécédente c'est la
+# dernière version (date et empreinte) qui s'affiche
+
+# Parse command line options.
+full=0
+mod=0
+while [ -n "$(echo $1 | grep '-')" ]; do
+ case $1 in
+ -f ) full=1 ;;
+ -m ) mod=1 ;;
+ * ) echo 'usage: cv [-f] [-m]'
+ exit 1
+ esac
+ shift
+done
+export TZ=GMT
+git --no-pager log -1 HEAD --pretty=format:"Hash: %H%nAbr. Hash: %h%nParent Hashes: %P%nAbr. Parent Hashes: %p%nAuthor Name: %an%nAuthor Email: %ae%nAuthor Date: %at%nCommitter Name: %cn%nCommitter Email: %ce%nCommitter Date: %ct%n" |gawk -v script=log -v full=$full -f ~/config/texmf/cv-git.awk > .cv.tex
+if [ "$mod" = 1 ]
+then
+ git status |gawk -v script=status -f ~/config/texmf/cv-git.awk >> .cv.tex
+fi
diff --git a/configuration/cv-git.awk b/configuration/cv-git.awk
new file mode 100644
index 0000000..55b2492
--- /dev/null
+++ b/configuration/cv-git.awk
@@ -0,0 +1,71 @@
+# This is file 'vc-git.awk' from the vc bundle for TeX.
+# The original file can be found at CTAN:support/vc.
+# This file is Public Domain.
+BEGIN {
+
+### Process output of "git status".
+ if (script=="status") {
+ modified = 0
+ }
+}
+### Process output of "git log".
+script=="log" && /^Hash:/ { Hash = substr($0, 2+match($0, ":")) }
+script=="log" && /^Abr. Hash:/ { AbrHash = substr($0, 2+match($0, ":")) }
+script=="log" && /^Parent Hashes:/ { ParentHashes = substr($0, 2+match($0, ":")) }
+script=="log" && /^Abr. Parent Hashes:/ { AbrParentHashes = substr($0, 2+match($0, ":")) }
+script=="log" && /^Author Name:/ { AuthorName = substr($0, 2+match($0, ":")) }
+script=="log" && /^Author Email:/ { AuthorEmail = substr($0, 2+match($0, ":")) }
+script=="log" && /^Author Date:/ { AuthorDate = substr($0, 2+match($0, ":")) }
+script=="log" && /^Committer Name:/ { CommitterName = substr($0, 2+match($0, ":")) }
+script=="log" && /^Committer Email:/ { CommitterEmail = substr($0, 2+match($0, ":")) }
+script=="log" && /^Committer Date:/ { CommitterDate = substr($0, 2+match($0, ":")) }
+### Process output of "git status".
+### Changed index?
+script=="status" && /^# Changes to be committed:/ { modified = 1 }
+### Unstaged modifications?
+script=="status" && /^# Changed but not updated:/ { modified = 2 }
+END {
+
+### Process output of "git log".
+ if (script=="log") {
+### Standard encoding is UTF-8.
+ if (Encoding == "") Encoding = "UTF-8"
+### Extract relevant information from variables.
+ Date = strftime("%Y-%-m-%-d",CommitterDate)
+ Heures = strftime("%-H",CommitterDate)
+ Minutes = strftime("%-M",CommitterDate)
+### Write Git specific macros.
+ print "\\gdef\\GITHash{" Hash "}%"
+ print "\\gdef\\GITAbrHash{" AbrHash "}%"
+ print "\\gdef\\GITParentHashes{" ParentHashes "}%"
+ print "\\gdef\\GITAbrParentHashes{" AbrParentHashes "}%"
+ print "\\gdef\\GITAuthorName{" AuthorName "}%"
+ print "\\gdef\\GITAuthorEmail{" AuthorEmail "}%"
+ print "\\gdef\\GITAuthorDate{" AuthorDate "}%"
+ print "\\gdef\\GITCommitterName{" CommitterName "}%"
+ print "\\gdef\\GITCommitterEmail{" CommitterEmail "}%"
+ print "\\gdef\\GITCommitterDate{" CommitterDate "}%"
+### Write generic version control macros.
+ print "%%% Define generic version control macros."
+ print "\\gdef\\VCRevision{\\GITAbrHash}%"
+ print "\\gdef\\VCAuthor{\\GITAuthorName}%"
+ print "\\gdef\\VCDate{" Date "}%"
+ print "\\gdef\\VCHM{"Heures"h" Minutes"}%"
+ print "\\gdef\\VCModifiedText{\\textcolor{red}{☡ avec modifications locales !}}%"
+ print "%%% Assume clean working copy."
+ print "\\gdef\\VCModified{0}%"
+ print "\\gdef\\VCRevisionMod{\\VCRevision}%"
+ }
+
+### Process output of "git status".
+ if (script=="status") {
+ print "%%% Is working copy modified?"
+ print "\\gdef\\VCModified{" modified "}%"
+ if (modified==0) {
+ print "\\gdef\\VCRevisionMod{\\VCRevision}%"
+ } else {
+ print "\\gdef\\VCRevisionMod{\\VCRevision~\\VCModifiedText}%"
+ }
+ }
+
+}
diff --git a/configuration/encoredesmacros.tex b/configuration/encoredesmacros.tex
index 5a8b432..a8c380c 100644
--- a/configuration/encoredesmacros.tex
+++ b/configuration/encoredesmacros.tex
@@ -10,3 +10,5 @@
% virage dangeureux
\font\manual=manfnt
\def\dbend{{\manual\char127}}
+
+\newcommand{\version}{\begin{center}\small{version du \VCDate\ à \VCHM\,\textsc{tu}}\, {\tiny (\texttt{\VCRevision})\\ \ifx\VCModified=0 \VCModifiedText \fi}\end{center}}