SF.net SVN: docutils:[9783 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9783
          http://sourceforge.net/p/docutils/code/9783
Author:   milde
Date:     2024-07-29 12:37:21 +0000 (Mon, 29 Jul 2024)
Log Message:
-----------
LaTeX writer: simplify handling of the "reference_label" customization setting.

Don't wrap references with custom reference-label_ in a `\hyperref` command.
because the "hyperref" LaTeX package creates a hyperlink by default.

Modified Paths:
--------------
    trunk/docutils/HISTORY.txt
    trunk/docutils/RELEASE-NOTES.txt
    trunk/docutils/docutils/writers/latex2e/__init__.py

Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt	2024-07-29 12:37:02 UTC (rev 9782)
+++ trunk/docutils/HISTORY.txt	2024-07-29 12:37:21 UTC (rev 9783)
@@ -64,7 +64,7 @@
 
   - New parser for Docutils XML sources. Provisional.
 
-* docutils/parsers/rst/languages/*.py
+* docutils/parsers/rst/languages/
 
   - Removed mistranslations of the "admonition" directive name.
 
@@ -144,7 +144,11 @@
 
   - Remove optional argument `pxunit` of `LaTeXTranslator.to_latex_length()`
     (ignored since at least 2012).
+  - Don't wrap references with custom reference-label_ in
+    a ``\hyperref`` command.
 
+  .. _reference-label: docs/user/config.html#reference-label
+
 * docutils/writers/manpage.py
 
   - Remove code for unused emdash bullets.
@@ -931,7 +935,7 @@
   - Open ``docutils.sty`` with encoding set to "utf-8".
     Fixes bug #414: error with Py3k when locale encoding is "ascii".
 
-* docutils/parsers/*.py, docutils/transforms/*.py
+* docutils/parsers/ docutils/transforms/
 
   - Provide fallbacks for parser config settings
     to facilitate programmatic use.

Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt	2024-07-29 12:37:02 UTC (rev 9782)
+++ trunk/docutils/RELEASE-NOTES.txt	2024-07-29 12:37:21 UTC (rev 9783)
@@ -77,8 +77,9 @@
 
 * "html5" writer:
 
-  - Move attribution behind the blockquote to comply with the `"living
-    standard"`__. (HTML5__ allows <cite> elements inside a blockquote.)
+  - Move attribution behind the blockquote to comply with the
+    `"HTML living standard"`__.  (The now retired HTML5__ W3C recommendation
+    allows <cite> elements inside a blockquote.)
 
     __ https://html.spec.whatwg.org/#the-blockquote-element
     __ https://www.w3.org/TR/2014/REC-html5-20141028/grouping-content.html
@@ -115,12 +116,6 @@
   - Remove ``use_verbatim_when_possible`` setting
     (use literal_block_env_: verbatim) in Docutils 2.0.
 
-  - Don't wrap references with custom reference-label_ in
-    a ``\hyperref`` command in Docutils 0.22.
-    Specify, e.g., "ref" instead of "ref*" to keep generating hyperlinks.
-
-    .. _reference-label: docs/user/config.html#reference-label
-
 Misc
 ----
 
@@ -216,6 +211,13 @@
      `publish_string()` now returns a `bytes` or `str` instance
      for all writers (as documented).
 
+  "latex" writer:
+     Don't wrap references with custom reference-label_ in a ``\hyperref``
+     command. The "hyperref" package generates hyperlinks for labels by
+     default, so there is no change in the PDF (except for "ref*").
+
+     .. _reference-label: docs/user/config.html#reference-label
+
 New objects
   `parsers.docutils_xml`
      parser for `Docutils XML`_ (e.g., the output of the "xml" writer).

Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py	2024-07-29 12:37:02 UTC (rev 9782)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py	2024-07-29 12:37:21 UTC (rev 9783)
@@ -2838,12 +2838,11 @@
             raise AssertionError('Unknown reference.')
         if not self.is_inline(node):
             self.out.append('\n')
-        self.out.append('\\hyperref[%s]{' % href)
         if self.reference_label:
-            # TODO: don't use \hyperref if self.reference_label is True
-            self.out.append('\\%s{%s}}' %
+            self.out.append('\\%s{%s}' %
                             (self.reference_label, href.replace('#', '')))
             raise nodes.SkipNode
+        self.out.append('\\hyperref[%s]{' % href)
 
     def depart_reference(self, node):
         self.out.append('}')

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
Docutils-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.