Docs: change default title for value xref
When we use zuul:value to xref, the default title text for the link is the full target name (eg "pipeline.trigger.github.event.pull_request") which is a bit verbose. Normally, we would just want the final element as the title for a value (so a sentence might read "When a <pull_request> event is received..."). Change-Id: I42cd678d9bb97058d5fbe255791cbc476d5057bb
This commit is contained in:
parent
91c9dde0cb
commit
074c28deb0
|
@ -204,6 +204,17 @@ class ZuulStatDirective(ZuulConfigObject):
|
||||||
return sig
|
return sig
|
||||||
|
|
||||||
|
|
||||||
|
class ZuulAbbreviatedXRefRole(XRefRole):
|
||||||
|
|
||||||
|
def process_link(self, env, refnode, has_explicit_title, title,
|
||||||
|
target):
|
||||||
|
title, target = super(ZuulAbbreviatedXRefRole, self).process_link(
|
||||||
|
env, refnode, has_explicit_title, title, target)
|
||||||
|
if not has_explicit_title:
|
||||||
|
title = title.split('.')[-1]
|
||||||
|
return title, target
|
||||||
|
|
||||||
|
|
||||||
class ZuulDomain(Domain):
|
class ZuulDomain(Domain):
|
||||||
name = 'zuul'
|
name = 'zuul'
|
||||||
label = 'Zuul'
|
label = 'Zuul'
|
||||||
|
@ -218,8 +229,9 @@ class ZuulDomain(Domain):
|
||||||
roles = {
|
roles = {
|
||||||
'attr': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
'attr': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
||||||
warn_dangling=True),
|
warn_dangling=True),
|
||||||
'value': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
'value': ZuulAbbreviatedXRefRole(
|
||||||
warn_dangling=True),
|
innernodeclass=nodes.inline, # type: ignore
|
||||||
|
warn_dangling=True),
|
||||||
'var': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
'var': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
||||||
warn_dangling=True),
|
warn_dangling=True),
|
||||||
'stat': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
'stat': XRefRole(innernodeclass=nodes.inline, # type: ignore
|
||||||
|
|
Loading…
Reference in New Issue