|
From: <mi...@us...> - 2023-05-24 22:59:40
|
Revision: 9395
http://sourceforge.net/p/docutils/code/9395
Author: milde
Date: 2023-05-24 22:59:36 +0000 (Wed, 24 May 2023)
Log Message:
-----------
Review "reference-label" LaTeX writer setting. Update docs.
Modified Paths:
--------------
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/user/config.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2023-05-24 22:59:28 UTC (rev 9394)
+++ trunk/docutils/RELEASE-NOTES.txt 2023-05-24 22:59:36 UTC (rev 9395)
@@ -143,6 +143,12 @@
- 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.
+
+ .. _reference-label: docs/user/config.html#reference-label
+
+
* "null" writer: output will change to the empty string in Docutils 0.22.
Misc
Modified: trunk/docutils/docs/user/config.txt
===================================================================
--- trunk/docutils/docs/user/config.txt 2023-05-24 22:59:28 UTC (rev 9394)
+++ trunk/docutils/docs/user/config.txt 2023-05-24 22:59:36 UTC (rev 9395)
@@ -1100,7 +1100,7 @@
MathML is part of the HTML5 standard [#mathml-in-html4]_ and
`supported by all major browsers`__ (since January 2023 also by Chrome).
- .. [#mathml-in-html4]
+ .. [#mathml-in-html4]
With the "html4css1" writer, the resulting HTML document does
not validate, as there is no DTD for `MathML + XHTML Transitional`.
However, MathML-enabled browsers will render it fine.
@@ -1183,7 +1183,7 @@
Default: HTML math.css. Option: ``--math-output``.
-| New in Docutils 0.8.
+| New in Docutils 0.8.
| The default for the HTML5 writer will change to
"MathML" in Docutils 0.22.
@@ -1736,12 +1736,27 @@
reference_label
~~~~~~~~~~~~~~~
-Per default the latex-writer puts the reference title into
-hyper references. Specify "ref*" or "pageref*" to get the section
-number or the page number.
+The LaTeX command name for `hyperlink references`_ to internal__ or
+implicit__ targets. Per default the LaTeX writer uses ``\hyperref``.
+Specify an alternative reference command, e.g., "ref" or "pageref" to get
+the section number or the page number as reference text.
-Default: "" (use hyper references). Option: ``--reference-label``.
+.. Caution::
+ * Drops the original reference text.
+ * Experimental. Not sufficiently tested.
+ * Fails, e.g., with section numbering by Docutils (cf. sectnum_xform_)
+ or tables without caption.
+ * Provisional: to be replaced by a dedicated
+ `interpreted text role`_ for references.
+Default: "" (use "hyperref"). Option: ``--reference-label``.
+
+.. _hyperlink references: ../ref/rst/restructuredtext.html#hyperlink-references
+__ ../ref/rst/restructuredtext.html#internal-hyperlink-targets
+__ ../ref/rst/restructuredtext.html#implicit-hyperlink-targets
+.. _interpreted text role: ../ref/rst/restructuredtext.html#interpreted-text
+
+
section_enumerator_separator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2005,7 +2020,7 @@
[odf_odt writer]
----------------
-The `ODF/ODT Writer`__ generates documents in the
+The `ODF/ODT Writer`__ generates documents in the
OpenDocument_ Text format (.odt).
The output_encoding_ setting is ignored, the output encoding is
@@ -2182,7 +2197,7 @@
~~~~~~
Work silently (no progress messages). Independent of
-"report_level".
+report_level_.
Default: show progress (None). Option: ``--silent``.
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2023-05-24 22:59:28 UTC (rev 9394)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2023-05-24 22:59:36 UTC (rev 9395)
@@ -1185,7 +1185,7 @@
self.use_latex_toc = settings.use_latex_toc
self.use_latex_docinfo = settings.use_latex_docinfo
self.use_latex_citations = settings.use_latex_citations
- self._reference_label = settings.reference_label
+ self.reference_label = settings.reference_label
self.hyperlink_color = settings.hyperlink_color
self.compound_enumerators = settings.compound_enumerators
self.font_encoding = getattr(settings, 'font_encoding', '')
@@ -1808,7 +1808,7 @@
if self.use_latex_citations:
if not self.inside_citation_reference_label:
self.out.append(r'\cite{')
- self.inside_citation_reference_label = 1
+ self.inside_citation_reference_label = True
else:
assert self.out[-1] in (' ', '\n'),\
'unexpected non-whitespace while in reference label'
@@ -2820,8 +2820,8 @@
# problematic chars double caret and unbalanced braces:
if href.find('^^') != -1 or self.has_unbalanced_braces(href):
self.error(
- 'External link "%s" not supported by LaTeX.\n'
- ' (Must not contain "^^" or unbalanced braces.)' % href)
+ f'External link "{href}" not supported by LaTeX.\n'
+ ' (Must not contain "^^" or unbalanced braces.)')
if node['refuri'] == node.astext():
self.out.append(r'\url{%s}' % href)
raise nodes.SkipNode
@@ -2837,9 +2837,10 @@
if not self.is_inline(node):
self.out.append('\n')
self.out.append('\\hyperref[%s]{' % href)
- if self._reference_label:
+ if self.reference_label:
+ # TODO: don't use \hyperref if self.reference_label is True
self.out.append('\\%s{%s}}' %
- (self._reference_label, href.replace('#', '')))
+ (self.reference_label, href.replace('#', '')))
raise nodes.SkipNode
def depart_reference(self, node):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|