def write_figure(self, *args, **kwargs): """ Override base writer to add a marking """ begin = len(self.buf) BaseRfcWriter.write_figure(self, *args, **kwargs) end = len(self.buf) nr = len([ l for l in self.buf[begin:end] if l and l[0] in nroff_linestart_meta]) self._set_break_hint(end - begin - nr, 'raw', begin)
def __init__(self, xmlrfc, quiet=None, options=default_options, date=datetime.date.today(), templates_dir=None): if not quiet is None: options.quiet = quiet BaseRfcWriter.__init__(self, xmlrfc, options=options) self.list_counters = {} self.iref_index = [] self.nbws_cond = ' ' # Use space as they are in an anchor element anyway self.cref_counter = 0 # Initialize templates directory self.templates_dir = templates_dir or \ os.path.join(os.path.dirname(xml2rfc.__file__), 'templates') # Open template files and read into string.template objects self.templates = {} for filename in ['base.html', 'address_card.html']: file = open(os.path.join(self.templates_dir, filename), 'r') self.templates[filename] = string.Template(file.read()) file.close() # Buffers to aggregate various elements before processing template self.buffers = { 'front': [], 'body': [], 'header_rows': [], 'toc_head_links': [], 'toc_rows': [] } # Use an active buffer pointer self.buf = self.buffers['front'] # String holding the final document to write self.output = '' # Temporary div for recursive functions self.temp_div = E.DIV() # Table to insert the iref into self.iref_table = None
def __init__(self, xmlrfc, quiet=False, verbose=False, date=datetime.date.today(), templates_dir=None): BaseRfcWriter.__init__(self, xmlrfc, quiet=quiet, date=date, verbose=verbose) self.list_counters = {} self.iref_index = [] self.nbws_cond = ' ' # Use space as they are in an anchor element anyway self.cref_counter = 0 # Initialize templates directory self.templates_dir = templates_dir or \ os.path.join(os.path.dirname(xml2rfc.__file__), 'templates') # Open template files and read into string.template objects self.templates = {} for filename in ['base.html', 'address_card.html']: file = open(os.path.join(self.templates_dir, filename), 'r') self.templates[filename] = string.Template(file.read()) file.close() # Buffers to aggregate various elements before processing template self.buffers = {'front': [], 'body': [], 'header_rows': [], 'toc_head_links': [], 'toc_rows': []} # Use an active buffer pointer self.buf = self.buffers['front'] # String holding the final document to write self.output = '' # Temporary div for recursive functions self.temp_div = E.DIV() # Table to insert the iref into self.iref_table = None