Exemple #1
0
def generate (out, root_project, root_context, project_mode, template_dir, type_config):
    subject = root_project if project_mode else root_context
    template = load_template (template_dir, type_config['template'])
    time_control_default = type_config["time_control_default"]
    logger.debug ("time_control_default: %s", time_control_default)
    visitor = PrintCalendarVisitor (out, template, time_control_default)
    format_document (subject, visitor, project_mode)
def generate (out, root_project, root_context, project_mode, template_dir, type_config):
    subject = root_project if project_mode else root_context
    template = load_template (template_dir, type_config['template'])
    
    template.attrib_map_builder.type_fns['taskpaper.tag'] = lambda x:  strip_brackets(''.join (x.split ()))
    template.attrib_map_builder.type_fns['taskpaper.title'] = lambda x: remove_trailing_colon(x)
    
    visitor = Formatter (out, template)
    format_document (subject, visitor, project_mode)
Exemple #3
0
def generate (out, root_project, root_context, project_mode, template_dir, type_config):
    subject = root_project if project_mode else root_context
    template = load_template (template_dir, type_config['template'])
    
    template.attrib_map_builder.type_fns['opml.string'] = lambda x:  escape (x)
    template.attrib_map_builder.type_fns['opml.note'] = lambda x: '
'.join([escape (line) for line in x.get_note_lines ()])
    
    visitor = Formatter (out, template)
    format_document (subject, visitor, project_mode)
Exemple #4
0
def generate (out, root_project, root_context, project_mode, template_dir, type_config):
    subject = root_project if project_mode else root_context
    template = load_template (template_dir, type_config['template'])
    
    template.attrib_map_builder.type_fns['html.string'] = lambda x:  escape (x)
    template.attrib_map_builder.type_fns['html.note'] = lambda x: ''.join([line+'<br>' for line in x.get_note_lines ()])

    visitor = Formatter (out, template)
    format_document (subject, visitor, project_mode)
Exemple #5
0
def generate(out, root_project, root_context, project_mode, template_dir,
             type_config):
    subject = root_project if project_mode else root_context
    template = load_template(template_dir, type_config['template'])

    template.attrib_map_builder.type_fns[
        'taskpaper.tag'] = lambda x: strip_brackets(''.join(x.split()))
    template.attrib_map_builder.type_fns[
        'taskpaper.title'] = lambda x: remove_trailing_colon(x)

    visitor = Formatter(out, template)
    format_document(subject, visitor, project_mode)
Exemple #6
0
     logger.debug ("created filter %s", visitor)
     if visitor != None:
         logger.info ('running filter %s', visitor)
         traverse (visitor, subject, project_mode=project_mode)
         
 logger.info ('Generating: %s', file_name)
 
 if file_name != None:
     out=codecs.open(file_name, 'w', 'utf-8')
 else: 
     out = sys.stdout
     
 if fmt in ('txt', 'text'):
     template = template if template != None else load_template (template_dir, 'text')
     visitor = PrintTextVisitor (out, template)
     format_document (subject, visitor, project_mode)
 elif fmt in ('md', 'markdown', 'ft', 'foldingtext'):
     template = template if template != None else load_template (template_dir, 'markdown')
     visitor = PrintMarkdownVisitor (out, template)
     format_document (subject, visitor, project_mode)
 elif fmt in ('tp', 'taskpaper'):
     template = template if template != None else load_template (template_dir, 'taskpaper')
     visitor = PrintTaskpaperVisitor (out, template)
     format_document (subject, visitor, project_mode)
 elif fmt == 'opml':
     template = template if template != None else load_template (template_dir, 'opml')
     visitor = PrintOpmlVisitor (out, template)
     format_document (subject, visitor, project_mode)
 elif fmt in ('html', 'htm'):
     template = template if template != None else load_template (template_dir, 'html')
     visitor = PrintHtmlVisitor (out, template)
Exemple #7
0
def generate (out, root_project, root_context, project_mode, template_dir, type_config):
    subject = root_project if project_mode else root_context
    template = load_template (template_dir, type_config['template'])
    visitor = Formatter (out, template)
    format_document (subject, visitor, project_mode)