From ecc2d7906c5fcd85f7dc16732b795a545f138e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Wed, 20 Mar 2024 14:14:46 +0100 Subject: [PATCH] Update README --- GALLERY.md | 8 ++++++++ GALLERY.md.template | 6 ++++++ README.md | 2 +- README.md.template | 2 +- make_index.py | 23 ++++++++++++++++++----- 5 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 GALLERY.md create mode 100644 GALLERY.md.template diff --git a/GALLERY.md b/GALLERY.md new file mode 100644 index 0000000..e012456 --- /dev/null +++ b/GALLERY.md @@ -0,0 +1,8 @@ +# Blueprints Gallery + +Here's the list of all the community Blueprints submitted to this repository. See the [contribution guidelines](./README.md#contributing-your-blueprint) to submit your Blueprint and share your WordPress setup with the world! + +| Title | Preview | Source | +| ----- | ------- | ------ | +| Latest Gutenberg plugin | [Preview](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/adamziel/blueprints/trunk/v1-examples/latest-gutenberg/blueprint.json) | [Source](https://github.com/adamziel/blueprints/blob/trunk/v1-examples/latest-gutenberg/blueprint.json) | + diff --git a/GALLERY.md.template b/GALLERY.md.template new file mode 100644 index 0000000..128b39a --- /dev/null +++ b/GALLERY.md.template @@ -0,0 +1,6 @@ +# Blueprints Gallery + +Here's the list of all the community Blueprints submitted to this repository. See the [contribution guidelines](./README.md#contributing-your-blueprint) to submit your Blueprint and share your WordPress setup with the world! + +{BLUEPRINTS_TABLE} + diff --git a/README.md b/README.md index 5145af6..09877ad 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Blueprints can help you: * Save time – Instead of manually setting up your site, choosing themes, and installing plugins one by one, Blueprints do all that work for you in a few clicks. * Learn WordPress – Blueprints are a fantastic way to play with a variety of WordPress configurations. -### Ready to jump in? +## Ready to jump in? In this community space, you can: diff --git a/README.md.template b/README.md.template index fe7f05d..78c0ca1 100644 --- a/README.md.template +++ b/README.md.template @@ -26,7 +26,7 @@ Blueprints can help you: * Save time – Instead of manually setting up your site, choosing themes, and installing plugins one by one, Blueprints do all that work for you in a few clicks. * Learn WordPress – Blueprints are a fantastic way to play with a variety of WordPress configurations. -### Ready to jump in? +## Ready to jump in? In this community space, you can: diff --git a/make_index.py b/make_index.py index 74940af..8a64a8c 100644 --- a/make_index.py +++ b/make_index.py @@ -2,6 +2,7 @@ import os import re + def build_json_index(): index = {} for root, dirs, files in os.walk('v1-examples'): @@ -17,6 +18,16 @@ def build_json_index(): build_json_index() +def get_dot_template_files(): + dot_template_files = [] + for root, dirs, files in os.walk('.'): + for file in files: + if file.endswith('.template'): + path = os.path.join(root, file) + dot_template_files.append(path) + return dot_template_files + + def build_markdown_table(): with open('index.json', 'r') as f: index = json.load(f) @@ -51,10 +62,12 @@ def format_row(row): formatted_rows.append(format_row(row)) formatted_table = '\n'.join(formatted_rows) - # Replace "{BLUEPRINTS_TABLE}" in README.md.template and save to README.md - with open('README.md.template', 'r') as f: - template = f.read() - with open('README.md', 'w') as f: - f.write(re.sub(r'{BLUEPRINTS_TABLE}', ''.join(formatted_table), template)) + # Replace "{BLUEPRINTS_TABLE}" in all the *.template files + DOT_TEMPLATE_FILES = get_dot_template_files() + for file in DOT_TEMPLATE_FILES: + with open(file, 'r') as f: + template = f.read() + with open(file.replace('.template', ''), 'w') as f: + f.write(re.sub(r'{BLUEPRINTS_TABLE}', ''.join(formatted_table), template)) build_markdown_table()