From 3d10e4db332aa2b5b393b71cc1ec778aacd41046 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 19 Jul 2013 22:23:54 +0000
Subject: skdoc (19jul13)

git-svn-id: svn://tug.org/texlive/trunk@31242 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/skdoc/skdoc.dtx | 84 ++++++++++++++++++--------
 1 file changed, 59 insertions(+), 25 deletions(-)

(limited to 'Master/texmf-dist/source/latex/skdoc/skdoc.dtx')

diff --git a/Master/texmf-dist/source/latex/skdoc/skdoc.dtx b/Master/texmf-dist/source/latex/skdoc/skdoc.dtx
index afd57482a03..08dd5dd0416 100644
--- a/Master/texmf-dist/source/latex/skdoc/skdoc.dtx
+++ b/Master/texmf-dist/source/latex/skdoc/skdoc.dtx
@@ -73,7 +73,7 @@
 %</driver>
 %<class>\ProvidesExplClass{skdoc}
 %<*class>
-    {2013/05/24}{1.3a}{skdoc documentation class}
+    {2013/05/24}{1.3b}{skdoc documentation class}
 %</class>
 %
 %<*driver>
@@ -132,13 +132,14 @@
 % {}{\small\pagemark}
 % \pagestyle{skdoc-class}
 %
-% \version{1.3a}
+% \version{1.3b}
 % \changes{1.0}{Initial version}
 % \changes{1.1}{Added support for syntax highlighting using \pkg{minted}}
 % \changes{1.1a}{Deprecate the use of \pkg{bibtex} in favour of \pkg{biblatex}}
 % \changes{1.2}{Use \pkg{l3prg} booleans instead of toggles}
 % \changes{1.2b}{Use \pkg{inconsolata}. Don't use \pkg{ascii}}
 % \changes{1.3}{Allow multiple targets per \env{MacroCode}}
+% \changes{1.3b}{Use \pkg{sourcecodepro} instead of \pkg{inconsolata}. Fix issue with index entries of different types with same name}
 %
 % \package[ctan=skdoc,vcs=https://github.com/urdh/skdoc]{skdoc}
 % \repository{https://github.com/urdh/skdoc}
@@ -756,7 +757,7 @@
 % These packages are basic low-level things that we use to declare
 % commands, work with strings and so on.
 %    \begin{macrocode}
-\RequirePackage{etoolbox,xstring,xparse,atbegshi,kvoptions,pdftexcmds}
+\RequirePackage{etoolbox,xstring,xparse,atbegshi,kvoptions,pdftexcmds,everyhook}
 %    \end{macrocode}
 % Now, higher-level packages we use in our definitions.
 %    \begin{macrocode}
@@ -774,7 +775,7 @@
 \RequirePackage[english=british]{csquotes}
 \RequirePackage[font=small,labelfont=bf,textfont=it]{caption}
 \RequirePackage{scrpage2,PTSerif}
-\usepackage[scaled=1.03]{inconsolata}
+\usepackage{sourcecodepro}
 \RequirePackage[defaultsans,osfigures,scale=0.95]{opensans}
 \RequirePackage[babel]{microtype}
 %    \end{macrocode}
@@ -839,6 +840,15 @@
 \bool_gset_false:N\g__skdoc_in_implementation_bool
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\g__skdoc_negative_space_bool}
+% This boolean keeps track of the negative spacing added by description
+% environments, allowing \env{MacroCode} to offset it if it follows the
+% start of these environments directly. Bit of a hack, really.
+%    \begin{macrocode}
+\bool_new:N\g__skdoc_negative_space_bool
+\bool_gset_false:N\g__skdoc_negative_space_bool
+%    \end{macrocode}
+% \end{macro}
 %
 % Finally, we define a helpful conditional based on the last two
 % booleans. It decides wether code in \cs{skdoc@verbatim} is typeset
@@ -1434,9 +1444,11 @@
 % \begin{environment}{MacroCode}[1]
 %   {The key of the file being described}
 % \changes{1.1}{Minor changes due to syntax highlighting}
+% \changes{1.3b}{Offset negative spacing from the description environments}
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{MacroCode}{m}{
     \__skdoc_if_print_code:T{
+        \bool_if:NT\g__skdoc_negative_space_bool{\vspace{\baselineskip}}
         \vspace{.2\baselineskip}
         \bool_if:NF\g__skdoc_use_minted_bool{\par\noindent}
     }
@@ -2002,7 +2014,7 @@
 %            \cs{macro@impl@args} will read}
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{macro}{smo}{%
-    \@bsphack
+    \IfBooleanTF{#1}{}{\@bsphack}
     \index@macro!{\expandafter\@gobble\string#2}
     \@macroname{#2}%
     \IfBooleanTF{#1}{
@@ -2030,7 +2042,7 @@
 %            \cs{macro@impl@args} will read}
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{environment}{smo}{%
-    \@bsphack
+    \IfBooleanTF{#1}{}{\@bsphack}
     \index@environment!{#2}
     \@environmentname{#2}%
     \IfBooleanTF{#1}{
@@ -2057,7 +2069,7 @@
 %   {Values this key-value option can take}
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{option}{smg}{%
-    \@bsphack
+    \IfBooleanTF{#1}{}{\@bsphack}
     \index@option!{#2}
     \@optionname{#2}%
     \IfBooleanTF{#1}{}{
@@ -2081,7 +2093,7 @@
 %   {Name of the \hologo{BibTeX} entry type being implemented}
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{bibentry}{sm}{%
-    \@bsphack
+    \IfBooleanTF{#1}{}{\@bsphack}
     \index@bibentry!{\expandafter\@gobble\string#2}
     \@bibentryname{#2}%
     \IfBooleanTF{#1}{}{
@@ -2099,7 +2111,7 @@
 %   {Name of the theme being implemented}
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{theme}{sm}{%
-    \@bsphack
+    \IfBooleanTF{#1}{}{\@bsphack}
     \index@theme!{#2}
     \@themename{#2}%
     \IfBooleanTF{#1}{}{
@@ -2220,14 +2232,26 @@
 %    \end{macrocode}
 % \end{macro*}
 % \begin{macro*}{\macro@impl@endargs}
+% \changes{1.3b}{Conditionally don't add space if another environment follows}
 %    \begin{macrocode}
 \def\macro@impl@endargs{
-    \endgroup\par
+    \endgroup
+    \peek_meaning_ignore_spaces:NTF\begin
+        {
+            \vspace{-\baselineskip}
+            \bool_gset_true:N\g__skdoc_negative_space_bool
+            \PushPreHook{par}{
+                \bool_gset_false:N\g__skdoc_negative_space_bool
+                \PopPreHook{par}
+            }
+        }
+        {\par\medskip}%
 }
 %    \end{macrocode}
 % \end{macro*}
 % \begin{macro*}{\macro@impl@argline@noarg}[1]
 %   {The line to print instead of an argument line}
+% \changes{1.3b}{Conditionally don't add space if another environment follows}
 % This last macro is a replacement used when there are no arguments
 % or if the implementation is an option or something like that. It
 % behaves pretty much like \cs{macro@impl@args}, but with only one
@@ -2235,7 +2259,17 @@
 %    \begin{macrocode}
 \def\macro@impl@argline@noarg#1{%
     \vspace*{-\baselineskip}
-    \par\noindent{#1\strut}\par\medskip%
+    \par\noindent{#1\strut}
+    \peek_meaning_ignore_spaces:NTF\begin
+        {
+            \vspace{-\baselineskip}
+            \bool_gset_true:N\g__skdoc_negative_space_bool
+            \PushPreHook{par}{
+                \bool_gset_false:N\g__skdoc_negative_space_bool
+                \PopPreHook{par}
+            }
+        }
+        {\par\medskip}%
 }
 %    \end{macrocode}
 % \end{macro*}
@@ -2319,9 +2353,9 @@
 %   {The name of the macro being indexed, without backslash}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@macro{st!m}{
-    \def\skdoc@temp{#3}
+    \def\skdoc@temp{#3-macro}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{#3}{\cs*{#3}}
+        \@index@{#3-macro}{\cs*{#3}}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
@@ -2343,9 +2377,9 @@
 %   {The name of the environment being indexed}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@environment{st!m}{
-    \def\skdoc@temp{\string#3}
+    \def\skdoc@temp{\string#3-env}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{\string#3}{\env*{\string#3}~(environment)}
+        \@index@{\string#3-env}{\env*{\string#3}~(environment)}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
@@ -2367,9 +2401,9 @@
 %   {The name of the option being indexed}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@option{st!m}{
-    \def\skdoc@temp{\string#3}
+    \def\skdoc@temp{\string#3-opt}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{\string#3}{\opt*{\string#3}~(option)}
+        \@index@{\string#3-opt}{\opt*{\string#3}~(option)}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
@@ -2392,9 +2426,9 @@
 %       being indexed, without initial \texttt{@} sign}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@bibentry{st!m}{
-    \def\skdoc@temp{#3}
+    \def\skdoc@temp{#3-bib}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{#3}{\bib*{#3}~(\hologoRobust{BibTeX}~entry~type)}
+        \@index@{#3-bib}{\bib*{#3}~(\hologoRobust{BibTeX}~entry~type)}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
@@ -2416,9 +2450,9 @@
 %   {The name of the theme being indexed}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@theme{st!m}{
-    \def\skdoc@temp{\string#3}
+    \def\skdoc@temp{\string#3-theme}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{\string#3}{\thm*{\string#3}~(theme)}
+        \@index@{\string#3-theme}{\thm*{\string#3}~(theme)}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
@@ -2440,9 +2474,9 @@
 %   {The name of the package being indexed}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@package{st!m}{
-    \def\skdoc@temp{\string#3}
+    \def\skdoc@temp{\string#3-pkg}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{\string#3}{\pkg*{\string#3}~(package)}
+        \@index@{\string#3-pkg}{\pkg*{\string#3}~(package)}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
@@ -2464,9 +2498,9 @@
 %   {The name of the file being indexed}
 %    \begin{macrocode}
 \DeclareDocumentCommand\index@file{st!m}{
-    \def\skdoc@temp{\string#3}
+    \def\skdoc@temp{\string#3-file}
     \ifglsentryexists{index-\skdoc@temp}{}{
-        \@index@{\string#3}{\file*{\string#3}~(file)}
+        \@index@{\string#3-file}{\file*{\string#3}~(file)}
     }
     \__skdoc_if_do_index:T{
         \IfBooleanTF{#2}{
-- 
cgit v1.2.3

