當前位置: 首頁>>代碼示例>>Python>>正文


Python fmt_template.Formatter類代碼示例

本文整理匯總了Python中fmt_template.Formatter的典型用法代碼示例。如果您正苦於以下問題:Python Formatter類的具體用法?Python Formatter怎麽用?Python Formatter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Formatter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: begin_project

 def begin_project (self, project):
     fix_dates(project)
     load_note_attribs (project)
     if project.date_due != None or project.date_to_start != None:
         fix_dates(project)
         load_note_attribs (project)
         Formatter.begin_project(self, project)
開發者ID:dareiff,項目名稱:ofexport,代碼行數:7,代碼來源:of_to_ics.py

示例2: __init__

    def __init__ (self, out, template, time_control_default):
        Formatter.__init__(self, out, template)
        self.current_item = None
        self.time_control_default = time_control_default

        # Start and due dates are formated differently for all day tasks, need different types
        template.attrib_map_builder.type_fns['ics.date_due'] = lambda x: format_date(self.current_item, x, True)
        template.attrib_map_builder.type_fns['ics.date_to_start'] = lambda x: format_date(self.current_item, x, False)
        template.attrib_map_builder.type_fns['ics.note'] = lambda x: '\\r'.join(x.get_note_lines ())
開發者ID:alainyog,項目名稱:ofexport,代碼行數:9,代碼來源:plugin_ics.py

示例3: begin_context

 def begin_context (self, context):
     if self.last_line_was_text:
         print >> self.out
     print >>self.out, ('#' * (self.header_depth+1)),
     Formatter.begin_context(self, context)
     print >>self.out
     self.depth = 0
     self.header_depth+=1
     self.last_line_was_text = False
開發者ID:markokaestner,項目名稱:ofexport,代碼行數:9,代碼來源:of_to_md.py

示例4: begin_folder

 def begin_folder (self, folder):
     is_output = 'FolderStart' in self.template.nodes
     if self.last_line_was_text and is_output:
         print >> self.out
         self.last_line_was_text = False
     Formatter.begin_folder(self, folder)
     if is_output:
         print >>self.out
     self.depth = 0
     self.header_depth+=1
開發者ID:damicoac,項目名稱:ofexport,代碼行數:10,代碼來源:plugin_markdown.py

示例5: begin_context

 def begin_context (self, context):
     is_output = 'ContextStart' in self.template.nodes
     if self.last_line_was_text and is_output:
         print >> self.out
         self.last_line_was_text = False
     Formatter.begin_context(self, context)
     if is_output:
         print >>self.out
     self.depth = 0
     self.header_depth+=1
開發者ID:damicoac,項目名稱:ofexport,代碼行數:10,代碼來源:plugin_markdown.py

示例6: __init__

 def __init__ (self, out, template):
     attrib_conversions = {
                   'name'           : lambda x: remove_trailing_colon(x),
                   'link'           : lambda x: x,
                   'status'         : lambda x: x,
                   'flagged'        : lambda x: str(x) if x else None,
                   'context'        : lambda x: strip_brackets(''.join (x.name.split ())),
                   'project'        : lambda x: strip_brackets(''.join (x.name.split ())),
                   'date_to_start'  : lambda x: x.strftime(template.date_format),
                   'date_due'       : lambda x: x.strftime(template.date_format),
                   'date_completed' : lambda x: x.strftime(template.date_format),
                   'note'           : lambda x: ''.join([line+'\n' for line in x.get_note_lines ()])
                   }
     Formatter.__init__(self, out, template, attrib_conversions=attrib_conversions)
開發者ID:dareiff,項目名稱:ofexport,代碼行數:14,代碼來源:of_to_tp.py

示例7: __init__

 def __init__ (self, out, template):
     attrib_conversions = {
                   'id'             : lambda x: escape(x),
                   'name'           : lambda x: escape(x),
                   'link'           : lambda x: x,
                   'status'         : lambda x: x,
                   'flagged'        : lambda x: str(x) if x else None,
                   'context'        : lambda x: escape(''.join (x.name.split ())),
                   'project'        : lambda x: escape(''.join (x.name.split ())),
                   'date_to_start'  : lambda x: x.strftime(template.date_format),
                   'date_due'       : lambda x: x.strftime(template.date_format),
                   'date_completed' : lambda x: x.strftime(template.date_format),
                   'note'           : lambda x: format_note (x.get_note_lines ())
                   }
     Formatter.__init__(self, out, template, attrib_conversions = attrib_conversions)
開發者ID:dareiff,項目名稱:ofexport,代碼行數:15,代碼來源:of_to_opml.py

示例8: __init__

 def __init__ (self, out, template):
     self.current_item = None
     attrib_conversions = {
                   'id'             : lambda x: x,
                   'name'           : lambda x: x,
                   'link'           : lambda x: x,
                   'status'         : lambda x: x,
                   'flagged'        : lambda x: str(x) if x else None,
                   'context'        : lambda x: x.name,
                   'project'        : lambda x: x.name,
                   'date_to_start'  : lambda x: format_date(self.current_item,x, False),
                   'date_due'       : lambda x: format_date(self.current_item, x, True),
                   'date_completed' : lambda x: x.strftime(DATE_FORMAT_LONG),
                   'note'           : lambda x: '\\r'.join(x.get_note_lines ())
                   }
     Formatter.__init__(self, out, template, attrib_conversions = attrib_conversions)
開發者ID:dareiff,項目名稱:ofexport,代碼行數:16,代碼來源:of_to_ics.py

示例9: end_context

 def end_context (self, context):
     self.header_depth-=1
     Formatter.end_context(self, context)
開發者ID:damicoac,項目名稱:ofexport,代碼行數:3,代碼來源:plugin_markdown.py

示例10: end_task

 def end_task (self,task):
     Formatter.end_task(self, task)
     self.last_line_was_text = True
開發者ID:damicoac,項目名稱:ofexport,代碼行數:3,代碼來源:plugin_markdown.py

示例11: __init__

 def __init__ (self, out, template):
     self.current_item = None
     Formatter.__init__(self, out, template)
     
     template.attrib_map_builder.type_fns['ics.date'] = lambda x: format_date(self.current_item, x, True)
     template.attrib_map_builder.type_fns['ics.note'] = lambda x: '\\r'.join(x.get_note_lines ())
開發者ID:damicoac,項目名稱:ofexport,代碼行數:6,代碼來源:plugin_ics.py

示例12: begin_project

 def begin_project (self, project):
     if project.date_due != None or project.date_to_start != None:
         fix_dates(project)
         load_note_attribs (project, self.time_control_default)
         Formatter.begin_project(self, project)
開發者ID:alainyog,項目名稱:ofexport,代碼行數:5,代碼來源:plugin_ics.py

示例13: __init__

 def __init__ (self, out, template):
     Formatter.__init__(self, out, template)
     self.header_depth = 0
     self.depth = 0
     self.out = out
     self.last_line_was_text = False
開發者ID:damicoac,項目名稱:ofexport,代碼行數:6,代碼來源:plugin_markdown.py

示例14: end_task

 def end_task (self, task):
     if task.date_due != None or task.date_to_start != None:
         Formatter.end_task(self, task)
開發者ID:dareiff,項目名稱:ofexport,代碼行數:3,代碼來源:of_to_ics.py

示例15: begin_task

 def begin_task (self, task):
     if task.date_due != None or task.date_to_start != None:
         fix_dates(task)
         load_note_attribs (task, self.time_control_default)
         Formatter.begin_task(self, task)
開發者ID:alainyog,項目名稱:ofexport,代碼行數:5,代碼來源:plugin_ics.py


注:本文中的fmt_template.Formatter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。