serror(file, lnum, "Invalid ARCHHEADING line")
return match.group(1)
+def parse_srst(file, lnum, line):
+ """Handle an SRST directive"""
+ # The input should be "SRST(label)".
+ match = re.match(r'SRST\((.*?)\)', line)
+ if match is None:
+ serror(file, lnum, "Invalid SRST line")
+ return match.group(1)
+
class HxtoolDocDirective(Directive):
"""Extract rST fragments from the specified .hx file"""
required_argument = 1
optional_arguments = 1
option_spec = {
- 'hxfile': directives.unchanged_required
+ 'hxfile': directives.unchanged_required,
+ 'emitrefs': directives.flag
}
has_content = False
def run(self):
env = self.state.document.settings.env
hxfile = env.config.hxtool_srctree + '/' + self.arguments[0]
+ emitrefs = "emitrefs" in self.options
# Tell sphinx of the dependency
env.note_dependency(os.path.abspath(hxfile))
serror(hxfile, lnum, 'expected ERST, found SRST')
else:
state = HxState.RST
+ if emitrefs and line != "SRST":
+ label = parse_srst(hxfile, lnum, line)
+ if label != "":
+ rstlist.append("", hxfile, lnum - 1)
+ refline = ".. _" + label + "-reference-label:"
+ rstlist.append(refline, hxfile, lnum - 1)
elif directive == 'ERST':
if state == HxState.CTEXT:
serror(hxfile, lnum, 'expected SRST, found ERST')
(" ``--`` ") on the Xen command line, and does not provide the guest kernel
with an actual initramfs, which would need to listed as a second multiboot
module. For more complicated alternatives, see the command line
-documentation for the ``-initrd`` option.
+:ref:`documentation <initrd-reference-label>` for the ``-initrd`` option.
Host OS requirements
--------------------