blob: 79830d82a7e65fb986b2f1471bfea07750c16678 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
\ProvidesPackage{changelog}[2018-11-06 0.3.0 Typesetting changelogs]
% Description: Provides the changelog environment for typesetting changelogs
% License: GPL-3.0
% Homepage: https://github.com/9999years/latex-changelog
% https://ctan.org/pkg/changelog
% Maintainer: Rebecca Turner <637275@gmail.com>
\RequirePackage{xparse}
\RequirePackage{xkeyval}
\RequirePackage{kvoptions}
\newif\ifchangelog@color\changelog@colorfalse
\DeclareOption{color}{\changelog@colortrue}
\ProcessOptions
\ifchangelog@color
\RequirePackage{xcolor}
\colorlet{ChangelogAdded} {green}
\colorlet{ChangelogChanged} {blue}
\colorlet{ChangelogDeprecated}{orange}
\colorlet{ChangelogRemoved} {red}
\colorlet{ChangelogFixed} {cyan}
\colorlet{ChangelogSecurity} {magenta}
\newcommand{\@addversionshorthands}{
\newcommand{\added }{\item{\textcolor{ChangelogAdded} {\textbf{Added}} }}
\newcommand{\changed }{\item{\textcolor{ChangelogChanged} {\textbf{Changed}} }}
\newcommand{\deprecated}{\item{\textcolor{ChangelogDeprecated}{\textbf{Deprecated}} }}
\newcommand{\removed }{\item{\textcolor{ChangelogRemoved} {\textbf{Removed}} }}
\newcommand{\fixed }{\item{\textcolor{ChangelogFixed} {\textbf{Fixed}} }}
\newcommand{\security }{\item{\textcolor{ChangelogSecurity} {\textbf{Security}} }}
}
\newcommand{\changelogyanked}{{\color{ChangelogSecurity}\fbox{\textbf{YANKED}}}}
\else
\newcommand{\@addversionshorthands}{
\newcommand{\added} {\item Added\ }
\newcommand{\changed} {\item Changed\ }
\newcommand{\deprecated}{\item Deprecated\ }
\newcommand{\removed} {\item Removed\ }
\newcommand{\fixed} {\item Fixed\ }
\newcommand{\security} {\item Security\ }
}
\newcommand{\changelogyanked}{\fbox{\textbf{YANKED}}}
\fi
\define@cmdkeys{version}{author, version, date, changes}
\define@key{version}{v}{\def\cmdKV@version@version{#1}}
\define@boolkey{version}{yanked}[true]{}
\define@cmdkeys{changelog}{sectioncmd, title, label}
\define@boolkey{changelog}{section}[true]{}
\presetkeys{changelog}{sectioncmd=\section, title=Changelog,
label=sec:changelog, section}{}
\NewDocumentEnvironment{changelog}{o}
{\IfValueT{#1}{\setkeys{changelog, version}{#1}}%
\ifKV@changelog@section
\expandafter\cmdKV@changelog@sectioncmd{\cmdKV@changelog@title}%
\expandafter\label{\cmdKV@changelog@label}
\fi
%\today
% version environment; wraps a list
\NewDocumentEnvironment{version}{ O{} }
{\shortversion{##1}%
\begin{itemize}
\@addversionshorthands
}
{\end{itemize}}%
% short version; "like" a 1-bullet list
\NewDocumentCommand{\shortversion}{m}{{%
\setkeys{version}{##1}%
\@ifundefined{cmdKV@version@version}{
\@ifundefined{cmdKV@version@date}{
\newcommand{\cmdKV@version@version}{Unreleased}
\let\cmdKV@version@date\today
}{%
\let\cmdKV@version@version\cmdKV@version@date
\let\cmdKV@version@date\undefined
}%
}{}%
\item[\cmdKV@version@version
\ifKV@version@yanked\ \changelogyanked\fi]
\@ifundefined{cmdKV@version@author}{}{\cmdKV@version@author}
\@ifundefined{cmdKV@version@date}{%
% if both undefined, add a linebreak
\@ifundefined{cmdKV@version@author}{\hspace{0pt}}{}%
}{(\cmdKV@version@date)}%
\@ifundefined{cmdKV@version@changes}{}{ --- \cmdKV@version@changes}
}}
\begin{description}}
{\end{description}}
|