diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-24 17:49:45 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-24 17:49:45 +0300 |
commit | 327c1872841bc6a98aa766fc3d7ee921e6d3b658 (patch) | |
tree | d3424f7aadc4a3118eb7fb72e245b4fbe8391e58 /sphinx/transforms | |
parent | dc63eaf196d37c70410d37c3d28297fb513f7f6d (diff) | |
parent | 5b096c42ff3a907fa7bcce3fa620209da16d40bd (diff) |
Merge branch '3.x'
Diffstat (limited to 'sphinx/transforms')
-rw-r--r-- | sphinx/transforms/i18n.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sphinx/transforms/i18n.py b/sphinx/transforms/i18n.py index 028044de2..b016ba418 100644 --- a/sphinx/transforms/i18n.py +++ b/sphinx/transforms/i18n.py @@ -36,6 +36,13 @@ if TYPE_CHECKING: logger = logging.getLogger(__name__) +# The attributes not copied to the translated node +# +# * refexplict: For allow to give (or not to give) an explicit title +# to the pending_xref on translation +EXCLUDED_PENDING_XREF_ATTRIBUTES = ('refexplicit',) + + N = TypeVar('N', bound=nodes.Node) @@ -429,11 +436,8 @@ class Locale(SphinxTransform): # Copy attributes to keep original node behavior. Especially # copying 'reftarget', 'py:module', 'py:class' are needed. for k, v in xref_reftarget_map.get(key, {}).items(): - # Note: This implementation overwrite all attributes. - # if some attributes `k` should not be overwritten, - # you should provide exclude list as: - # `if k not in EXCLUDE_LIST: new[k] = v` - new[k] = v + if k not in EXCLUDED_PENDING_XREF_ATTRIBUTES: + new[k] = v # update leaves for child in patch.children: |