%%
%% This is file `gfdl.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gfdl.dtx  (with options: `package')
%% ----------------------------------------------------------
%% Package:      gfdl
%% Version:      v0.1 (January 1, 2023)
%% Author:       निरंजन
%% Description:  Enhanced support for linguistics.
%% Repository:   https://puszcza.gnu.org.ua/projects/gfdl
%% License:      GPLv3+, GFDLv1.3+
%% ----------------------------------------------------------
%% 
%% The LaTeX package gfdl v0.1
%% Copyright © 2022, 2023 निरंजन
%% 
%% This program is free software: you can redistribute it
%% and/or modify it under the terms of the GNU General Public
%% License as published by the Free Software Foundation, either
%% version 3 of the License, or (at your option) any later
%% version.
%% 
%% This program is distributed in the hope that it will be
%% useful, but WITHOUT ANY WARRANTY; without even the implied
%% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
%% PURPOSE. See the GNU General Public License for more
%% details.
%% 
%% You should have received a copy of the GNU General Public
%% License along with this program. If not, see
%% <https://www.gnu.org/licenses/>.
%% ----------------------------------------------------------
\ProvidesPackage{gfdl}[2023/01/01 v0.1
For using the GFDL in LaTeX.]
\RequirePackage{float}
\RequirePackage{expkv-def,expkv-opt}
\newif\ifgfdl@copyrightholdersgiven
\gfdl@copyrightholdersgivenfalse
\newif\ifgfdl@copyrightableyearsgiven
\gfdl@copyrightableyearsgivenfalse
\newif\ifgfdl@copyrightedmaterialdesc
\gfdl@copyrightedmaterialdescfalse
\newif\ifgfdl@licensetextnotprinted
\gfdl@licensetextnotprintedtrue
\newif\ifgfdl@noticenotprinted
\gfdl@noticenotprintedtrue
\ekvdefinekeys{gfdl}{
  invbool     manual     = {\ifgfdl@printgfdl},
  bool        (C)        = {\ifgfdl@bracketedcopyright},
  choice      version    = {%
    1.1                  = {\def\gfdl@version{1p1}},%
    1.2                  = {\def\gfdl@version{1p2}},%
    1.3                  = {\def\gfdl@version{1p3}}%
  },
  initial     version    = {1.3}
}
\ekvoProcessLocalOptions{gfdl}
\ifgfdl@bracketedcopyright
  \def\gfdl@copyrightsymbol{(C)}%
\else
  \let\gfdl@copyrightsymbol\textcopyright
\fi
\NewDocumentCommand{ \gfdlcopyrightdescription }{ m }{%
  \def\@copyrightedmaterialdesc{#1}%
  \gfdl@copyrightedmaterialdesctrue
}
\NewDocumentCommand{ \gfdlcopyrightableyears }{ m }{%
  \def\@copyrightableyears{#1}%
  \gfdl@copyrightableyearsgiventrue
}
\NewDocumentCommand{ \gfdlcopyrightholders }{ m }{%
  \def\@copyrightholders{#1}%
  \gfdl@copyrightholdersgiventrue
}
\AddToHook{begindocument/before}{%
  \ifgfdl@copyrightableyearsgiven
  \else
    \def\@copyrightableyears{\textbf{??}}%
    \PackageWarningNoLine{gfdl}{%
      Copyright-able years not given. I can't print the
      \MessageBreak
      copyright notice without them. To give me this
      \MessageBreak
      information use the \string\gfdlcopyrightableyears\space
      command.\MessageBreak Using `??' as a placeholder%
    }%
  \fi
  \ifgfdl@copyrightholdersgiven
  \else
    \def\@copyrightholders{\textbf{??}}%
    \PackageWarningNoLine{gfdl}{%
      Copyright-holders not given. I can't print the
      \MessageBreak
      copyright notice without them. To give me this
      \MessageBreak
      information use the \string\gfdlcopyrightholders\space
      command.\MessageBreak Using `??' as a placeholder%
    }%
  \fi
  \@ifpackageloaded{csquotes}{}{%
    \RequirePackage{csquotes}%
  }%
  \@ifpackageloaded{hyperref}{}{%
    \RequirePackage{hyperref}%
  }%
  \@ifpackageloaded{hyperxmp}{}{%
    \RequirePackage{hyperxmp}%
  }%
  \hypersetup{%
    pdfcopyright  = {%
      \ifgfdl@copyrightedmaterialdesc
        \@copyrightedmaterialdesc
        \textLF
      \fi
      Copyright
      \gfdl@copyrightsymbol\
      \@copyrightableyears\
      \@copyrightholders\textLF
      Permission is granted to copy, distribute and/or
      modify this document under the terms of the GNU Free
      Documentation License, Version 1.3 or any later
      version published by the Free Software Foundation;
      with no Invariant Sections, no Front-Cover Texts, and
      no Back-Cover Texts. A copy of the license is included
      in the section entitled “GNU Free Documentation
      License”.%
    },%
    pdflicenseurl = {%
      https://www.gnu.org/licenses/fdl-1.3.txt%
    }%
  }%
}
\newfloat{gfdl@float}{b}{delme}
\NewDocumentCommand{ \printgfdlnotice }{  }{%
  \begin{gfdl@float}[b!]
    \hrule\medskip
    \ifgfdl@copyrightedmaterialdesc
      \@copyrightedmaterialdesc\par
    \fi
    Copyright
    \gfdl@copyrightsymbol\
    \@copyrightableyears\
    \@copyrightholders

    Permission is granted to copy, distribute and/or modify
    this document under the terms of the GNU Free
    Documentation License, Version 1.3 or any later version
    published by the Free Software Foundation; with no
    Invariant Sections, no Front-Cover Texts, and no
    Back-Cover Texts. A copy of the license is included in
    the section entitled \enquote{%
      GNU Free Documentation License%
    }.%
  \end{gfdl@float}%
  \gfdl@noticenotprintedfalse
}
\AddToHook{begindocument/end}{%
  \ifgfdl@printgfdl
    \printgfdlnotice
  \fi
}
\NewDocumentCommand{ \printgfdltext }{  }{%
  \input{gfdl-tex-\gfdl@version.tex}%
  \gfdl@licensetextnotprintedfalse
}
\AddToHook{enddocument}{%
  \ifgfdl@printgfdl
    \newpage
    \phantomsection
    \addcontentsline{toc}{section}{%
      GNU Free Documentation License%
    }%
    \printgfdltext
  \fi
  \ifgfdl@noticenotprinted
    \PackageError{gfdl}{%
      You didn't print the copyright notice%
    }{%
      You are in the `manual' mode of the GFDL package and
      hence you\MessageBreak are supposed to print the
      copyright notice at a suitable place\MessageBreak of
      your choice, but you haven't printed it at all. This
      violates\MessageBreak the requirement of the GFDL. To
      print it use:\MessageBreak
      \space\space\string\printgfdlnotice.%
    }%
  \fi
  \ifgfdl@licensetextnotprinted
    \PackageError{gfdl}{%
      You didn't print the license text%
    }%
    {%
      You are in the `manual' mode of the GFDL package and hence you%
      \MessageBreak
      are supposed to print the full license text at a suitable place%
      \MessageBreak
      of your choice, but you haven't printed it at all. This violates%
      \MessageBreak
      the requirement of the GFDL. To print it use:%
      \MessageBreak
      \space\space\string\printgfdltext.%
    }%
  \fi
}
\endinput
%%
%% End of file `gfdl.sty'.
