From ca339213402edb714650351f3ed4acd93b72f422 Mon Sep 17 00:00:00 2001 From: Ron Snyder Date: Wed, 4 Oct 2023 12:22:47 -0400 Subject: [PATCH] Deploy testing --- README.md | 6 +- .../Andr\303\251_Pierre_Ledru/README.md" | 0 .../README.md} | 0 .../README.md} | 0 .../README.md} | 0 contributors/README.md | 3 +- juncture/components/JunctureV1.vue | 2 +- restructure-for-ghp-hosting.py | 60 +++++++++++++++++++ 8 files changed, 67 insertions(+), 4 deletions(-) rename "articles/Andr\303\251_Pierre_Ledru.md" => "articles/Andr\303\251_Pierre_Ledru/README.md" (100%) rename articles/{Isles_of_Fortune.md => Isles_of_Fortune/README.md} (100%) rename articles/{cherry_blossom.md => cherry_blossom/README.md} (100%) rename articles/{dragon_tree_species.md => dragon_tree_species/README.md} (100%) create mode 100755 restructure-for-ghp-hosting.py diff --git a/README.md b/README.md index 7593e86a5..5a4f4eb97 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ .ve-meta title="Plant Humanities" -# Featured Plant Narratives {.cards} +# Featured Plant Narratives + ## [**Maize: Sacred Plant, Global Commodity**](/maize) @@ -58,7 +59,8 @@ ![](/images/thumbnails/Cryptomeria.jpeg) -# All Plant Narratives {.cards} +# All Plant Narratives + ## [**Agave: A Plant with an Intoxicating History**](/Agave) diff --git "a/articles/Andr\303\251_Pierre_Ledru.md" "b/articles/Andr\303\251_Pierre_Ledru/README.md" similarity index 100% rename from "articles/Andr\303\251_Pierre_Ledru.md" rename to "articles/Andr\303\251_Pierre_Ledru/README.md" diff --git a/articles/Isles_of_Fortune.md b/articles/Isles_of_Fortune/README.md similarity index 100% rename from articles/Isles_of_Fortune.md rename to articles/Isles_of_Fortune/README.md diff --git a/articles/cherry_blossom.md b/articles/cherry_blossom/README.md similarity index 100% rename from articles/cherry_blossom.md rename to articles/cherry_blossom/README.md diff --git a/articles/dragon_tree_species.md b/articles/dragon_tree_species/README.md similarity index 100% rename from articles/dragon_tree_species.md rename to articles/dragon_tree_species/README.md diff --git a/contributors/README.md b/contributors/README.md index 431364bc5..4d521200c 100644 --- a/contributors/README.md +++ b/contributors/README.md @@ -1,6 +1,7 @@ -# Essay Contributors {.cards} +# Essay Contributors + ## **Thomas C. Anderson** diff --git a/juncture/components/JunctureV1.vue b/juncture/components/JunctureV1.vue index a51c17c6b..ba4d5a7cb 100644 --- a/juncture/components/JunctureV1.vue +++ b/juncture/components/JunctureV1.vue @@ -297,7 +297,7 @@ module.exports = { }) this.entities = await this.getEntityData(this.findEntities(tmp, this.params)) this.html = tmp.outerHTML - let essayConfig = this.params.find(param => param['ve-config']) + let essayConfig = this.params.find(param => param['ve-config']) || {} essayConfig.header = essayConfig.header || 'header' essayConfig.main = essayConfig.main || essayConfig.component || 'visual-essay' essayConfig.footer = essayConfig.footer || 'footer' diff --git a/restructure-for-ghp-hosting.py b/restructure-for-ghp-hosting.py new file mode 100755 index 000000000..7f830b2ff --- /dev/null +++ b/restructure-for-ghp-hosting.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +''' +Restructures the site to be more like a Jekyll site. +''' + +import logging +logging.basicConfig(format='%(asctime)s : %(filename)s : %(levelname)s : %(message)s') +logger = logging.getLogger() +logger.setLevel(logging.INFO) + +import argparse, os, re +from pathlib import Path + +BASEDIR = os.path.abspath(os.path.dirname(__file__)) + +done = False + +def reformat_cards(path): + global done + md = open(path, 'r').read() + if re.search(r'{\s*\.cards\s*}', md): + md = re.sub(r'{\s*\s*\.cards\s*}', '\n', md) + md = re.sub(r'(?P#+)\s(?P.*)\s+{\s*href=(?P<href>[^}\s]+)\s*}', r'\1 \2\n\n[\2](\3)', md) + logger.info(path) + with open(path, 'w') as f: + f.write(md) + # done = True + +def main(root=BASEDIR, **kwargs): + global done + logger.info(f'Root: {root}') + for root, dirs, files in os.walk(root): + for filename in files: + if '/.venv/' in root: continue + if filename == 'README.md': + reformat_cards(os.path.join(root, filename)) + if done: break + elif filename.endswith('.md'): + # print(os.path.join(root, filename)) + print(f'mkdir: {os.path.join(root, filename[:-3])}') + os.mkdir(os.path.join(root, filename[:-3])) + src = Path(os.path.join(root, filename)) + dest = Path(os.path.join(root, filename[:-3], 'README.md')) + print(f'move: {src} to {dest}') + src.rename(dest) + if done: break + +if __name__ == '__main__': + logger.setLevel(logging.INFO) + parser = argparse.ArgumentParser() + parser.add_argument('--root', type=str, help='Root directory') + args = vars(parser.parse_args()) + if args['root'] is None: + args['root'] = BASEDIR + elif not os.path.isabs(args['root']): + args['root'] = os.path.abspath(os.path.join(BASEDIR, args['root'])) + + main(**args) \ No newline at end of file