Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Mar 20, 2024
1 parent 38405b8 commit ecc2d79
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
8 changes: 8 additions & 0 deletions GALLERY.md
Original file line number Diff line number Diff line change
@@ -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) |

6 changes: 6 additions & 0 deletions GALLERY.md.template
Original file line number Diff line number Diff line change
@@ -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}

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion README.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
23 changes: 18 additions & 5 deletions make_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import re


def build_json_index():
index = {}
for root, dirs, files in os.walk('v1-examples'):
Expand All @@ -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)
Expand Down Expand Up @@ -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()

0 comments on commit ecc2d79

Please sign in to comment.