Compare commits
7 Commits
b60eedd2d2
...
6f4cc857d0
| Author | SHA1 | Date |
|---|---|---|
|
|
6f4cc857d0 | |
|
|
8adc925b0a | |
|
|
a8bcb13480 | |
|
|
7db2c40be8 | |
|
|
b4ff63c2cc | |
|
|
1091c6a484 | |
|
|
8b991b7efd |
|
|
@ -1,10 +1,11 @@
|
|||
shortcuts:
|
||||
copyright: Copyright (c) 2020 by Idle-Corp, all rights reserved.
|
||||
website_url: https://idle-corp.com
|
||||
website_name: Idle-Corp
|
||||
cc_license: CC-BY-SA-4.0
|
||||
replace: Test with {} and {}
|
||||
copyright: 'Copyright (c) 2020 by Idle-Corp, all rights reserved.'
|
||||
website_url: 'https://idle-corp.com'
|
||||
website_name: 'Idle-Corp'
|
||||
cc_license: 'CC-BY-SA-4.0'
|
||||
replace: 'Test with {} and {}'
|
||||
alias: 'test alias replacement with format {test}'
|
||||
|
||||
images:
|
||||
logo: ressources/images/logo.png
|
||||
favicon: ressources/images/favicon.png
|
||||
logo: 'resources/images/logo.png'
|
||||
favicon: 'resources/images/favicon.png'
|
||||
|
|
@ -1 +1,2 @@
|
|||
@{image1.png}{style="border:2px"}{{card red}}{{second class insert}}[i=2, 12, 'string', q=13, o='joli', 17][d="okboomer"]{target="_blank"}
|
||||
@[replace][1, 'chaussette', test='chauss', 2, 32]
|
||||
@{image.png}{style="border:2px"}{{card red}}{{second class insert}}[i=2, 12, 'string', q=13, o='joli', 17][d="okboomer"]{target="_blank"}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class BaseContainerWithOptionals(BaseContainer):
|
|||
|
||||
|
||||
# Define containers all the Enhanced text elements, divs, headers, list and any element that can be a container
|
||||
# TODO: List all elements and their specialties (custom span id, header level, etc.)
|
||||
class TextContainer(BaseContainer):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ def log_message(message, level="ERROR"):
|
|||
:return: None
|
||||
"""
|
||||
level = level.lower()
|
||||
logging.__getattribute__(level)(' ' + message)
|
||||
logging.__getattribute__(level)(' ' + message) # TODO: Error handling on type error
|
||||
logging.__getattribute__(level)(traceback.format_exc())
|
||||
logging.__getattribute__(level)(__GLk())
|
||||
if level in ["critical"]:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ markup element and pass it over to ExportManager.
|
|||
ExportRequest = namedtuple("ExportRequest", ["type", "subtype", "optionals", "others"], defaults=[None, None, "", {}])
|
||||
|
||||
"""
|
||||
Class containing all necessary information to proceed with the
|
||||
Named tuple containing all necessary information to proceed with the
|
||||
final output.
|
||||
"""
|
||||
ExportResponse = namedtuple("ExportResponse", ["start", "end"])
|
||||
|
|
@ -88,7 +88,7 @@ class ExportManager:
|
|||
level='CRITICAL'
|
||||
)
|
||||
# future: allow for template selection
|
||||
if export_request.optionals != '':
|
||||
if export_request.optionals != '': # TODO: Use format_optionals?
|
||||
optionals = " " + export_request.optionals
|
||||
else:
|
||||
optionals = ''
|
||||
|
|
|
|||
|
|
@ -227,15 +227,29 @@ class PreParser:
|
|||
self.replacements_done = True
|
||||
return self.file_with_all_replacements
|
||||
|
||||
def get_alias_from_config(self, shortcut, optional):
|
||||
def get_alias_from_config(self, shortcut, optionals):
|
||||
"""
|
||||
Fetches shortcut paths from aliases.yaml
|
||||
:return: the html to insert as a string
|
||||
:param shortcut: id of the shortcut to fetch
|
||||
:param optional: optional parameters along with alias
|
||||
:param optionals: optional parameters along with alias
|
||||
"""
|
||||
# return self.__env.config["aliases"][shortcut]
|
||||
return f'<h1>{shortcut}</h1>' # TODO : replace with actual alias
|
||||
try:
|
||||
output = self.__env.config.loaded_conf['aliases']['shortcuts'][shortcut]
|
||||
except KeyError:
|
||||
error_mngr.log_exception(
|
||||
KeyError(
|
||||
f'Shortcut "{shortcut}" could not be found in {"; ".join(self.__env.config.config_folders)}.'
|
||||
), level='CRITICAL'
|
||||
)
|
||||
_, _, var_list, var_dict = export.split_optionals(optionals)
|
||||
try:
|
||||
output = output.format(*var_list, **var_dict) # noqa
|
||||
except KeyError:
|
||||
error_mngr.log_message(
|
||||
'Could not find appropriate replacement values in options provided', level='WARNING'
|
||||
)
|
||||
return output
|
||||
|
||||
def get_image_from_config(self, shortcut, optionals):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ rgx_import_file = regex.compile(r'::( ?\< ?(?P<file_name>[\w\-._/]+) ?\>[ \s]*)+
|
|||
# Base elements
|
||||
quotes = pp.Word(r""""'""")
|
||||
value = (pps(quotes) + pp.Word(pp.alphanums + r'\._') + pps(pp.match_previous_literal(quotes)) ^
|
||||
pp.common.fnumber)("value")
|
||||
pp.common.fnumber)("value") # TODO: not every number is a float
|
||||
assignation = pp.Group(
|
||||
pp.common.identifier('var_name') + pps('=') + value('var_value')
|
||||
)("assignation")
|
||||
|
|
|
|||
Loading…
Reference in New Issue