diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-12-15 22:04:41 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-12-15 22:04:41 +0100 |
| commit | b1e7dc570fe25749a2e1b02c9e859df6588b4660 (patch) | |
| tree | 1c8392e77c6f85b64cc369cdc2a90b174daf7f3a /megapixels/app | |
| parent | 67cd70621b7dca679cd930de66d883e0610a1427 (diff) | |
move builder
Diffstat (limited to 'megapixels/app')
| -rw-r--r-- | megapixels/app/settings/app_cfg.py | 5 | ||||
| -rw-r--r-- | megapixels/app/site/README.md (renamed from megapixels/app/builder/README.md) | 0 | ||||
| -rw-r--r-- | megapixels/app/site/builder.py (renamed from megapixels/app/builder/builder.py) | 0 | ||||
| -rw-r--r-- | megapixels/app/site/parser.py (renamed from megapixels/app/builder/parser.py) | 15 | ||||
| -rw-r--r-- | megapixels/app/site/s3.py (renamed from megapixels/app/builder/s3.py) | 0 |
5 files changed, 17 insertions, 3 deletions
diff --git a/megapixels/app/settings/app_cfg.py b/megapixels/app/settings/app_cfg.py index f861700c..a18e5875 100644 --- a/megapixels/app/settings/app_cfg.py +++ b/megapixels/app/settings/app_cfg.py @@ -75,7 +75,7 @@ FP_FONT = join(DIR_ASSETS, 'font') # ----------------------------------------------------------------------------- DIR_COMMANDS_CV = 'commands/cv' DIR_COMMANDS_ADMIN = 'commands/admin' -DIR_COMMANDS_BUILDER = 'commands/builder' +DIR_COMMANDS_SITE = 'commands/site' DIR_COMMANDS_DATASETS = 'commands/datasets' DIR_COMMANDS_FAISS = 'commands/faiss' DIR_COMMANDS_MISC = 'commands/misc' @@ -125,9 +125,8 @@ S3_MEDIA_ROOT = 's3://megapixels/v1/media/' S3_METADATA_ROOT = 's3://megapixels/v1/metadata/' # ----------------------------------------------------------------------------- -# Builder +# Static site generator # ----------------------------------------------------------------------------- - S3_SITE_PATH = "v1/site" S3_DATASETS_PATH = "v1" # datasets is already in the filename DIR_SITE_PUBLIC = "../site/public" diff --git a/megapixels/app/builder/README.md b/megapixels/app/site/README.md index 1a6d3a1e..1a6d3a1e 100644 --- a/megapixels/app/builder/README.md +++ b/megapixels/app/site/README.md diff --git a/megapixels/app/builder/builder.py b/megapixels/app/site/builder.py index df609f60..df609f60 100644 --- a/megapixels/app/builder/builder.py +++ b/megapixels/app/site/builder.py diff --git a/megapixels/app/builder/parser.py b/megapixels/app/site/parser.py index 985111ac..add3f386 100644 --- a/megapixels/app/builder/parser.py +++ b/megapixels/app/site/parser.py @@ -43,12 +43,27 @@ def format_metadata(section): meta.append("<div><div class='gray'>{}</div><div>{}</div></div>".format(key, value)) return "<section><div class='meta'>{}</div></section>".format(''.join(meta)) +def format_applet(section): + payload = section.replace('```', '').strip().split('\n') + if ': ' in payload[0]: + command, opt = payload[0].split(': ') + else: + command = payload[0] + opt = None + if command == 'load_file': + return "<section><div class='applet'>{}</div></section>" + + def parse_markdown(sections, s3_path, skip_h1=False): groups = [] current_group = [] for section in sections: if skip_h1 and section.startswith('# '): continue + elif section.startsWith('```'): + groups.append(format_section(current_group, s3_path)) + groups.append(format_applet(section)) + current_group = [] elif section.startswith('+ '): groups.append(format_section(current_group, s3_path)) groups.append(format_metadata(section)) diff --git a/megapixels/app/builder/s3.py b/megapixels/app/site/s3.py index 99726a4d..99726a4d 100644 --- a/megapixels/app/builder/s3.py +++ b/megapixels/app/site/s3.py |
