[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh445: do not create backrefs if they don't exist (fixes part of #445) (472543a8)

Frank Mittelbach frank.mittelbach at latex-project.org
Thu Dec 3 00:02:04 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh445
Link       : https://github.com/latex3/latex2e/commit/472543a87087d7b694a7e2da1e2745d91e7fcdfe

>---------------------------------------------------------------

commit 472543a87087d7b694a7e2da1e2745d91e7fcdfe
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Thu Dec 3 00:02:04 2020 +0100

    do not create backrefs if they don't exist (fixes part of #445)


>---------------------------------------------------------------

472543a87087d7b694a7e2da1e2745d91e7fcdfe
 base/source2edoc.cls | 39 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/base/source2edoc.cls b/base/source2edoc.cls
index 5b670003..e0610823 100644
--- a/base/source2edoc.cls
+++ b/base/source2edoc.cls
@@ -2,7 +2,7 @@
 % This class is buggy and needs fixing
 
 \ProvidesClass{source2edoc}
-              [2020/08/16 v0.1 Quick hack to typeset source2.tex
+              [2020/12/02 v0.2 Quick hack to typeset source2.tex
                (not usable for anything else and buggy -- will vanish again)!]
 
 \LoadClass{l3doc}
@@ -14,8 +14,43 @@
 
 
 
-% l3doc's def are buggy (already fixed there but not distributed yet)
+
 \ExplSyntaxOn
+
+% in 2e we have a lot of functions that have no ``user-level'' documentation so we disable
+% a bogus backref in that case. Over time the sources should be clean up to have such documentation.
+
+\cs_set_protected:Npn \__codedoc_print_documented:
+  {
+    \seq_gset_filter:NNn \g__codedoc_nested_names_seq
+      \g__codedoc_nested_names_seq
+      { ! \__codedoc_if_macro_internal_p:n {##1} }
+    \seq_if_empty:NF \g__codedoc_nested_names_seq
+      {
+% This is a crude change: we grab the first name
+        \__codedoc_get_hyper_target:xN
+          { \seq_item:Nn \g__codedoc_nested_names_seq { 1 } }
+          \l__codedoc_tmpa_tl
+% ... and check if it has a reference
+        \cs_if_exist:cT{ r@\l__codedoc_tmpa_tl }
+% If it does we show it, if not we don't.
+         {
+           \int_set:Nn \l__codedoc_tmpa_int
+             { \seq_count:N \g__codedoc_nested_names_seq }
+           \int_compare:nNnTF \l__codedoc_tmpa_int = 1 {~This~} {~These~}
+           \bool_if:NTF \l__codedoc_macro_var_bool {variable} {function}
+           \int_compare:nNnTF \l__codedoc_tmpa_int = 1 {~is~} {s~are~}
+           documented~on~page~
+           \exp_args:Nx \pageref { \l__codedoc_tmpa_tl } .
+         }
+      }
+    \seq_gclear:N \g__codedoc_nested_names_seq
+  }
+
+
+  
+% some l3doc's def are buggy (already fixed there but not distributed yet)
+
 \RenewDocumentCommand \DocInclude { m }
   {
     \relax\clearpage





More information about the latex3-commits mailing list.