< (;)/2 >
(;)/2 depends on split_into function which is used by IndexEntries class.
- I guess:
value.split(';', n - 1) -> value.split('; ', n - 1)
- I put a comment on the #8904.
- It seems easy for you to rewrite this code.
sphinx/util/init.py ( Sphinx 4.2.0 )
365
366 def split_into(n: int, type: str, value: str) -> List[str]:
367 """Split an index entry into a given number of parts at semicolons."""
368 parts = [x.strip() for x in value.split(';', n - 1)]
369 if sum(1 for part in parts if part) < n:
370 raise ValueError('invalid %s index entry %r' % (type, value))
371 return parts
372
< !!/0 >
!!/0 depends on process_index_entry function and an other which are used by index directive/role.
- A workaround is to use
!!!/0
sphinx/util/nodes.py ( Sphinx 4.2.0 )
363
364 def process_index_entry(entry: str, targetid: str
365 ) -> List[Tuple[str, str, str, str, Optional[str]]]:
366 from sphinx.domains.python import pairindextypes
367
368 indexentries: List[Tuple[str, str, str, str, Optional[str]]] = []
369 entry = entry.strip()
370 oentry = entry
371 main = ''
372 if entry.startswith('!'):
373 main = 'main'
374 entry = entry[1:].lstrip()
375 for type in pairindextypes:
376 if entry.startswith(type + ':'):
377 value = entry[len(type) + 1:].strip()
378 value = pairindextypes[type] + '; ' + value
379 indexentries.append(('pair', value, targetid, main, None))
380 break
381 else:
sphinx/domains/index.py ( Sphinx 4.2.0 )
62
63 class IndexDirective(SphinxDirective):
64 """
65 Directive to add entries to the index.
66 """
...
90 for entry in arguments:
91 indexnode['entries'].extend(process_index_entry(entry, targetnode['ids'][0]))
92 return [indexnode, targetnode]
...
94
95 class IndexRole(ReferenceRole):
96 def run(self) -> Tuple[List[Node], List[system_message]]:
...
102 else:
103 # otherwise we just create a single entry
104 if self.target.startswith('!'):
105 title = self.title[1:]
106 entries = [('single', self.target[1:], target_id, 'main', None)]
107 else:
Other
The ideal, but hard, solution would be to develop sphinx/domains/prolog.py.