more work
This commit is contained in:
parent
077c557abb
commit
2c0ca29ed4
|
|
@ -1,6 +1,8 @@
|
||||||
# Interprets config files
|
# Interprets config files
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
class ConfigLoader():
|
class ConfigLoader():
|
||||||
"""
|
"""
|
||||||
Reads config files.
|
Reads config files.
|
||||||
|
|
@ -9,13 +11,22 @@ class ConfigLoader():
|
||||||
def __init__(self, configfile):
|
def __init__(self, configfile):
|
||||||
with open(configfile, "r") as f:
|
with open(configfile, "r") as f:
|
||||||
self.loadedconf = yaml.safe_load(f)
|
self.loadedconf = yaml.safe_load(f)
|
||||||
|
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
return self.loadedconf[item]
|
try:
|
||||||
|
return self.loadedconf[item]
|
||||||
|
except KeyError:
|
||||||
|
print("Argument", item, "not found.")
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return(self.loadedconf.__repr__())
|
||||||
|
|
||||||
|
|
||||||
class UserConfig(ConfigLoader):
|
class UserConfig(ConfigLoader):
|
||||||
def __init__(self, configfile):
|
def __init__(self, configfile):
|
||||||
super().__init__(configfile)
|
super().__init__(configfile)
|
||||||
|
|
||||||
|
|
||||||
class GlobalConfig(ConfigLoader):
|
class GlobalConfig(ConfigLoader):
|
||||||
def __init__(self, configfile):
|
def __init__(self, configfile):
|
||||||
super().__init__(configfile)
|
super().__init__(configfile)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,20 @@
|
||||||
# Module sequencing the successive actions necessary for website building
|
# Module sequencing the successive actions necessary for website building
|
||||||
|
|
||||||
|
import modules.config as config
|
||||||
|
|
||||||
|
|
||||||
def create_website():
|
def create_website():
|
||||||
"""
|
"""
|
||||||
First function called by bparse.py, calls all other modules in the right order.
|
First function called by bparse.py,
|
||||||
|
calls all other modules in the right order.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def create_environment():
|
def create_environment():
|
||||||
"""
|
"""
|
||||||
Returns parserEnvironment as an object containing everything needed for app execution.
|
Returns parserEnvironment as an object containing
|
||||||
|
everything needed for app execution.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -18,7 +23,7 @@ def create_config():
|
||||||
"""
|
"""
|
||||||
Returns globalConfig as an object from parser_config.yml settings.
|
Returns globalConfig as an object from parser_config.yml settings.
|
||||||
"""
|
"""
|
||||||
pass
|
return config.GlobalConfig("configs/parser_config.yml")
|
||||||
|
|
||||||
|
|
||||||
def create_crawler():
|
def create_crawler():
|
||||||
|
|
@ -30,35 +35,40 @@ def create_crawler():
|
||||||
|
|
||||||
def create_user_config():
|
def create_user_config():
|
||||||
"""
|
"""
|
||||||
Returns userConfig as an object from aliases.yml, glossary.yml and website.yml.
|
Returns userConfig as an object from aliases.yml,
|
||||||
|
glossary.yml and website.yml.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def create_template():
|
def create_template():
|
||||||
"""
|
"""
|
||||||
Returns a templateManager from templates for generating the correct html files.
|
Returns a templateManager from templates for
|
||||||
|
generating the correct html files.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def env_checker():
|
def env_checker():
|
||||||
"""
|
"""
|
||||||
Verify all is in order for initialisation of the parserEnvironment object and initialises.
|
Verify all is in order for initialisation of
|
||||||
|
the parserEnvironment object and initialises.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def begin_crawling(pEnv):
|
def begin_crawling(pEnv):
|
||||||
"""
|
"""
|
||||||
Starts reading every file in the userfiles and adds them to the crawler object progressively.
|
Starts reading every file in the userfiles and
|
||||||
|
adds them to the crawler object progressively.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def begin_preparsing(pEnv):
|
def begin_preparsing(pEnv):
|
||||||
"""
|
"""
|
||||||
Create an importTree and checks for conflicts or loops; then replaces imports with their contents,
|
Create an importTree and checks for conflicts or loops;
|
||||||
|
then replaces imports with their contents,
|
||||||
then replaces all aliases with their values.
|
then replaces all aliases with their values.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
@ -66,15 +76,19 @@ def begin_preparsing(pEnv):
|
||||||
|
|
||||||
def begin_parsing(pEnv):
|
def begin_parsing(pEnv):
|
||||||
"""
|
"""
|
||||||
For each of the generated files, parses element after element and creates the graph representation of the website,
|
For each of the generated files,
|
||||||
interacts with context_mngr.py to ascertain integrity and deal with errors.
|
parses element after element and creates
|
||||||
|
the graph representation of the website,
|
||||||
|
interacts with context_mngr.py to ascertain integrity
|
||||||
|
and deal with errors.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def begin_export():
|
def begin_export():
|
||||||
"""
|
"""
|
||||||
Replaces all parsed values with their attributed correspondances as per the template_manager
|
Replaces all parsed values with their attributed
|
||||||
|
correspondances as per the template_manager
|
||||||
and exports the result as a website.
|
and exports the result as a website.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue