Lines Matching refs:self
61 def run(self):
62 env = self.state.document.settings.env
64 os.path.expandvars(self.arguments[0]))
68 raise self.severe(
70 % (self.name, path))
72 self.arguments[0] = path
76 #return super(KernelInclude, self).run() # won't work, see HINTs in _run()
77 return self._run()
79 def _run(self):
87 if not self.state.document.settings.file_insertion_enabled:
88 raise self.warning('"%s" directive disabled.' % self.name)
89 source = self.state_machine.input_lines.source(
90 self.lineno - self.state_machine.input_offset - 1)
92 path = directives.path(self.arguments[0])
94 path = os.path.join(self.standard_include_path, path[1:-1])
101 encoding = self.options.get(
102 'encoding', self.state.document.settings.input_encoding)
103 e_handler=self.state.document.settings.input_encoding_error_handler
104 tab_width = self.options.get(
105 'tab-width', self.state.document.settings.tab_width)
107 self.state.document.settings.record_dependencies.add(path)
112 raise self.severe('Problems with "%s" directive path:\n'
115 (self.name, SafeString(path)))
117 raise self.severe('Problems with "%s" directive path:\n%s.' %
118 (self.name, ErrorString(error)))
119 startline = self.options.get('start-line', None)
120 endline = self.options.get('end-line', None)
128 raise self.severe('Problem with "%s" directive:\n%s' %
129 (self.name, ErrorString(error)))
132 after_text = self.options.get('start-after', None)
137 raise self.severe('Problem with "start-after" option of "%s" '
138 'directive:\nText not found.' % self.name)
140 before_text = self.options.get('end-before', None)
145 raise self.severe('Problem with "end-before" option of "%s" '
146 'directive:\nText not found.' % self.name)
151 if 'literal' in self.options:
158 classes=self.options.get('class', []))
160 self.add_name(literal_block)
161 if 'number-lines' in self.options:
163 startline = int(self.options['number-lines'] or 1)
165 raise self.error(':number-lines: with non-integer '
180 if 'code' in self.options:
181 self.options['source'] = path
182 codeblock = CodeBlock(self.name,
183 [self.options.pop('code')], # arguments
184 self.options,
186 self.lineno,
187 self.content_offset,
188 self.block_text,
189 self.state,
190 self.state_machine)
192 self.state_machine.insert_input(include_lines, path)