Ejemplo n.º 1
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     regex = r'^!chart\s+(?P<template>{})(?:$|\s+)(?P<settings>.*)'.format(self.TEMPLATE)
     Pattern.__init__(self, regex, markdown_instance)
     self._csv = dict() # CSV DataFrame cache
     self._count = 0
     self._status = None
Ejemplo n.º 2
0
    def __init__(self, markdown_instance=None, **kwargs):
        MooseMarkdownCommon.__init__(self, **kwargs)
        Pattern.__init__(self, self.RE, markdown_instance)

        # The root/repo settings
        self._repo = kwargs.pop('repo')
        self._branch = kwargs.pop('branch')
Ejemplo n.º 3
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     regex = r'^!chart\s+(?P<template>{})(?:$|\s+)(?P<settings>.*)'.format(
         self.TEMPLATE)
     Pattern.__init__(self, regex, markdown_instance)
     self._csv = dict()  # CSV DataFrame cache
     self._count = 0
     self._status = None
Ejemplo n.º 4
0
    def __init__(self, regex, markdown_instance=None, syntax=None, **kwargs):
        MooseMarkdownCommon.__init__(self, **kwargs)
        Pattern.__init__(self, regex, markdown_instance)

        self._syntax = syntax

        # Error if the syntax was not supplied
        if not isinstance(self._syntax, dict):
            LOG.error("A dictionary of MooseApplicationSyntax objects must be supplied.")
Ejemplo n.º 5
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
Ejemplo n.º 6
0
    def __init__(self, markdown_instance=None, **kwargs):
        MooseMarkdownCommon.__init__(self, **kwargs)
        Preprocessor.__init__(self, markdown_instance)

        # Import the directly defined globals
        self._globals = kwargs.pop('globals', dict())

        # Add the defined globals from the supplied file(s)
        for filename in kwargs.pop('import'):
            self._globals.update(MooseDocs.yaml_load(os.path.join(MooseDocs.ROOT_DIR, filename)))
Ejemplo n.º 7
0
    def __init__(self, markdown_instance=None, **kwargs):
        MooseMarkdownCommon.__init__(self, **kwargs)
        Preprocessor.__init__(self, markdown_instance)

        # Import the directly defined globals
        self._globals = kwargs.pop('globals', dict())

        # Add the defined globals from the supplied file(s)
        for filename in kwargs.pop('import'):
            self._globals.update(
                MooseDocs.yaml_load(os.path.join(MooseDocs.ROOT_DIR,
                                                 filename)))
Ejemplo n.º 8
0
 def defaultSettings():
     """GoogleChartBase settings."""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (None, "The caption to place after the float heading and number.")
     settings['counter'] = ('figure', "The name of global counter to utilized for numbering.")
     settings['csv'] = (None, "The name of the CSV file to load.")
     return settings
Ejemplo n.º 9
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (
         None, "The caption text to place after the heading and number.")
     settings['counter'] = (
         'listing', "The name of global counter to utilized for numbering.")
     return settings
Ejemplo n.º 10
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['strip-header'] = (True, "When True the MOOSE header is removed for display.")
     settings['caption'] = (None, "The text caption, if an empty string is provided a link to "
                                  "the filename is created, if None is provided no caption is "
                                  "applied, otherwise the text given is used.")
     settings['language'] = (None, "The language to utilize for providing syntax highlighting.")
     settings['link'] = (True, "Include a link to the filename in the caption.")
     settings['strip-extra-newlines'] = (True, "Removes extraneous new lines from the text.")
     settings['prefix'] = ('', "Text to include prior to the included text.")
     settings['suffix'] = ('', "Text to include after to the included text.")
     settings['indent'] = (0, "The level of indenting to apply to the included text.")
     settings['strip-leading-whitespace'] = (False, "When True leading white-space is removed "
                                                    "from the included text.")
     settings['counter'] = ('listing', "The counter group to associate wit this command.")
     settings['line'] = (None, "A portion of text that unique identifies a single line to "
                               "include.")
     settings['start'] = (None, "A portion of text that unique identifies the starting "
                                "location for including text, if not provided the beginning "
                                "of the file is utilized.")
     settings['end'] = (None, "A portion of text that unique identifies the ending location "
                              "for including text, if not provided the end of the file is "
                              "used. By default this line is not included in the display.")
     settings['include-start'] = (True, "When False the texted captured by the 'start' setting "
                                        "is excluded in the displayed text.")
     settings['include-end'] = (False, "When True the texted captured by the 'end' setting is "
                                       "included in the displayed text.")
     settings['pre-style'] = ("overflow-y:scroll;max-height:350px",
                              "Style attributes to apply to the code area.")
     return settings
Ejemplo n.º 11
0
 def defaultSettings():
     """Default settings for PackagePattern"""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['arch'] = (None,
                         "The architecture to return (e.g., osx10.12)")
     settings['return'] = (None,
                           "The information to return ('link' or 'name')")
     return settings
Ejemplo n.º 12
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['id'] = (None, "The id to utilize for the generated table. If not provided, " \
                             "the command will be used.")
     settings['caption'] = (None, "The title to place above the generated table. If not " \
                                  "provided it will be generated using the command.")
     settings['counter'] = ('table', "The name of the float to associate the generated table.")
     return settings
Ejemplo n.º 13
0
 def defaultSettings():
     """MooseTableProcessor settings."""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (
         None, "The caption to place after the float heading and number.")
     settings['counter'] = (
         'table', "The name of global counter to utilized for numbering.")
     return settings
Ejemplo n.º 14
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (None, "The text for the slider caption.")
     settings['counter'] = (
         'figure',
         "The counter group that this media item belongs. This is "
         "used by float extension to provide numbered references.")
     return settings
Ejemplo n.º 15
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (None, "The caption text for the media element.")
     settings['card'] = (False, "Wrap the content in a materialize card.")
     settings['counter'] = ('figure', "The counter group that this media item belongs. This is "
                                      "used by float extension to provide numbered references. "
                                      "Set this to None to avoid counting.")
     return settings
Ejemplo n.º 16
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (
         None, "The caption text to place after the heading and number.")
     settings['counter'] = (
         'listing', "The name of global counter to utilized for numbering.")
     settings['copy-button'] = (
         True, "Enable/disable the inclusion of a copy button.")
     return settings
Ejemplo n.º 17
0
 def defaultSettings():
     """GoogleChartBase settings."""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (
         None, "The caption to place after the float heading and number.")
     settings['counter'] = (
         'figure', "The name of global counter to utilized for numbering.")
     settings['csv'] = (None, "The name of the CSV file to load.")
     return settings
Ejemplo n.º 18
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['id'] = (None, "The id to utilize for the generated table. If not provided, " \
                             "the command will be used.")
     settings['caption'] = (None, "The title to place above the generated table. If not " \
                                  "provided it will be generated using the command.")
     settings['counter'] = (
         'table', "The name of the float to associate the generated table.")
     return settings
Ejemplo n.º 19
0
 def defaultSettings():
     """Settigns for MarkdownPreprocessor"""
     settings = MooseMarkdownCommon.defaultSettings()
     l_settings = ListingPattern.defaultSettings()
     settings['re'] = (None, "Python regular expression to use for removing text, with flags " \
                             "set to MULTILINE|DOTALL.")
     settings['start'] = l_settings['start']
     settings['end'] = l_settings['end']
     settings['include-end'] = l_settings['include-end']
     return settings
Ejemplo n.º 20
0
 def defaultSettings():
     """Default settings for MooseSyntaxBase."""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['actions'] = (True, "Enable/disable action syntax lookup (this is used for "
                                  "shared syntax such as BCs/Pressure).")
     settings['objects'] = (True, "Enable/disable MooseObject syntax lookup (this is used for "
                                  "shared syntax such as BCs/Pressure).")
     settings['syntax'] = (True, "Enable/disable SyntaxNode lookup (this is needed for shared "
                                 "syntax).")
     return settings
Ejemplo n.º 21
0
 def defaultSettings():
     """Settigns for MarkdownPreprocessor"""
     settings = MooseMarkdownCommon.defaultSettings()
     l_settings = ListingPattern.defaultSettings()
     settings['re'] = (None, "Python regular expression to use for removing text, with flags " \
                             "set to MULTILINE|DOTALL.")
     settings['start'] = l_settings['start']
     settings['end'] = l_settings['end']
     settings['include-end'] = l_settings['include-end']
     return settings
Ejemplo n.º 22
0
 def defaultSettings():
     """Default settings for MooseSyntaxBase."""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['actions'] = (True, "Enable/disable action syntax lookup (this is used for "
                                  "shared syntax such as BCs/Pressure).")
     settings['objects'] = (True, "Enable/disable MooseObject syntax lookup (this is used for "
                                  "shared syntax such as BCs/Pressure).")
     settings['syntax'] = (True, "Enable/disable SyntaxNode lookup (this is needed for shared "
                                 "syntax).")
     return settings
Ejemplo n.º 23
0
 def defaultSettings():
     """Settings for SQARequirement"""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['title'] = ('', "Title to assign to the list of items.")
     settings['require-markdown'] = (False, "")
     settings['status'] = (False, "When enabled with 'require-markdown' the status of the " \
                                  "page is added to the list.")
     settings['markdown-folder'] = ('', "When supplied the value provided should be a " \
                                        "directory relative to the repository root directory " \
                                        "where the required files are located " \
                                        "(require-markdown must be enabled).")
     return settings
Ejemplo n.º 24
0
    def __sub(self, match):
        """
        Substitution method for regex replacement.
        """

        name = match.group('name')
        markdown = match.group('markdown')
        settings = self.getSettings(match.group('settings'))

        # Use the content in database
        if name in self.__database:
            div = etree.Element('div')
            div.set('markdown', '1')
            item = self.__database[name]
            div.text = item.markdown

        # Use the default
        elif settings['default']:
            div = etree.Element('div')
            div.set('markdown', '1')
            div.text = markdown

        # Produce error
        else:

            help_div = etree.Element('div')
            heading = etree.SubElement(help_div, 'h3')
            heading.text = "Adding Markdown for '{}' Item.".format(name)

            p = etree.SubElement(help_div, 'p')
            p.text = "To add content for the '{}' item, simply add a block similar to what is ' \
                     'shown below in the markdown file '{}'.".format(
                name, self.markdown.current.filename)

            pre = etree.SubElement(help_div, 'pre')
            code = etree.SubElement(pre, 'code')
            code.set('class', 'language-text')
            code.text = '!SQA item {}\nThe content placed here should be valid markdown that ' \
                        'will replace the template description.\n!END'.format(name)

            title = 'Missing Template Item: {}'.format(name)
            div = MooseMarkdownCommon.createErrorElement(title=title,
                                                         message=markdown,
                                                         markdown=True,
                                                         help_button=help_div)

        return etree.tostring(div)
Ejemplo n.º 25
0
 def getItems(filename, key):
     """
     Extract the matrix items from a markdown file.
     """
     out = collections.defaultdict(list)
     with open(filename) as fid:
         for match in SQAInputTags.RE.finditer(fid.read()):
             if key == match.group('key'):
                 options = dict(title='')
                 settings = MooseMarkdownCommon.getSettingsHelper(options,
                                                                  match.group('settings'),
                                                                  legacy_style=False)
                 title = settings['title']
                 for item in match.group('items').split('\n'):
                     tag_id, text = re.split(r'\s+', item.strip(), maxsplit=1)
                     out[title].append((tag_id, text))
     return out
Ejemplo n.º 26
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['groups'] = (None, "The configured 'groups' to include.")
     return settings
Ejemplo n.º 27
0
 def __init__(self, parser, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, parser)
Ejemplo n.º 28
0
 def __init__(self, regex, markdown_instance=None, syntax=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Pattern.__init__(self, regex, markdown_instance)
     self._syntax = syntax
     self.__cache = dict()
Ejemplo n.º 29
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (None, "The caption text to place after the heading and number.")
     settings['counter'] = ('listing', "The name of global counter to utilized for numbering.")
     settings['copy-button'] = (True, "Enable/disable the inclusion of a copy button.")
     return settings
Ejemplo n.º 30
0
    def __init__(self, markdown_instance=None, **kwargs):
        MooseMarkdownCommon.__init__(self, **kwargs)
        Pattern.__init__(self, self.RE, markdown_instance)

        # Load the yaml data containing package information
        self.package = MooseDocs.yaml_load(kwargs.pop('package_file'))
Ejemplo n.º 31
0
 def __init__(self, markdown_instance=None, syntax=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Pattern.__init__(self, self.RE, markdown_instance)
     self._syntax = syntax
     self._install = kwargs.get('install')
Ejemplo n.º 32
0
 def __init__(self, markdown_instance=None, **config):
     MooseMarkdownCommon.__init__(self, **config)
     FencedBlockPreprocessor.__init__(self, markdown_instance)
     self._remove = []
Ejemplo n.º 33
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Preprocessor.__init__(self, markdown_instance)
     self._globals = kwargs.pop('globals', dict())
Ejemplo n.º 34
0
 def defaultSettings():
     """MooseTableProcessor settings."""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (None, "The caption to place after the float heading and number.")
     settings['counter'] = ('table', "The name of global counter to utilized for numbering.")
     return settings
Ejemplo n.º 35
0
 def defaultSettings():
     """Settings for AdmonitionBlock"""
     settings = MooseMarkdownCommon.defaultSettings()
     return settings
Ejemplo n.º 36
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, markdown_instance.parser)
     self.markdown = markdown_instance
Ejemplo n.º 37
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Pattern.__init__(self, self.RE, markdown_instance)
Ejemplo n.º 38
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     return settings
Ejemplo n.º 39
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Pattern.__init__(self, self.RE, markdown_instance)
Ejemplo n.º 40
0
 def __init__(self, markdown_instance=None, syntax=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Pattern.__init__(self, self.RE, markdown_instance)
     self._syntax = syntax
     self._install = kwargs.get('install')
Ejemplo n.º 41
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Preprocessor.__init__(self, markdown_instance)
Ejemplo n.º 42
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Preprocessor.__init__(self, markdown_instance)
Ejemplo n.º 43
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Preprocessor.__init__(self, markdown_instance)
     self._macro_files = kwargs.pop('macro_files', None)
     self._bibtex = None
     self._citations = []
Ejemplo n.º 44
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['caption'] = (None, "The caption text to place after the heading and number.")
     settings['counter'] = ('listing', "The name of global counter to utilized for numbering.")
     return settings
Ejemplo n.º 45
0
 def defaultSettings():
     """Default settings for PackagePattern"""
     settings = MooseMarkdownCommon.defaultSettings()
     settings['arch'] = (None, "The architecture to return (e.g., osx10.12)")
     settings['return'] = (None, "The information to return ('link' or 'name')")
     return settings
Ejemplo n.º 46
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     TableProcessor.__init__(self, markdown_instance.parser)
Ejemplo n.º 47
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self)
     Preprocessor.__init__(self, markdown_instance)
     self.__database = None
     self._template_args = kwargs
Ejemplo n.º 48
0
 def __init__(self, parser, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     BlockProcessor.__init__(self, parser)
Ejemplo n.º 49
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     settings['status'] = (False, "When True status badge(s) are created that display the "
                                  "status of the linked page.")
     return settings
Ejemplo n.º 50
0
 def __init__(self, markdown_instance=None, **kwargs):
     MooseMarkdownCommon.__init__(self, **kwargs)
     Preprocessor.__init__(self, markdown_instance)
     self._macro_files = kwargs.pop('macro_files', None)
     self._bibtex = None
     self._citations = []
Ejemplo n.º 51
0
 def defaultSettings():
     settings = MooseMarkdownCommon.defaultSettings()
     return settings