Permalink
Browse files

Merge pull request #12565 from aeslaughter/livereload

Improve livereload in MOOSEDocs
  • Loading branch information...
aeslaughter committed Dec 3, 2018
2 parents c9068b4 + 6535fe4 commit 3e885b7f5f0203016634815bb540fb73e8e3f4b6
@@ -155,18 +155,20 @@ def __call__(self, nodes, num_threads=1):
self._executeExtensionFunction('preExecute', None, args=(self.translator.content,))
LOG.info('Finished preExecute methods [%s sec.]', time.time() - t)
t = time.time()
LOG.info('Translating using %s threads...', num_threads)
if self.get('profile', False):
mooseutils.run_profile(self.execute, source_nodes, num_threads)
else:
self.execute(source_nodes, num_threads)
LOG.info('Translating complete [%s sec.]', time.time() - t)
if source_nodes:
t = time.time()
LOG.info('Translating using %s threads...', num_threads)
if self.get('profile', False):
mooseutils.run_profile(self.execute, source_nodes, num_threads)
else:
self.execute(source_nodes, num_threads)
LOG.info('Translating complete [%s sec.]', time.time() - t)
# Indexing/copying
LOG.info('Finalizing content...')
t = self.finalize(other_nodes, num_threads)
LOG.info('Finalizing Finished [%s sec.]', t)
if other_nodes:
LOG.info('Copying content...')
t = self.finalize(other_nodes, num_threads)
LOG.info('Copying Finished [%s sec.]', t)
LOG.info('Executing postExecute methods...')
t = time.time()
@@ -169,7 +169,7 @@ def findPages(self, arg):
if items is None:
func = lambda p: p.local.endswith(arg)
items = [page for page in self.__content if func(page)]
#self.__page_cache[arg] = items
self.__page_cache[arg] = items
else:
items = [page for page in self.__content if arg(page)]
@@ -123,7 +123,6 @@ def _getPage(self, source):
if source == page.source:
return page
# Build a list of all filenames
filenames = common.get_files(self._items, self._translator.reader.EXTENSIONS, False)
@@ -135,9 +134,9 @@ def _getPage(self, source):
page.base = self._translator.get('destination')
if isinstance(page, pages.Source):
page.output_extension = self._translator.renderer.EXTENSION
self._translator.content.append(page)
return page
def _init_large_media():
"""Check submodule for large_media."""
log = logging.getLogger('MooseDocs._init_large_media')
@@ -35,7 +35,6 @@ def postTokenize(self, ast, page, meta, reader):
def addDependency(self, page):
self.__dependencies.add(page.uid)
class IncludeCommand(command.CommandComponent):
COMMAND = 'include'
SUBCOMMAND = 'md' #TODO: get this from the reader inside the __init__ method.
@@ -28,7 +28,7 @@ def __init__(self, fullname, **kwargs):
self._fullname = fullname # local path of the node
self._name = fullname.split('/')[-1] # file/folder name
self.__unique_id = uuid.uuid4() # a unique identifer
self.__unique_id = uuid.uuid4() # a unique identifier
@property
def uid(self):
@@ -50,14 +50,6 @@ def destination(self):
"""Returns the translator destination location."""
return os.path.join(self.base, self.local)
def modified(self):
"""
Returns True if the content has been modified from the last call.
"""
if self.source and os.path.exists(self.source):
return os.path.getmtime(self.source) > self._modified
return True
def relativeSource(self, other):
""" Location of this page related to the other page."""
return os.path.relpath(self.local, os.path.dirname(other.local))

0 comments on commit 3e885b7

Please sign in to comment.