def __init__(self, config, md):
        """Initialize."""

        self.script = config.get('insert_as_script', False)
        wrap = config.get('tex_block_wrap', ['\\[', '\\]'])
        self.wrap = wrap[0] + '%s' + wrap[1]

        allowed_patterns = set(
            config.get('block_syntax', ['dollar', 'square', 'begin']))
        pattern = []
        if 'dollar' in allowed_patterns:
            pattern.append(self.RE_DOLLAR_BLOCK)
        if 'square' in allowed_patterns:
            pattern.append(self.RE_BRACKET_BLOCK)
        if 'begin' in allowed_patterns:
            pattern.append(self.RE_TEX_BLOCK)

        self.match = None
        if pattern:
            self.pattern = re.compile(r'(?s)^(?:%s)[ ]*$' % '|'.join(pattern))
        else:
            self.pattern = None
        self.markdown = md

        BlockProcessor.__init__(self, md.parser)
示例#2
0
 def __init__(self, parser, config):
     BlockProcessor.__init__(self, parser)
     self.row_class = config["row_class"]
     Columns.noflow_cell_width_template = config[
         CONFIG_CELL_NOFLOW_WIDTH_CLASS_TEMPLATE
     ]
     Columns.cell_width_template = config[CONFIG_CELL_WIDTH_CLASS_TEMPLATE]
示例#3
0
 def __init__(self, parser, md_globals):
     BlockProcessor.__init__(self, parser)
     self.md_globals = md_globals
     if "pvman" not in md_globals:
         md_globals['pvman'] = {
             'svg_id': 0,
             'template': self.loadTemplate()
         }
示例#4
0
    def __init__(self, md, graphviz=None, ext='svg', **kwargs):
        MooseMarkdownCommon.__init__(self, **kwargs)
        BlockProcessor.__init__(self, md)

        # Location of the graphviz
        self._graphviz = graphviz

        # Output extension
        self._ext = ext
示例#5
0
  def __init__(self, md, graphviz=None, ext='svg', **kwargs):
    MooseCommonExtension.__init__(self, **kwargs)
    BlockProcessor.__init__(self, md)

    # Location of the graphviz
    self._graphviz = graphviz

    # Output extension
    self._ext = ext
示例#6
0
  def __init__(self, parser, **kwargs):
    MooseCommonExtension.__init__(self, **kwargs)
    BlockProcessor.__init__(self, parser)

    # The default settings
    self._settings = {'caption'  : None,
                      'interval' : None,
                      'pause'    : None,
                      'wrap'     : None,
                      'keyboard' : None}
示例#7
0
  def __init__(self, parser, **kwargs):
   MooseCommonExtension.__init__(self, **kwargs)
   BlockProcessor.__init__(self, parser)

   # The default settings
   self._settings = {'caption'  : None,
            'interval' : None,
            'pause'    : None,
            'wrap'     : None,
            'keyboard' : None}
示例#8
0
    def __init__(self, parser, md, configs):
        BlockProcessor.__init__(self, parser)
        self.md = md
        self.configs = configs

        self.processors = (FigureParser(configs["IGNORING_IMG"]),
                           EquationParser(), CodeParser(md), TableParser(),
                           VideoParser(), QuoteParser())
        self.RE = re.compile(
            ur'(^|(?<=\n))((?P<typelegend>Figure|Table|Code|Equation|Video|Source)\s?)*\:\s?(?P<txtlegend>.*?)(\n|$)'
        )
示例#9
0
    def __init__(self, parser):
        BlockProcessor.__init__(self, parser)

        exprs = (("->", "right"), ("<-", "center"))

        self.REStart = re.compile(r'(^|\n)' + re.escape('->'))
        self._ending_re = [
            re.compile(re.escape(end_expr) + r'(\n|$)')
            for end_expr, _ in exprs
        ]
        self._kind_align = [kind_align for _, kind_align in exprs]
示例#10
0
    def __init__(self, parser, root=None, **kwargs):
      MooseCommonExtension.__init__(self)
      BlockProcessor.__init__(self, parser, **kwargs)

      self._root = os.path.join(root, 'docs/media')

      # The default settings
      self._settings = {'caption'  : None,
                        'interval' : None,
                        'pause'    : None,
                        'wrap'     : None,
                        'keyboard' : None}
示例#11
0
    def __init__(self, parser, md, configs):
        BlockProcessor.__init__(self, parser)
        self.md = md
        self.configs = configs

        self.processors = ( FigureParser(configs["IGNORING_IMG"]),
                            EquationParser(),
                            CodeParser(md),
                            TableParser(),
                            VideoParser(),
                            QuoteParser())
        self.RE = re.compile(r'(^|(?<=\n))((?P<typelegend>Figure|Table|Code|Equation|Video|Source)\s?)*\:\s?(?P<txtlegend>.*?)(\n|$)')
示例#12
0
    def __init__(self, pattern, config, latex2svg, md):
        """Initialize."""

        self.display_class = config.get('display_class', '')
        self.latex2svg = latex2svg
        self.md = md
        self.checked_for_deps = False
        self.use_attr_list = False  # will be set in run(), we'll know all extensions have been initialized by then

        self.match = None
        self.pattern = re.compile(pattern)

        BlockProcessor.__init__(self, md.parser)
示例#13
0
    def __init__(self, parser, root=None, **kwargs):
        MooseCommonExtension.__init__(self)
        BlockProcessor.__init__(self, parser, **kwargs)

        self._root = os.path.join(root, 'docs/media')

        # The default settings
        self._settings = {
            'caption': None,
            'interval': None,
            'pause': None,
            'wrap': None,
            'keyboard': None
        }
示例#14
0
    def __init__(self, pattern, config, md):
        """Initialize."""

        # Generic setup
        self.generic = config.get('generic', False)
        wrap = config.get('tex_block_wrap', ['\\[', '\\]'])
        self.wrap = wrap[0] + '%s' + wrap[1]

        # Default setup
        self.preview = config.get('preview', False)

        self.match = None
        self.pattern = re.compile(pattern)

        BlockProcessor.__init__(self, md.parser)
    def __init__(self, pattern, config, md):
        """Initialize."""

        # Generic setup
        self.generic = config.get('generic', False)
        wrap = config.get('tex_block_wrap', ['\\[', '\\]'])
        self.wrap = wrap[0] + '%s' + wrap[1]

        # Default setup
        self.preview = config.get('preview', False)

        self.match = None
        self.pattern = re.compile(pattern)

        BlockProcessor.__init__(self, md.parser)
    def __init__(self, pattern, config, md):
        """Initialize."""

        # Generic setup
        self.generic = config.get('generic', False)
        wrap = config.get('tex_block_wrap', ['\\[', '\\]'])
        self.wrap = (wrap[0].replace('{', '}}').replace('}', '}}') + '{}' +
                     wrap[1].replace('{', '}}').replace('}', '}}'))
        self.block_tag = config.get('block_tag', 'div')

        # Default setup
        self.preview = config.get('preview', False)

        self.match = None
        self.pattern = re.compile(pattern)

        BlockProcessor.__init__(self, md.parser)
示例#17
0
    def __init__(self, config, md):
        """Initialize."""

        self.script = config.get('insert_as_script', False)
        wrap = config.get('tex_block_wrap', ['\\[', '\\]'])
        self.wrap = wrap[0] + '%s' + wrap[1]

        allowed_patterns = set(config.get('block_syntax', ['dollar', 'square', 'begin']))
        pattern = []
        if 'dollar' in allowed_patterns:
            pattern.append(self.RE_DOLLAR_BLOCK)
        if 'square' in allowed_patterns:
            pattern.append(self.RE_BRACKET_BLOCK)
        if 'begin' in allowed_patterns:
            pattern.append(self.RE_TEX_BLOCK)

        self.match = None
        if pattern:
            self.pattern = re.compile(r'(?s)^(?:%s)[ ]*$' % '|'.join(pattern))
        else:
            self.pattern = None
        self.markdown = md

        BlockProcessor.__init__(self, md.parser)
示例#18
0
文件: MooseCSS.py 项目: gnsteve/moose
 def __init__(self, parser, **kwargs):
  MooseCommonExtension.__init__(self, **kwargs)
  BlockProcessor.__init__(self, parser)
示例#19
0
    def __init__(self, parser, pack):
        BlockProcessor.__init__(self, parser)

        self._pack = pack
        self._first = True
示例#20
0
文件: css.py 项目: zachmprince/moose
 def __init__(self, parser, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, parser)
 def __init__(self, parser, md_globals):
     BlockProcessor.__init__(self, parser)
     self.md_globals = md_globals
     if "pvman" not in md_globals:
         md_globals['pvman'] = {'svg_id': 0,
                                'template': self.loadTemplate()}
 def __init__(self, *args, **kwargs):
   self._last_parent = None
   BlockProcessor.__init__(self, *args, **kwargs)
示例#23
0
 def __init__(self, parser):
     BlockProcessor.__init__(self, parser)
     self.re = re.compile(r'(?:^|\n)\$\$.+\$\$(\n|$)',
                          re.DOTALL | re.MULTILINE | re.UNICODE)
示例#24
0
    def __init__(self, parser, pack):
        BlockProcessor.__init__(self, parser)

        self.pack = pack
示例#25
0
 def __init__(self, parser):
     BlockProcessor.__init__(self, parser)
     self.re = re.compile(r'(?:^|\n)\$\$.+\$\$(\n|$)', re.DOTALL | re.MULTILINE | re.UNICODE)
示例#26
0
    def __init__(self, parser):
        BlockProcessor.__init__(self, parser)

        md = parser.markdown
        if not hasattr(md, 'Meta'):
            setattr(md, 'Meta', MetaDict())
示例#27
0
	def __init__(self, configs, *args, **kwargs):
		self.configs = dict(configs)
		BlockProcessor.__init__(self, *args, **kwargs)
		
		# LaTeX preamble
		self.preamble = ""
示例#28
0
    def __init__(self, parser, pack):
        BlockProcessor.__init__(self, parser)

        self._pack = pack
        self._first = True
 def __init__(self, md_parser, config):
     """Class initialization"""
     self.config = config
     BlockProcessor.__init__(self, md_parser)
示例#30
0
 def __init__(self, parser):
     self.border = False
     self.separator = ''
     BlockProcessor.__init__(self, parser)
示例#31
0
 def __init__(self, parser,repart, classType):
     BlockProcessor.__init__(self,parser)
     self.classType = classType
     self.RE = re.compile( r'(?:^|\n)\[\[' + repart + r'\]\](\n|$)')
示例#32
0
 def __init__(self, parser, cls=None):
     BlockProcessor.__init__(self, parser)
     self.cls = cls
示例#33
0
 def __init__(self, md, section_cls='section'):
     self.section_cls = section_cls
     BlockProcessor.__init__(self, md)
示例#34
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, markdown_instance.parser)
     self.markdown = markdown_instance
示例#35
0
    def __init__(self, parser, startExpr, endExpr, contentAlign):
        BlockProcessor.__init__(self, parser)

        self.REStart = re.compile(r'(^|\n)' + re.escape(startExpr))
        self.REEnd = re.compile(re.escape(endExpr) + r'(\n|$)')
        self.contentAlign = contentAlign
示例#36
0
 def __init__(self, parser, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, parser)
示例#37
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, markdown_instance.parser)
     self.markdown = markdown_instance
示例#38
0
 def __init__(self, parser, md):
     BlockProcessor.__init__(self, parser)
     self.md = md
     self.RE = re.compile(r'(^|\n)((?P<typelegend>Figure|Table|Code|Equation|Video|Source)[ ]{0,1})*\:[ ]{0,1}(?P<txtlegend>.*?)(\n|$)')
示例#39
0
 def __init__(self, parser, **kwargs):
     MooseCommonExtension.__init__(self, **kwargs)
     BlockProcessor.__init__(self, parser)
示例#40
0
    def __init__(self, parser, pack):
        BlockProcessor.__init__(self, parser)

        self.pack = pack
示例#41
0
 def __init__(self, md, patt, width, height):
     BlockProcessor.__init__(self, md.parser)
     self.md = md
     self.width = width
     self.height = height
     self.RE = re.compile(patt)
示例#42
0
 def __init__(self, parser):
     BlockProcessor.__init__(self,parser)
     self.nested_proofs = 0
示例#43
0
 def __init__(self, parser, repart, classType):
     BlockProcessor.__init__(self, parser)
     self.classType = classType
     self.RE = re.compile(r'(?:^|\n)\[\[' + repart + r'\]\](\n|$)')
示例#44
0
 def __init__(self, parser, md):
     BlockProcessor.__init__(self, parser)
     self.md = md
     self.RE = re.compile(
         r'(^|\n)((?P<typelegend>Figure|Table|Code|Equation|Video|Source)[ ]{0,1})*\:[ ]{0,1}(?P<txtlegend>.*?)(\n|$)'
     )
示例#45
0
    def __init__(self, md):
        """Initialize."""

        BlockProcessor.__init__(self, md.parser)
        self.markdown = md
示例#46
0
    def __init__(self, parser, startExpr, endExpr, contentAlign):
        BlockProcessor.__init__(self, parser)

        self.REStart = re.compile(r'(^|\n)' + re.escape(startExpr))
        self.REEnd   = re.compile(re.escape(endExpr) + r'(\n|$)')
        self.contentAlign = contentAlign
	def __init__(self, parser, num_root):
		#super(MyBlockParser, self).__init__(parser)
		BlockProcessor.__init__(self, parser)
		self.num_current = num_root
		self.num_root_depth = len(num_root)
示例#48
0
    def __init__(self, configs, *args, **kwargs):
        self.configs = dict(configs)
        BlockProcessor.__init__(self, *args, **kwargs)

        # LaTeX preamble
        self.preamble = ""
示例#49
0
 def __init__(self, md, section_cls='section'):
     self.section_cls = section_cls
     BlockProcessor.__init__(self, md)
示例#50
0
 def __init__(self, *args, **kwargs):
     self._last_parent = None
     BlockProcessor.__init__(self, *args, **kwargs)