Skip to content

Commit ecc2d79

Browse files
committed
Update README
1 parent 38405b8 commit ecc2d79

5 files changed

+34
-7
lines changed

GALLERY.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Blueprints Gallery
2+
3+
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!
4+
5+
| Title | Preview | Source |
6+
| ----- | ------- | ------ |
7+
| 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) |
8+

GALLERY.md.template

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Blueprints Gallery
2+
3+
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!
4+
5+
{BLUEPRINTS_TABLE}
6+

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Blueprints can help you:
2626
* 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.
2727
* Learn WordPress – Blueprints are a fantastic way to play with a variety of WordPress configurations.
2828

29-
### Ready to jump in?
29+
## Ready to jump in?
3030

3131
In this community space, you can:
3232

README.md.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Blueprints can help you:
2626
* 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.
2727
* Learn WordPress – Blueprints are a fantastic way to play with a variety of WordPress configurations.
2828

29-
### Ready to jump in?
29+
## Ready to jump in?
3030

3131
In this community space, you can:
3232

make_index.py

+18-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import re
44

5+
56
def build_json_index():
67
index = {}
78
for root, dirs, files in os.walk('v1-examples'):
@@ -17,6 +18,16 @@ def build_json_index():
1718

1819
build_json_index()
1920

21+
def get_dot_template_files():
22+
dot_template_files = []
23+
for root, dirs, files in os.walk('.'):
24+
for file in files:
25+
if file.endswith('.template'):
26+
path = os.path.join(root, file)
27+
dot_template_files.append(path)
28+
return dot_template_files
29+
30+
2031
def build_markdown_table():
2132
with open('index.json', 'r') as f:
2233
index = json.load(f)
@@ -51,10 +62,12 @@ def format_row(row):
5162
formatted_rows.append(format_row(row))
5263
formatted_table = '\n'.join(formatted_rows)
5364

54-
# Replace "{BLUEPRINTS_TABLE}" in README.md.template and save to README.md
55-
with open('README.md.template', 'r') as f:
56-
template = f.read()
57-
with open('README.md', 'w') as f:
58-
f.write(re.sub(r'{BLUEPRINTS_TABLE}', ''.join(formatted_table), template))
65+
# Replace "{BLUEPRINTS_TABLE}" in all the *.template files
66+
DOT_TEMPLATE_FILES = get_dot_template_files()
67+
for file in DOT_TEMPLATE_FILES:
68+
with open(file, 'r') as f:
69+
template = f.read()
70+
with open(file.replace('.template', ''), 'w') as f:
71+
f.write(re.sub(r'{BLUEPRINTS_TABLE}', ''.join(formatted_table), template))
5972

6073
build_markdown_table()

0 commit comments

Comments
 (0)