本文整理汇总了Python中MooseDocs.load_config方法的典型用法代码示例。如果您正苦于以下问题:Python MooseDocs.load_config方法的具体用法?Python MooseDocs.load_config怎么用?Python MooseDocs.load_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MooseDocs
的用法示例。
在下文中一共展示了MooseDocs.load_config方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def setUpClass(cls):
"""
Create the markdown parser using the configuration file.
"""
super(MarkdownTestCase, cls).setUpClass()
# Setup logging
cls._stream = StringIO.StringIO()
cls._formatter = init_logging(stream=cls._stream)
# Define the local directory
cls._path = os.path.abspath(os.path.dirname(inspect.getfile(cls)))
# Read the YAML configurations
config = MooseMarkdown.getDefaultExtensions()
config.update(MooseDocs.load_config(os.path.join(MooseDocs.MOOSE_DIR, 'docs', cls.CONFIG)))
# Update extension list
if cls.EXTENSIONS:
for key in config:
if key not in cls.EXTENSIONS:
config.pop(key)
cls.updateExtensions(config)
cls.parser = MooseMarkdown(config, default=False)
示例2: setUpClass
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def setUpClass(cls):
"""
Create link database.
"""
config = MooseDocs.load_config(os.path.join(MooseDocs.MOOSE_DIR, 'docs', 'website.yml'))
options = config['MooseDocs.extensions.app_syntax']
cls.database = MooseLinkDatabase(repo=options['repo'], links=options['links'])
示例3: check
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def check(config_file=None, locations=None, generate=None):
"""
Performs checks and optionally generates stub pages for missing documentation.
"""
# Read the configuration
app_ext = 'MooseDocs.extensions.app_syntax'
config = MooseDocs.load_config(config_file)
if app_ext not in config:
mooseutils.MooseException("The 'check' utility requires the 'app_syntax' extension.")
ext_config = config[app_ext]
# Run the executable
exe = MooseDocs.abspath(ext_config['executable'])
if not os.path.exists(exe):
raise IOError('The executable does not exist: {}'.format(exe))
else:
LOG.debug("Executing %s to extract syntax.", exe)
raw = mooseutils.runExe(exe, '--yaml')
yaml = mooseutils.MooseYaml(raw)
# Populate the syntax
for loc in ext_config['locations']:
for key, value in loc.iteritems():
if (locations is None) or (key in locations):
value['group'] = key
syntax = common.MooseApplicationSyntax(yaml, generate=generate,
install=ext_config['install'], **value)
LOG.info("Checking documentation for '%s'.", key)
syntax.check()
return None
示例4: presentation
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def presentation(config_file=None, md_file=None, serve=None, port=None, host=None, template=None,
**template_args):
"""
MOOSE markdown presentation blaster.
"""
# The markdown file is provided via the command line, thus it is provided relative to the
# current working directory. The internals of MooseDocs are setup to always work from the
# repository root directory (i.e., MooseDocs.ROOT_DIR), thus the path of this file must be
# converted to be relative to MooseDocs.ROOT_DIR.
md_file = os.path.relpath(os.path.abspath(md_file), MooseDocs.ROOT_DIR)
# Create the markdown parser
config = MooseDocs.load_config(config_file, template=template, template_args=template_args)
parser = MooseMarkdown(config)
# Build the html
builder = PresentationBuilder(md_file=md_file, parser=parser)
builder.init()
builder.build(num_threads=1)
if serve:
server = livereload.Server()
server.watch(os.path.join(MooseDocs.ROOT_DIR, md_file),
lambda: builder.build(num_threads=1))
server.serve(root=builder.rootDirectory(), host=host, port=port, restart_delay=0)
return 0
示例5: latex
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def latex(config_file=None, output=None, md_file=None, **kwargs):
"""
Command for converting markdown file to latex.
"""
# Load the YAML configuration file
config = MooseDocs.load_config(config_file, **kwargs)
parser = MooseDocs.MooseMarkdown(extensions=config.keys(), extension_configs=config)
site_dir, _ = os.path.splitext(md_file)
root = LatexBuilder(output, name='', markdown=md_file, parser=parser, site_dir=site_dir)
root.build()
return None
示例6: check
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def check(config_file=None, generate=None, update=None, dump=None, template=None, groups=None,
**template_args):
"""
Performs checks and optionally generates stub pages for missing documentation.
"""
# Create the markdown parser and get the AppSyntaxExtension
config = MooseDocs.load_config(config_file, template=template, template_args=template_args)
parser = MooseMarkdown(config)
ext = parser.getExtension(AppSyntaxExtension)
syntax = ext.getMooseAppSyntax()
# Dump the complete syntax tree if desired
if dump:
print syntax
# Check all nodes for documentation
for node in syntax.findall():
node.check(ext.getConfig('install'), generate=generate, groups=groups, update=update)
return 0
示例7: setUpClass
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def setUpClass(cls):
"""
Create the markdown parser using the configuration file.
"""
# Define the local directory
cls._path = os.path.abspath(os.path.dirname(inspect.getfile(cls)))
# Create the markdown object
os.chdir(os.path.join(MooseDocs.MOOSE_DIR, 'docs'))
# Read the YAML configurations
config = MooseDocs.load_config(cls.CONFIG)
# Update extension list
if cls.EXTENSIONS:
for key in config:
if key not in cls.EXTENSIONS:
config.pop(key)
cls.updateExtensions(config)
cls.parser = MooseDocs.MooseMarkdown(extensions=config.keys(), extension_configs=config)
os.chdir(cls.WORKING_DIR)
示例8: latex
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def latex(config_file=None, output=None, md_file=None, template=None, **template_args):
"""
Command for converting markdown file to latex.
"""
LOG.warning("The latex command is experimental and requires additional development to be "
"complete, please be patient as this develops.\nIf you would like to aid in "
"improving this feature please contact the MOOSE mailing list: "
"[email protected]")
# The markdown file is provided via the command line, thus it is provided relative to the
# current working directory. The internals of MooseDocs are setup to always work from the
# repository root directory (i.e., MooseDocs.ROOT_DIR), thus the path of this file must be
# converted to be relative to MooseDocs.ROOT_DIR.
md_file = os.path.relpath(os.path.abspath(md_file), MooseDocs.ROOT_DIR)
# Create the markdown parser
config = MooseDocs.load_config(config_file, template=template, template_args=template_args)
parser = MooseMarkdown(config)
# Build the html
builder = LatexBuilder(md_file=md_file, output=output, parser=parser)
builder.init()
builder.build(num_threads=1)
return 0
示例9: build
# 需要导入模块: import MooseDocs [as 别名]
# 或者: from MooseDocs import load_config [as 别名]
def build(config_file=None, site_dir=None, num_threads=None, no_livereload=False, content=None,
dump=False, clean=False, serve=False, host=None, port=None, template=None, init=False,
**template_args):
"""
The main build command.
"""
if serve:
clean = True
site_dir = os.path.abspath(os.path.join(MooseDocs.TEMP_DIR, 'site'))
# Clean/create site directory
if clean and os.path.exists(site_dir):
LOG.info('Cleaning build directory: %s', site_dir)
shutil.rmtree(site_dir)
# Create the "temp" directory
if not os.path.exists(site_dir):
os.makedirs(site_dir)
# Check submodule for large_media
if MooseDocs.ROOT_DIR == MooseDocs.MOOSE_DIR:
status = submodule_status()
if status['docs/content/media/large_media'] == '-':
if init:
subprocess.call(['git', 'submodule', 'update', '--init',
'docs/content/media/large_media'], cwd=MooseDocs.MOOSE_DIR)
else:
LOG.warning("The 'large_media' submodule for storing images above 1MB is not "
"initialized, thus some images will not be visible within the "
"generated website. Run the build command with the --init flag to "
"initialize the submodule.")
# Check media files size
if MooseDocs.ROOT_DIR == MooseDocs.MOOSE_DIR:
media = os.path.join(MooseDocs.MOOSE_DIR, 'docs', 'content', 'media')
ignore = set()
for base, _, files in os.walk(os.path.join(media, 'large_media')):
for name in files:
ignore.add(os.path.join(base, name))
large = mooseutils.check_file_size(base=media, ignore=ignore)
if large:
msg = "Media files above the limit of 1 MB detected, these files should be stored in " \
"large media repository (docs/content/media/large_media):"
for name, size in large:
msg += '\n{}{} ({:.2f} MB)'.format(' '*4, name, size)
LOG.error(msg)
# Create the markdown parser
config = MooseDocs.load_config(config_file, template=template, template_args=template_args)
parser = MooseMarkdown(config)
# Create the builder object and build the pages
builder = WebsiteBuilder(parser=parser, site_dir=site_dir, content=content)
builder.init()
if dump:
print builder
return None
builder.build(num_threads=num_threads)
# Serve
if serve:
if not no_livereload:
server = livereload.Server(watcher=MooseDocsWatcher(builder, num_threads))
else:
server = livereload.Server()
server.serve(root=site_dir, host=host, port=port, restart_delay=0)
return 0