diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/changelog/changelog.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/changelog/changelog.sty | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/changelog/changelog.sty b/Master/texmf-dist/tex/latex/changelog/changelog.sty new file mode 100644 index 00000000000..c28b37c146c --- /dev/null +++ b/Master/texmf-dist/tex/latex/changelog/changelog.sty @@ -0,0 +1,91 @@ +\ProvidesPackage{changelog}[2018-10-26 0.2.1 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> + +\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{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\ } + } +\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}} |