mirror of
https://github.com/minio/docs.git
synced 2025-07-31 18:04:52 +03:00
Attempting fix for intersphinx issues
This commit is contained in:
@ -62,9 +62,9 @@ class MinioMCCommand(SphinxDirective):
|
|||||||
def run(self) -> List[Node]:
|
def run(self) -> List[Node]:
|
||||||
command = self.arguments[0].strip()
|
command = self.arguments[0].strip()
|
||||||
if (len(self.arguments) > 1):
|
if (len(self.arguments) > 1):
|
||||||
command += " " + self.arguments[1].strip()
|
command += "-" + self.arguments[1].strip().replace(" ","-")
|
||||||
|
|
||||||
self.env.ref_context['minio:command'] = command
|
self.env.ref_context['minio:mc'] = command
|
||||||
noindex = 'noindex' in self.options
|
noindex = 'noindex' in self.options
|
||||||
ret = []
|
ret = []
|
||||||
if not noindex:
|
if not noindex:
|
||||||
@ -74,7 +74,7 @@ class MinioMCCommand(SphinxDirective):
|
|||||||
domain.note_module(command, node_id)
|
domain.note_module(command, node_id)
|
||||||
# Make a duplicate entry in 'objects' to facilitate searching for
|
# Make a duplicate entry in 'objects' to facilitate searching for
|
||||||
# the module in JavaScriptDomain.find_obj()
|
# the module in JavaScriptDomain.find_obj()
|
||||||
domain.note_object(command, 'command', node_id,
|
domain.note_object(command, 'mc', node_id,
|
||||||
location=(self.env.docname, self.lineno))
|
location=(self.env.docname, self.lineno))
|
||||||
|
|
||||||
target = nodes.target('', '', ids=[node_id], ismod=True)
|
target = nodes.target('', '', ids=[node_id], ismod=True)
|
||||||
@ -125,12 +125,12 @@ class MinioMCObject(ObjectDescription):
|
|||||||
prefix = self.env.ref_context.get('minio:object', None)
|
prefix = self.env.ref_context.get('minio:object', None)
|
||||||
|
|
||||||
#Grab the top-level command name.
|
#Grab the top-level command name.
|
||||||
command_name = self.env.ref_context.get('minio:command')
|
command_name = self.env.ref_context.get('minio:mc').replace("-"," ")
|
||||||
name = member
|
name = member
|
||||||
format_name = member
|
format_name = member
|
||||||
format_alias = alias
|
format_alias = alias
|
||||||
if prefix:
|
if prefix:
|
||||||
fullname = ' '.join([prefix, name])
|
fullname = '-'.join([prefix, name])
|
||||||
else:
|
else:
|
||||||
fullname = name
|
fullname = name
|
||||||
|
|
||||||
@ -146,11 +146,11 @@ class MinioMCObject(ObjectDescription):
|
|||||||
signode['fullname'] = fullname
|
signode['fullname'] = fullname
|
||||||
|
|
||||||
if prefix:
|
if prefix:
|
||||||
signode += addnodes.desc_addname(prefix + ' ', ' ')
|
signode += addnodes.desc_addname(prefix + '-', ' ')
|
||||||
elif command_name and ('fullpath' in self.options):
|
elif command_name and ('fullpath' in self.options):
|
||||||
signode += addnodes.desc_addname(command_name + ' ', command_name + ' ')
|
signode += addnodes.desc_addname(command_name + '-', command_name + ' ')
|
||||||
elif command_name:
|
elif command_name:
|
||||||
signode += addnodes.desc_addname(command_name + ' ', ' ')
|
signode += addnodes.desc_addname(command_name + '-', ' ')
|
||||||
|
|
||||||
if (alias != None):
|
if (alias != None):
|
||||||
signode += addnodes.desc_name(name + ', ' + alias, format_name + ', ' + format_alias)
|
signode += addnodes.desc_name(name + ', ' + alias, format_name + ', ' + format_alias)
|
||||||
@ -163,8 +163,8 @@ class MinioMCObject(ObjectDescription):
|
|||||||
|
|
||||||
def add_target_and_index(self, name_obj: Tuple[str, str], sig: str,
|
def add_target_and_index(self, name_obj: Tuple[str, str], sig: str,
|
||||||
signode: desc_signature) -> None:
|
signode: desc_signature) -> None:
|
||||||
mod_name = self.env.ref_context.get('minio:command')
|
mod_name = self.env.ref_context.get('minio:mc')
|
||||||
fullname = (mod_name + ' ' if mod_name else '') + name_obj[0]
|
fullname = (mod_name + '-' if mod_name else '') + name_obj[0]
|
||||||
node_id = make_id(self.env, self.state.document, '', fullname)
|
node_id = make_id(self.env, self.state.document, '', fullname)
|
||||||
signode['ids'].append(node_id)
|
signode['ids'].append(node_id)
|
||||||
|
|
||||||
@ -400,38 +400,13 @@ class MinioObject(ObjectDescription):
|
|||||||
"""
|
"""
|
||||||
return fullname.replace('$', '_S_')
|
return fullname.replace('$', '_S_')
|
||||||
|
|
||||||
class MinioCallable(MinioObject):
|
|
||||||
"""Description of a MinIO function, method or constructor."""
|
|
||||||
has_arguments = True
|
|
||||||
|
|
||||||
doc_field_types = [
|
|
||||||
TypedField('arguments', label=_('Arguments'),
|
|
||||||
names=('argument', 'arg', 'parameter', 'param'),
|
|
||||||
typerolename='func', typenames=('paramtype', 'type')),
|
|
||||||
GroupedField('errors', label=_('Throws'), rolename='err',
|
|
||||||
names=('throws', ),
|
|
||||||
can_collapse=True),
|
|
||||||
Field('returnvalue', label=_('Returns'), has_arg=False,
|
|
||||||
names=('returns', 'return')),
|
|
||||||
Field('returntype', label=_('Return type'), has_arg=False,
|
|
||||||
names=('rtype',)),
|
|
||||||
]
|
|
||||||
|
|
||||||
class MinioConstructor(MinioCallable):
|
|
||||||
"""Like a callable but with a different prefix."""
|
|
||||||
display_prefix = 'class '
|
|
||||||
allow_nesting = True
|
|
||||||
|
|
||||||
class MinioCommand(MinioObject):
|
|
||||||
allow_nesting = True
|
|
||||||
|
|
||||||
class MinioCMDOptionXRefRole(XRefRole):
|
class MinioCMDOptionXRefRole(XRefRole):
|
||||||
def process_link(self, env: BuildEnvironment, refnode: Element,
|
def process_link(self, env: BuildEnvironment, refnode: Element,
|
||||||
has_explicit_title: bool, title: str, target: str) -> Tuple[str, str]:
|
has_explicit_title: bool, title: str, target: str) -> Tuple[str, str]:
|
||||||
# basically what sphinx.domains.python.PyXRefRole does
|
# basically what sphinx.domains.python.PyXRefRole does
|
||||||
refnode['minio:object'] = env.ref_context.get('minio:object')
|
refnode['minio:object'] = env.ref_context.get('minio:object')
|
||||||
refnode['minio:module'] = env.ref_context.get('minio:module')
|
refnode['minio:module'] = env.ref_context.get('minio:module')
|
||||||
refnode['minio:command'] = env.ref_context.get('minio:command')
|
refnode['minio:mc'] = env.ref_context.get('minio:mc')
|
||||||
if not has_explicit_title:
|
if not has_explicit_title:
|
||||||
title = title.lstrip('.')
|
title = title.lstrip('.')
|
||||||
target = target.lstrip('~')
|
target = target.lstrip('~')
|
||||||
@ -448,6 +423,7 @@ class MinioCMDOptionXRefRole(XRefRole):
|
|||||||
if target[0:1] == '.':
|
if target[0:1] == '.':
|
||||||
target = target[1:]
|
target = target[1:]
|
||||||
refnode['refspecific'] = True
|
refnode['refspecific'] = True
|
||||||
|
target = target.replace(" ","-")
|
||||||
|
|
||||||
return title, target
|
return title, target
|
||||||
|
|
||||||
@ -457,7 +433,7 @@ class MinioXRefRole(XRefRole):
|
|||||||
# basically what sphinx.domains.python.PyXRefRole does
|
# basically what sphinx.domains.python.PyXRefRole does
|
||||||
refnode['minio:object'] = env.ref_context.get('minio:object')
|
refnode['minio:object'] = env.ref_context.get('minio:object')
|
||||||
refnode['minio:module'] = env.ref_context.get('minio:module')
|
refnode['minio:module'] = env.ref_context.get('minio:module')
|
||||||
refnode['minio:command'] = env.ref_context.get('minio:command')
|
refnode['minio:mc'] = env.ref_context.get('minio:mc')
|
||||||
|
|
||||||
if not has_explicit_title:
|
if not has_explicit_title:
|
||||||
title = title.lstrip('.')
|
title = title.lstrip('.')
|
||||||
@ -477,6 +453,7 @@ class MinioXRefRole(XRefRole):
|
|||||||
refnode['refspecific'] = True
|
refnode['refspecific'] = True
|
||||||
|
|
||||||
if (self.reftype == "mc" or self.reftype == "mc-cmd" or self.reftype == "mc-cmd-option"):
|
if (self.reftype == "mc" or self.reftype == "mc-cmd" or self.reftype == "mc-cmd-option"):
|
||||||
|
target = target.replace(" ","-")
|
||||||
return title, target
|
return title, target
|
||||||
|
|
||||||
target = self.reftype + "." + target
|
target = self.reftype + "." + target
|
||||||
@ -549,7 +526,7 @@ class MinIODomain(Domain):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def command(self) -> Dict[str, Tuple[str, str]]:
|
def command(self) -> Dict[str, Tuple[str, str]]:
|
||||||
return self.data.setdefault('command', {}) # command -> commandname, node_id
|
return self.data.setdefault('mc', {}) # command -> commandname, node_id
|
||||||
|
|
||||||
def note_command(self, commandname: str, node_id: str) -> None:
|
def note_command(self, commandname: str, node_id: str) -> None:
|
||||||
self.command[commandname] = (self.env.docname, node_id)
|
self.command[commandname] = (self.env.docname, node_id)
|
||||||
|
Reference in New Issue
Block a user