diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-22 23:32:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-22 23:32:10 +0000 |
commit | 9693f6ba57c38e4078c099b5c6f3e25fbb6b58aa (patch) | |
tree | 8eea8bc801eaafbef846f17698d01159647a72dc /Master/texmf-dist/tex/latex/getfiledate | |
parent | de252d25752922eade4f5921dc772887abba81dc (diff) |
new latex package getfiledate (22jun09)
git-svn-id: svn://tug.org/texlive/trunk@13897 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/getfiledate')
-rw-r--r-- | Master/texmf-dist/tex/latex/getfiledate/getfiledate.sty | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/getfiledate/getfiledate.sty b/Master/texmf-dist/tex/latex/getfiledate/getfiledate.sty new file mode 100644 index 00000000000..6fa71ccf0d0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/getfiledate/getfiledate.sty @@ -0,0 +1,155 @@ +\ProvidesPackage{getfiledate} + [2009/03/05 v1.0 Get date of last modification of existing file] +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{comment} +\begin{comment} + This package fetches and formats the date of last modification of any existing file. It is based on an idea by Heiko Oberdiek (2009). + + This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or any later version. The latest version of this license is in http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. +\end{comment} +\RequirePackage{xkeyval} +\RequirePackage[table]{xcolor} +\RequirePackage{amssymb} +\RequirePackage{boxedminipage} +\def\gfd@err#1#2{\PackageError{getfiledate}{#1}{#2}} +\def\gfd@warn#1{\PackageWarningNoLine{getfiledate}{#1}} +\def\gfd@head{0ex} +\def\gfd@foot{0ex} +\def\gfd@prefix{The date of last modification of file} +\def\gfd@marker{$\blacktriangleright$} +\def\gfd@markercolor{blue} +\def\gfd@filenamecolor{blue} +\def\gfd@datecolor{blue} +\def\gfd@inlinespace{1em} +\def\gfd@file{getfiledate.sty} +\let\gfd@align@right\relax +\let\gfd@align@left\relax +\def\gfd@width{\hsize} +\newdimen\gfd@width\gfd@width=\hsize +\newdimen\gfd@width@tmp +\def\gfd@framesep{3pt} +\def\gfd@framerule{0.4pt} +\def\gfd@framecolor{black} +\def\gfd@separatorcolor{black} +\let\gfd@separator\textbullet +\let\T@C\textcolor +\define@boolkey[gfd]{getfiledate}[gfd@]{boxed}[true]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{prefix}[% + The date of last modification of file]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{file}{} +\define@key[gfd]{getfiledate}{width}[\hsize]{\gfd@width=#1} +\define@cmdkey[gfd]{getfiledate}[gfd@]{marker}[$\blacktriangleright$]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{markercolor}[blue]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{filenamecolor}[blue]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{datecolor}[blue]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{inlinespace}[1em]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{head}[\baselineskip]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{foot}[\baselineskip]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{framesep}[3pt]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{framerule}[0.4pt]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{separator}[\textbullet]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{framecolor}[black]{} +\define@cmdkey[gfd]{getfiledate}[gfd@]{separatorcolor}[black]{} +\define@choicekey*+[gfd]{getfiledate}{align}[\gfd@val\gfd@nr]% +{center,right,left,justified}[justified]{% + \ifcase\gfd@nr\relax + \def\gfd@align@right{\hfil} + \def\gfd@align@left{\hfil} + \or + \def\gfd@align@right{\hfill} + \let\gfd@align@left\relax + \or + \let\gfd@align@right\relax + \def\gfd@align@left{\hfill} + \or + \let\gfd@align@right\relax + \let\gfd@align@left\relax + \fi +}{% + \gfd@err{Inadmissible value '#1' for align} +} +\DeclareOptionX*{\gfd@warn{Unknown option '\CurrentOption' ignored}} +\ExecuteOptionsX[gfd]<getfiledate>{} +\ProcessOptionsX*[gfd]<getfiledate>\relax +\long\def\gfd@fifo#1\else#2\fi{\fi#1} +\ifx\ifcsname\@undefined\gfd@fifo + \def\ifdefined@gfd#1{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi + } +\else + \def\ifdefined@gfd#1{% + \ifcsname#1\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + } +\fi +\def\ifempty@gfd#1{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\@empty + \expandafter\@firstoftwo% + \else + \expandafter\@secondoftwo% + \fi +} +\ifdefined@gfd{pdffilemoddate}{}{% + \gfd@err{Missing command \string\pdffilemoddate}{% + Use pdfTeX 1.30.0 or later version} + \expandafter\endinput +} +\long\def\getfiledate#1{% + \setkeys[gfd]{getfiledate}{#1} + \par\vspace{\gfd@head}% + \begingroup + \gfd@align@right + \ifgfd@boxed + \let\gfd@marker\@empty + \def\gfd@inlinespace{\z@} + \fboxsep=\gfd@framesep + \fboxrule=\gfd@framerule + \gfd@width@tmp=\gfd@width + \advance\gfd@width@tmp by 2\fboxsep + \advance\gfd@width@tmp by 2\fboxrule + \color{\gfd@framecolor} + \begin{boxedminipage}{\gfd@width@tmp}% + \normalcolor\gfd@tempa{\gfd@file}\relax + \end{boxedminipage}% + \else + \noindent\gfd@tempa{\gfd@file}% + \fi + \gfd@align@left + \endgroup + \par\vspace{\gfd@foot}% +} +\def\gfd@tempa#1{% + \IfFileExists{#1}{% + \expandafter\expandafter\expandafter + \gfd@tempb\expandafter\@gobbletwo\pdffilemoddate{#1} + D:00000000000000\@nil{#1}% + }{\gfd@err{File '#1' does not exist or wrong path}{% + Please enter correct filename or path}} +} +\newcommand\gfd@tempb[8]{\gfd@tempc{#1#2#3#4}{#5#6}{#7#8}} +\newcommand\gfd@tempc[9]{\gfd@tempd{#1}{#2}{#3}{#4#5}{#6#7}{#8#9}} +\def\gfd@tempd#1#2#3#4#5#6#7\@nil#8{% + \parbox{\gfd@width}{% + \@killglue\noindent + \ifempty@gfd{gfd@marker}{}{\gfd@marker@a}\relax + \gfd@prefix\space\T@C{\gfd@filenamecolor}{#8}\space + was\space\T@C{\gfd@datecolor}{#1-#2-#3}\space\T@C{\gfd@separatorcolor}{% + \gfd@separator}\space\T@C{\gfd@datecolor}{#4:#5:#6}.% + } + \@killglue +} +\def\gfd@marker@a{% + \T@C{\gfd@markercolor}{\gfd@marker}% + \hskip\gfd@inlinespace plus\z@ minus\z@\relax +} + +\endinput |