Eluna Implement [] to parser, change all & to [] in documentation and fix a bug with CastCustomSpell

This commit is contained in:
Rochet2
2014-08-13 17:01:51 +03:00
parent b16879e622
commit ce2637e322
13 changed files with 337 additions and 337 deletions

View File

@@ -84,17 +84,17 @@ if __name__ == '__main__':
method_names = []
for class_ in classes:
class_names.append('&' + class_.name)
class_names.append('[' + class_.name + ']')
for method in class_.methods:
method_names.append('&' + class_.name + ':' + method.name)
method_names.append('[' + class_.name + ':' + method.name + ']')
def link_parser(content):
# Replace all occurrencies of &Class:Function and then &Class with a link to given func or class
for name in method_names:
# Take the "amp;" off the front of the method's name.
full_name = name[len('&'):]
# Take the [] off the front of the method's name.
full_name = name[1:-1]
# Split "Class:Method" into "Class" and "Method".
class_name, method_name = full_name.split(':')
url = '{}{}/{}.html'.format(('../' * level), class_name, method_name)
@@ -102,8 +102,8 @@ if __name__ == '__main__':
content = content.replace(name, '<a class="fn" href="{}">{}</a>'.format(url, full_name))
for name in class_names:
# Take the "&amp;" off the front of the class's name.
class_name = name[len('&amp;'):]
# Take the [] off the front of the class's name.
class_name = name[1:-1]
url = '{}{}/index.html'.format(('../' * level), class_name)
# Replace occurrencies of &Class:Method with the url created
content = content.replace(name, '<a class="mod" href="{}">{}</a>'.format(url, class_name))
@@ -128,7 +128,7 @@ if __name__ == '__main__':
# Otherwise try to build a link to the proper page.
if content in class_names:
class_name = content[len('&amp;'):]
class_name = content[1:-1]
url = '{}{}/index.html'.format(('../' * level), class_name)
return '<strong><a class="mod" href="{}">{}</a></strong>'.format(url, class_name)

View File

@@ -111,14 +111,14 @@ class ClassParser(object):
body_regex = re.compile(r"\s*\s?\*\s*(.*)") # The "body", i.e. a * and optionally some descriptive text.
# An extra optional space (\s?) was thrown in to make it different from `class_body_regex`.
param_regex = re.compile(r"""\s*\*\s@param\s # The @param tag starts with opt. whitespace followed by "* @param ".
([&\w]+)\s(\w+) # The data type, a space, and the name of the param.
(?:\s=\s(\w+))? # The default value: a = surrounded by spaces, followed by text.
(?:\s:\s(.+))? # The description: a colon surrounded by spaces, followed by text.
param_regex = re.compile(r"""\s*\*\s@param\s # The @param tag starts with opt. whitespace followed by "* @param ".
([\[\]\w]+)\s(\w+) # The data type, a space, and the name of the param.
(?:\s=\s(\w+))? # The default value: a = surrounded by spaces, followed by text.
(?:\s:\s(.+))? # The description: a colon surrounded by spaces, followed by text.
""", re.X)
# This is the same as the @param tag, minus the default value part.
return_regex = re.compile(r"""\s*\*\s@return\s
([&\w]+)\s(\w+)
([\[\]\w]+)\s(\w+)
(?:\s:\s(.+))?
""", re.X)
proto_regex = re.compile(r"""\s*\*\s@proto\s