Skip to content
Permalink
Browse files

Merge pull request #13393 from aeslaughter/lexer-none-9638

Catch problems with text type
  • Loading branch information...
permcody committed May 9, 2019
2 parents 86789e5 + 2e24571 commit 4ddac6767e54b3d8ec0652c4050a4dc9630dddd0
@@ -219,10 +219,14 @@ def tokenize(self, parent, text, page, grammar, line=1):
the entire text to be tokenized and have the errors report upon completion.
"""
if MooseDocs.LOG_LEVEL == logging.DEBUG:
common.check_type('text', text, unicode)
common.check_type('page', page, pages.Page)
common.check_type('line', line, int)

if not isinstance(text, unicode):
msg = "EXCEPTION: {}:{}\n{}".format(page.source, line,
"The supplied text must be unicode.")
raise TypeError(msg)

n = len(text)
pos = 0
while pos < n:
@@ -10,6 +10,7 @@
#pylint: enable=missing-docstring
import os
import re
import copy
import logging
import mooseutils
import MooseDocs
@@ -106,6 +107,12 @@ def _doc_import(root_dir, content=None):
for pattern in exclude:
output -= _find_files(output, os.path.join(root_dir, pattern))

# Test the files exist
for fname in copy.copy(output):
if not os.path.isfile(fname):
LOG.error("Unknown file provided in content (it is being removed):\n%s", fname)
output.remove(fname)

return sorted(output)

def create_file_page(name, filename, in_ext):
@@ -162,13 +162,6 @@ def testBasic(self):
self.assertEqual(p.source,
os.path.join(ROOT_DIR, 'framework/doc/content/getting_started'))

if p.name == 'getting_started/installation/bash_profile.md':
self.assertIsInstance(p, pages.Source)
self.assertEqual(p.local, 'getting_started/installation/bash_profile.md')
self.assertEqual(p.source,
os.path.join(ROOT_DIR,
'framework/doc/content/getting_started/installation/bash_profile.md'))

if __name__ == '__main__':
import logging
logging.basicConfig()

0 comments on commit 4ddac67

Please sign in to comment.
You can’t perform that action at this time.