def __init__(self, translator, options, *args, **kwargs): super(MooseDocsWatcher, self).__init__(*args, **kwargs) self._options = options self._translator = translator self._config = yaml_load(options.config, root=MooseDocs.ROOT_DIR) # Determine the directories to watch roots = set() self._items = common.get_items(self._config.get('Content')) for root, _ in common.get_files(self._items, self._translator.reader.EXTENSIONS): roots.add(root) for root in roots: self.watch(root, self.build, delay=1)
def _getPage(self, source): """Search the existing content for pages, if it doesn't exist create it.""" # Search for the page based on the source name, if it is found return the page for page in self._translator.content: if source == page.source: return page # Build a list of all filenames filenames = common.get_files(self._items, self._translator.reader.EXTENSIONS, False) # Build a page object if the filename shows up in the list of available files for root, filename in filenames: if filename == source: key = filename.replace(root, '').strip('/') page = common.create_file_page(key, filename, self._translator.reader.EXTENSIONS) page.base = self._translator.get('destination') if isinstance(page, pages.Source): page.output_extension = self._translator.renderer.EXTENSION return page
def _getPage(self, source): """Search the existing content for pages, if it doesn't exist create it.""" # Search for the page based on the source name, if it is found return the page for page in self._translator.content: if source == page.source: return page # Build a list of all filenames filenames = common.get_files(self._items, self._translator.reader.EXTENSIONS, False) # Build a page object if the filename shows up in the list of available files for root, filename in filenames: if filename == source: key = filename.replace(root, '').strip('/') page = common.create_file_page(key, filename, self._translator.reader.EXTENSIONS) page.base = self._translator.get('destination') if isinstance(page, pages.Source): page.output_extension = self._translator.renderer.EXTENSION self._translator.addContent(page) return page