Skip to content

Commit

Permalink
Updates for application support (refs #12528)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeslaughter committed Nov 27, 2018
1 parent a4b0362 commit 13e04ab
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions python/MooseDocs/base/renderers.py
Expand Up @@ -251,8 +251,8 @@ def defaultConfig():

def __init__(self, *args, **kwargs):
HTMLRenderer.__init__(self, *args, **kwargs)
self.__navigation = None # Cache for navigation pages
self.__index = False # page index created
self.__navigation = None # cache for navigation pages
self.__index = False # page index created

self.addCSS('materialize', "contrib/materialize/materialize.min.css",
media="screen,projection")
Expand Down
2 changes: 0 additions & 2 deletions python/MooseDocs/commands/build.py
Expand Up @@ -99,7 +99,6 @@ def __init__(self, translator, options, *args, **kwargs):

def build(self):
"""Build the necessary pages based on the current filepath."""
print 'HERE:', self.filepath

# Locate the page to be translated
page = self._getPage(self.filepath)
Expand All @@ -114,7 +113,6 @@ def build(self):
if page.uid in uids:
nodes.append(node)

print 'PAGE:', nodes
self._translator.execute(self._options.num_threads, nodes)

def _getPage(self, source):
Expand Down
3 changes: 2 additions & 1 deletion python/MooseDocs/extensions/appsyntax.py
Expand Up @@ -394,7 +394,7 @@ def createHeading(self, parent, page, **kwargs):
if self.settings['heading'] == u'AUTO':
h = ['Objects', 'Actions', 'Subsystems']
idx = [self.settings['objects'], self.settings['actions'], self.settings['subsystems']]
names = [h[i] for i in idx if i]
names = [h[i] for i, v in enumerate(idx) if v]
if len(names) == 1:
self.settings['heading'] = u'Available {}'.format(*names)
elif len(names) == 2:
Expand Down Expand Up @@ -434,6 +434,7 @@ def defaultSettings():
settings = SyntaxListCommand.defaultSettings()
settings['group'] = (None, "The group (app) to limit the complete syntax list.")
settings['level'] = (2, "Beginning heading level.")
settings['heading'] = (None, settings['heading'][1])
return settings

def createTokenFromSyntax(self, parent, info, page, obj):
Expand Down
26 changes: 15 additions & 11 deletions python/MooseDocs/extensions/content.py
Expand Up @@ -50,24 +50,28 @@ def defaultSettings():

def createToken(self, parent, info, page):

location = self.settings['location']
tree = dict()
tree[(u'',)] = core.UnorderedList(parent, browser_default=False)
func = lambda p: p.local.startswith(location) and isinstance(p, pages.Directory)
for node in self.translator.findPages(func):
key = tuple(node.local.strip(os.sep).replace(location, '').split(os.sep))
if key not in tree:
col = Collapsible(tree[key[:-1]], summary=key[-1])
li = core.ListItem(col, class_='moose-source-item', tooltip=False)
tree[key] = core.UnorderedList(li, browser_default=False)

location = self.settings['location']

func = lambda p: p.local.startswith(location) and isinstance(p, pages.Source)
for node in self.translator.findPages(func):
dname = os.path.dirname(node.local).strip(os.sep)
key = tuple(dname.replace(location, '').split(os.sep))
nodes = self.translator.findPages(func)
for node in nodes:
key = tuple(node.local.strip(os.sep).replace(location, '').split(os.sep))[:-1]
for i in xrange(1, len(key) + 1):
k = key[:i]
if k not in tree:
col = Collapsible(tree[k[:-1]], summary=k[-1])
li = core.ListItem(col, class_='moose-source-item', tooltip=False)
tree[k] = core.UnorderedList(li, browser_default=False)

for node in nodes:
key = tuple(node.local.strip(os.sep).replace(location, '').split(os.sep))[:-1]
loc = node.relativeDestination(page)
li = core.ListItem(tree[key])
core.Link(li, url=loc, string=node.name, class_='moose-source-item', tooltip=False)

return parent

class AtoZCommand(command.CommandComponent):
Expand Down
2 changes: 1 addition & 1 deletion python/MooseDocs/extensions/navigation.py
Expand Up @@ -54,7 +54,7 @@ def extend(self, reader, renderer):
self.requires(core, heading)

menu = self.get('menu')
if (menu is None) and (renderer.get('navigation', None) is not None):
if (not menu) and (renderer.get('navigation', None) is not None):
msg = "The navigation setting in the MaterializeRenderer is deprecated, " \
"please update your code to use the 'menu' setting within the " \
"MooseDocs.extensions.navigation extension."
Expand Down
5 changes: 3 additions & 2 deletions python/MooseDocs/extensions/panoptic.py
Expand Up @@ -7,8 +7,9 @@
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html

import logging
from MooseDocs.extensions import common
LOG = logging.getLogger(__name__)
def make_extension(**kwargs):
print "The panoptic extension has been renamed, use MooseDocs.extensions.common."
LOG.warning("The panoptic extension has been renamed, use MooseDocs.extensions.common.")
return common.make_extension(**kwargs)
4 changes: 1 addition & 3 deletions python/MooseDocs/main.py
Expand Up @@ -60,9 +60,7 @@ def run():
warnings = log.MooseDocsFormatter.COUNTS['WARNING'].value

print 'CRITICAL:{} ERROR:{} WARNING:{}'.format(critical, errors, warnings)
if critical or errors:
return 1
elif errno != 0:
if critical or errors or (errno != 0):
return 1
return 0

Expand Down

0 comments on commit 13e04ab

Please sign in to comment.