|
|
|
@ -113,6 +113,7 @@ def exists(**_args):
|
|
|
|
|
return os.path.exists(_path)
|
|
|
|
|
def html(_uri,_config) :
|
|
|
|
|
# _html = (open(uri)).read()
|
|
|
|
|
|
|
|
|
|
_path = _realpath(_uri,_config)
|
|
|
|
|
_context = str(_config['system']['context'])
|
|
|
|
|
# if '/' in _context :
|
|
|
|
@ -123,15 +124,16 @@ def html(_uri,_config) :
|
|
|
|
|
_layout = _config['layout']
|
|
|
|
|
if 'location' in _layout :
|
|
|
|
|
if not _config :
|
|
|
|
|
_api = os.sep.join(['api/disk/read?uri=',_layout['root']])
|
|
|
|
|
_api = os.sep.join(['api/disk/read?uri=',copy.copy(_layout['root']) ])
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
_api = os.sep.join([f'{_context}/api/disk/read?uri=',_layout['root']])
|
|
|
|
|
_api = os.sep.join([f'{_context}/api/disk/read?uri=',copy.copy(_layout['root'])])
|
|
|
|
|
|
|
|
|
|
if f"{_layout['root']}{os.sep}" in _html :
|
|
|
|
|
_html = _html.replace(f"{_layout['root']}",_api)
|
|
|
|
|
_html = _html.replace('/api/disk/read?uri=','').replace(f"{_layout['root']}",_api)
|
|
|
|
|
_html = mistune.html(_html).replace(""",'"').replace("<","<").replace(">",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# _html = _html.replace(f'{os.sep}{_layout["root"]}',_layout['root'])
|
|
|
|
|
|
|
|
|
|
return _html
|
|
|
|
|
def plugins (**_args):
|
|
|
|
|
"""
|
|
|
|
@ -176,4 +178,4 @@ def plugins (**_args):
|
|
|
|
|
# #
|
|
|
|
|
# # LOG This plugin ....
|
|
|
|
|
# return getattr(module,_name) if hasattr(module,_name) else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|