Python docutils.nodes.whitespace_normalize_name() Examples
The following are 30
code examples of docutils.nodes.whitespace_normalize_name().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
docutils.nodes
, or try the search function
.
Example #1
Source File: states.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) referencenode[0].rawsource = referencename if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #2
Source File: states.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #3
Source File: states.py From aws-builders-fair-projects with Apache License 2.0 | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #4
Source File: states.py From aws-extender with MIT License | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #5
Source File: states.py From aws-extender with MIT License | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #6
Source File: states.py From blackmamba with MIT License | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #7
Source File: states.py From blackmamba with MIT License | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #8
Source File: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #9
Source File: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #10
Source File: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #11
Source File: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #12
Source File: states.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #13
Source File: states.py From bash-lambda-layer with MIT License | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #14
Source File: states.py From faces with GNU General Public License v2.0 | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #15
Source File: states.py From faces with GNU General Public License v2.0 | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #16
Source File: states.py From deepWordBug with Apache License 2.0 | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #17
Source File: states.py From deepWordBug with Apache License 2.0 | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #18
Source File: states.py From faces with GNU General Public License v2.0 | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #19
Source File: states.py From faces with GNU General Public License v2.0 | 5 votes |
def is_reference(self, reference): match = self.explicit.patterns.reference.match( whitespace_normalize_name(reference)) if not match: return None return unescape(match.group('simple') or match.group('phrase'))
Example #20
Source File: states.py From bash-lambda-layer with MIT License | 5 votes |
def reference(self, match, lineno, anonymous=False): referencename = match.group('refname') refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group('refend'), referencename, name=whitespace_normalize_name(referencename)) if anonymous: referencenode['anonymous'] = 1 else: referencenode['refname'] = refname self.document.note_refname(referencenode) string = match.string matchstart = match.start('whole') matchend = match.end('whole') return (string[:matchstart], [referencenode], string[matchend:], [])
Example #21
Source File: images.py From deepWordBug with Apache License 2.0 | 4 votes |
def run(self): if 'align' in self.options: if isinstance(self.state, states.SubstitutionDef): # Check for align_v_values. if self.options['align'] not in self.align_v_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value ' 'for the "align" option within a substitution ' 'definition. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_v_values))) elif self.options['align'] not in self.align_h_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value for ' 'the "align" option. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_h_values))) messages = [] reference = directives.uri(self.arguments[0]) self.options['uri'] = reference reference_node = None if 'target' in self.options: block = states.escape2null( self.options['target']).splitlines() block = [line for line in block] target_type, data = self.state.parse_target( block, self.block_text, self.lineno) if target_type == 'refuri': reference_node = nodes.reference(refuri=data) elif target_type == 'refname': reference_node = nodes.reference( refname=fully_normalize_name(data), name=whitespace_normalize_name(data)) reference_node.indirect_reference_name = data self.state.document.note_refname(reference_node) else: # malformed target messages.append(data) # data is a system message del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: return messages + [image_node]
Example #22
Source File: states.py From faces with GNU General Public License v2.0 | 4 votes |
def phrase_ref(self, before, after, rawsource, escaped, text): match = self.patterns.embedded_link.search(escaped) if match: # embedded <URI> or <alias_> text = unescape(escaped[:match.start(0)]) aliastext = match.group(2) underscore_escaped = aliastext.endswith('\x00_') aliastext = unescape(aliastext) if aliastext.endswith('_') and not (underscore_escaped or self.patterns.uri.match(aliastext)): aliastype = 'name' alias = normalize_name(aliastext[:-1]) target = nodes.target(match.group(1), refname=alias) target.indirect_reference_name = aliastext[:-1] else: aliastype = 'uri' alias = ''.join(aliastext.split()) alias = self.adjust_uri(alias) if alias.endswith(r'\_'): alias = alias[:-2] + '_' target = nodes.target(match.group(1), refuri=alias) target.referenced = 1 if not aliastext: raise ApplicationError('problem with embedded link: %r' % aliastext) if not text: text = alias else: target = None refname = normalize_name(text) reference = nodes.reference(rawsource, text, name=whitespace_normalize_name(text)) node_list = [reference] if rawsource[-2:] == '__': if target and (aliastype == 'name'): reference['refname'] = alias self.document.note_refname(reference) # self.document.note_indirect_target(target) # required? elif target and (aliastype == 'uri'): reference['refuri'] = alias else: reference['anonymous'] = 1 else: if target: target['names'].append(refname) if aliastype == 'name': reference['refname'] = alias self.document.note_indirect_target(target) self.document.note_refname(reference) else: reference['refuri'] = alias self.document.note_explicit_target(target, self.parent) # target.note_referenced_by(name=refname) node_list.append(target) else: reference['refname'] = refname self.document.note_refname(reference) return before, node_list, after, []
Example #23
Source File: images.py From aws-builders-fair-projects with Apache License 2.0 | 4 votes |
def run(self): if 'align' in self.options: if isinstance(self.state, states.SubstitutionDef): # Check for align_v_values. if self.options['align'] not in self.align_v_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value ' 'for the "align" option within a substitution ' 'definition. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_v_values))) elif self.options['align'] not in self.align_h_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value for ' 'the "align" option. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_h_values))) messages = [] reference = directives.uri(self.arguments[0]) self.options['uri'] = reference reference_node = None if 'target' in self.options: block = states.escape2null( self.options['target']).splitlines() block = [line for line in block] target_type, data = self.state.parse_target( block, self.block_text, self.lineno) if target_type == 'refuri': reference_node = nodes.reference(refuri=data) elif target_type == 'refname': reference_node = nodes.reference( refname=fully_normalize_name(data), name=whitespace_normalize_name(data)) reference_node.indirect_reference_name = data self.state.document.note_refname(reference_node) else: # malformed target messages.append(data) # data is a system message del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: return messages + [image_node]
Example #24
Source File: images.py From faces with GNU General Public License v2.0 | 4 votes |
def run(self): if 'align' in self.options: if isinstance(self.state, states.SubstitutionDef): # Check for align_v_values. if self.options['align'] not in self.align_v_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value ' 'for the "align" option within a substitution ' 'definition. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_v_values))) elif self.options['align'] not in self.align_h_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value for ' 'the "align" option. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_h_values))) messages = [] reference = directives.uri(self.arguments[0]) self.options['uri'] = reference reference_node = None if 'target' in self.options: block = states.escape2null( self.options['target']).splitlines() block = [line for line in block] target_type, data = self.state.parse_target( block, self.block_text, self.lineno) if target_type == 'refuri': reference_node = nodes.reference(refuri=data) elif target_type == 'refname': reference_node = nodes.reference( refname=fully_normalize_name(data), name=whitespace_normalize_name(data)) reference_node.indirect_reference_name = data self.state.document.note_refname(reference_node) else: # malformed target messages.append(data) # data is a system message del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: return messages + [image_node]
Example #25
Source File: states.py From aws-extender with MIT License | 4 votes |
def phrase_ref(self, before, after, rawsource, escaped, text): match = self.patterns.embedded_link.search(escaped) if match: # embedded <URI> or <alias_> text = unescape(escaped[:match.start(0)]) aliastext = match.group(2) underscore_escaped = aliastext.endswith('\x00_') aliastext = unescape(aliastext) if aliastext.endswith('_') and not (underscore_escaped or self.patterns.uri.match(aliastext)): aliastype = 'name' alias = normalize_name(aliastext[:-1]) target = nodes.target(match.group(1), refname=alias) target.indirect_reference_name = aliastext[:-1] else: aliastype = 'uri' alias_parts = split_escaped_whitespace(match.group(2)) alias = ' '.join(''.join(unescape(part).split()) for part in alias_parts) alias = self.adjust_uri(alias) if alias.endswith(r'\_'): alias = alias[:-2] + '_' target = nodes.target(match.group(1), refuri=alias) target.referenced = 1 if not aliastext: raise ApplicationError('problem with embedded link: %r' % aliastext) if not text: text = alias else: target = None refname = normalize_name(text) reference = nodes.reference(rawsource, text, name=whitespace_normalize_name(text)) node_list = [reference] if rawsource[-2:] == '__': if target and (aliastype == 'name'): reference['refname'] = alias self.document.note_refname(reference) # self.document.note_indirect_target(target) # required? elif target and (aliastype == 'uri'): reference['refuri'] = alias else: reference['anonymous'] = 1 else: if target: target['names'].append(refname) if aliastype == 'name': reference['refname'] = alias self.document.note_indirect_target(target) self.document.note_refname(reference) else: reference['refuri'] = alias self.document.note_explicit_target(target, self.parent) # target.note_referenced_by(name=refname) node_list.append(target) else: reference['refname'] = refname self.document.note_refname(reference) return before, node_list, after, []
Example #26
Source File: images.py From aws-extender with MIT License | 4 votes |
def run(self): if 'align' in self.options: if isinstance(self.state, states.SubstitutionDef): # Check for align_v_values. if self.options['align'] not in self.align_v_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value ' 'for the "align" option within a substitution ' 'definition. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_v_values))) elif self.options['align'] not in self.align_h_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value for ' 'the "align" option. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_h_values))) messages = [] reference = directives.uri(self.arguments[0]) self.options['uri'] = reference reference_node = None if 'target' in self.options: block = states.escape2null( self.options['target']).splitlines() block = [line for line in block] target_type, data = self.state.parse_target( block, self.block_text, self.lineno) if target_type == 'refuri': reference_node = nodes.reference(refuri=data) elif target_type == 'refname': reference_node = nodes.reference( refname=fully_normalize_name(data), name=whitespace_normalize_name(data)) reference_node.indirect_reference_name = data self.state.document.note_refname(reference_node) else: # malformed target messages.append(data) # data is a system message del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: return messages + [image_node]
Example #27
Source File: states.py From blackmamba with MIT License | 4 votes |
def phrase_ref(self, before, after, rawsource, escaped, text): match = self.patterns.embedded_link.search(escaped) if match: # embedded <URI> or <alias_> text = unescape(escaped[:match.start(0)]) aliastext = match.group(2) underscore_escaped = aliastext.endswith('\x00_') aliastext = unescape(aliastext) if aliastext.endswith('_') and not (underscore_escaped or self.patterns.uri.match(aliastext)): aliastype = 'name' alias = normalize_name(aliastext[:-1]) target = nodes.target(match.group(1), refname=alias) target.indirect_reference_name = aliastext[:-1] else: aliastype = 'uri' alias_parts = split_escaped_whitespace(match.group(2)) alias = ' '.join(''.join(unescape(part).split()) for part in alias_parts) alias = self.adjust_uri(alias) if alias.endswith(r'\_'): alias = alias[:-2] + '_' target = nodes.target(match.group(1), refuri=alias) target.referenced = 1 if not aliastext: raise ApplicationError('problem with embedded link: %r' % aliastext) if not text: text = alias else: target = None refname = normalize_name(text) reference = nodes.reference(rawsource, text, name=whitespace_normalize_name(text)) node_list = [reference] if rawsource[-2:] == '__': if target and (aliastype == 'name'): reference['refname'] = alias self.document.note_refname(reference) # self.document.note_indirect_target(target) # required? elif target and (aliastype == 'uri'): reference['refuri'] = alias else: reference['anonymous'] = 1 else: if target: target['names'].append(refname) if aliastype == 'name': reference['refname'] = alias self.document.note_indirect_target(target) self.document.note_refname(reference) else: reference['refuri'] = alias self.document.note_explicit_target(target, self.parent) # target.note_referenced_by(name=refname) node_list.append(target) else: reference['refname'] = refname self.document.note_refname(reference) return before, node_list, after, []
Example #28
Source File: images.py From blackmamba with MIT License | 4 votes |
def run(self): if 'align' in self.options: if isinstance(self.state, states.SubstitutionDef): # Check for align_v_values. if self.options['align'] not in self.align_v_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value ' 'for the "align" option within a substitution ' 'definition. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_v_values))) elif self.options['align'] not in self.align_h_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value for ' 'the "align" option. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_h_values))) messages = [] reference = directives.uri(self.arguments[0]) self.options['uri'] = reference reference_node = None if 'target' in self.options: block = states.escape2null( self.options['target']).splitlines() block = [line for line in block] target_type, data = self.state.parse_target( block, self.block_text, self.lineno) if target_type == 'refuri': reference_node = nodes.reference(refuri=data) elif target_type == 'refname': reference_node = nodes.reference( refname=fully_normalize_name(data), name=whitespace_normalize_name(data)) reference_node.indirect_reference_name = data self.state.document.note_refname(reference_node) else: # malformed target messages.append(data) # data is a system message del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: return messages + [image_node]
Example #29
Source File: states.py From deepWordBug with Apache License 2.0 | 4 votes |
def phrase_ref(self, before, after, rawsource, escaped, text): match = self.patterns.embedded_link.search(escaped) if match: # embedded <URI> or <alias_> text = unescape(escaped[:match.start(0)]) aliastext = match.group(2) underscore_escaped = aliastext.endswith('\x00_') aliastext = unescape(aliastext) if aliastext.endswith('_') and not (underscore_escaped or self.patterns.uri.match(aliastext)): aliastype = 'name' alias = normalize_name(aliastext[:-1]) target = nodes.target(match.group(1), refname=alias) target.indirect_reference_name = aliastext[:-1] else: aliastype = 'uri' alias_parts = split_escaped_whitespace(match.group(2)) alias = ' '.join(''.join(unescape(part).split()) for part in alias_parts) alias = self.adjust_uri(alias) if alias.endswith(r'\_'): alias = alias[:-2] + '_' target = nodes.target(match.group(1), refuri=alias) target.referenced = 1 if not aliastext: raise ApplicationError('problem with embedded link: %r' % aliastext) if not text: text = alias else: target = None refname = normalize_name(text) reference = nodes.reference(rawsource, text, name=whitespace_normalize_name(text)) node_list = [reference] if rawsource[-2:] == '__': if target and (aliastype == 'name'): reference['refname'] = alias self.document.note_refname(reference) # self.document.note_indirect_target(target) # required? elif target and (aliastype == 'uri'): reference['refuri'] = alias else: reference['anonymous'] = 1 else: if target: target['names'].append(refname) if aliastype == 'name': reference['refname'] = alias self.document.note_indirect_target(target) self.document.note_refname(reference) else: reference['refuri'] = alias self.document.note_explicit_target(target, self.parent) # target.note_referenced_by(name=refname) node_list.append(target) else: reference['refname'] = refname self.document.note_refname(reference) return before, node_list, after, []
Example #30
Source File: images.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 4 votes |
def run(self): if 'align' in self.options: if isinstance(self.state, states.SubstitutionDef): # Check for align_v_values. if self.options['align'] not in self.align_v_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value ' 'for the "align" option within a substitution ' 'definition. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_v_values))) elif self.options['align'] not in self.align_h_values: raise self.error( 'Error in "%s" directive: "%s" is not a valid value for ' 'the "align" option. Valid values for "align" are: "%s".' % (self.name, self.options['align'], '", "'.join(self.align_h_values))) messages = [] reference = directives.uri(self.arguments[0]) self.options['uri'] = reference reference_node = None if 'target' in self.options: block = states.escape2null( self.options['target']).splitlines() block = [line for line in block] target_type, data = self.state.parse_target( block, self.block_text, self.lineno) if target_type == 'refuri': reference_node = nodes.reference(refuri=data) elif target_type == 'refname': reference_node = nodes.reference( refname=fully_normalize_name(data), name=whitespace_normalize_name(data)) reference_node.indirect_reference_name = data self.state.document.note_refname(reference_node) else: # malformed target messages.append(data) # data is a system message del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: return messages + [image_node]