コード例 #1
0
    def __init__(self):

        self.slide_id_name = ""
        sid = Optional(brackets)("slide_id") 
        sid.setParseAction(self.process_slide_id)

        mark_sep = match_at_least_n("=",4)
        marker_V = Combine(mark_sep + match_at_least_n("*",1)) + sid
        marker_P = Combine(mark_sep + match_at_least_n("+",1)) 
        marker_H = (~(marker_V|marker_P) + mark_sep) + sid

        h_block = Combine(OneOrMore(~marker_H + 
                                     SkipTo(LineEnd(),include=True)))
        h_block.setParseAction(self.process_h_block)
        self.hg = delimitedList(h_block, delim=marker_H)

        v_block = Combine(OneOrMore(~marker_V + 
                                     SkipTo(LineEnd(),include=True)))
        v_block.setParseAction(self.process_v_block)
        self.vg = delimitedList(v_block, delim=marker_V)

        p_block = Combine(OneOrMore(~marker_P + 
                                     SkipTo(LineEnd(),include=True)))
        p_block.setParseAction(self.process_p_block)
        self.pg = delimitedList(p_block, delim=marker_P)

        self.slide_grammar = markdown_multiline()
        self.grammar = self.hg
コード例 #2
0
ファイル: slides.py プロジェクト: thoppe/md2reveal
    def __init__(self):

        self.slide_id_name = ""
        sid = Optional(brackets)("slide_id") 
        sid.setParseAction(self.process_slide_id)

        self.background_img   = ""
        self.background_trans = ""
        self.background_size  = ""
        self.data_trans = ""

        img_g   = Literal("!").suppress() + paren
        backimg = Optional(img_g)("background")
        backimg.setParseAction(self.process_background)

        options = double_angles('options') 
        options.setParseAction(self.process_slide_options)

        mark_sep = match_at_least_n("=",4)
        marker_V = (Combine(mark_sep + match_at_least_n("*",1)) 
                    + sid + backimg + Optional(options))

        marker_P = Combine(mark_sep + match_at_least_n("+",1)) 
        marker_H = ((~(marker_V|marker_P) + mark_sep) 
                    + sid + backimg + Optional(options))

        h_block = Combine(OneOrMore(~marker_H + ~options +
                                     SkipTo(LineEnd(),include=True)))
        h_block.setParseAction(self.process_h_block)
        self.hg = delimitedList(h_block, delim=marker_H)

        v_block = Combine(OneOrMore(~marker_V + ~options +
                                     SkipTo(LineEnd(),include=True)))
        v_block.setParseAction(self.process_v_block)
        self.vg = delimitedList(v_block, delim=marker_V)

        p_block = Combine(OneOrMore(~marker_P + 
                                     SkipTo(LineEnd(),include=True)))
        p_block.setParseAction(self.process_p_block)
        self.pg = delimitedList(p_block, delim=marker_P)

        self.slide_grammar = markdown_multiline()
        self.grammar = self.hg      
コード例 #3
0
ファイル: slides.py プロジェクト: ysire/md2reveal
    def __init__(self):

        self.slide_id_name = ""
        sid = Optional(brackets)("slide_id")
        sid.setParseAction(self.process_slide_id)

        self.background_img = ""
        self.background_trans = ""
        self.background_size = ""
        self.data_trans = ""

        img_g = Literal("!").suppress() + paren
        backimg = Optional(img_g)("background")
        backimg.setParseAction(self.process_background)

        options = double_angles('options')
        options.setParseAction(self.process_slide_options)

        mark_sep = match_at_least_n("=", 4)
        marker_V = (Combine(mark_sep + match_at_least_n("*", 1)) + sid +
                    backimg + Optional(options))

        marker_P = Combine(mark_sep + match_at_least_n("+", 1))
        marker_H = ((~(marker_V | marker_P) + mark_sep) + sid + backimg +
                    Optional(options))

        h_block = Combine(
            OneOrMore(~marker_H + ~options + SkipTo(LineEnd(), include=True)))
        h_block.setParseAction(self.process_h_block)
        self.hg = delimitedList(h_block, delim=marker_H)

        v_block = Combine(
            OneOrMore(~marker_V + ~options + SkipTo(LineEnd(), include=True)))
        v_block.setParseAction(self.process_v_block)
        self.vg = delimitedList(v_block, delim=marker_V)

        p_block = Combine(
            OneOrMore(~marker_P + SkipTo(LineEnd(), include=True)))
        p_block.setParseAction(self.process_p_block)
        self.pg = delimitedList(p_block, delim=marker_P)

        self.slide_grammar = markdown_multiline()
        self.grammar = self.hg