# Page generator

`generate-page.py` emits the whole Summer Camps page as Gutenberg block markup.
The page is generated, not hand-built, so **deploying is re-running the script**
rather than migrating content between sites.

```bash
python3 generate-page.py                       # writes /tmp/camps-content.html
cp /tmp/camps-content.html <project>/wp-content/uploads/_import/content.html
srv-gw wp --project <project> -- post update <ID> /var/www/html/wp-content/uploads/_import/content.html
```

Set `PID` at the top of the script to the target post ID first: Kadence uniqueIDs are
`{postID}_{hex}` and must match the post they live in.

## Rules that matter

**Kadence block markup must be byte-exact.** `kadence/column` and
`kadence/advancedheading` save real HTML, so if the emitted tag does not match what
Kadence's `save()` would produce for those attributes, Gutenberg reports "this block
contains unexpected or invalid content" the next time someone opens the page. This
bit us once already: `htmlTag: "p"` must emit `<p>`, not `<h2>`, regardless of
`level`. All structures here were lifted verbatim from Financial Information (#915);
only uniqueID and content change.

The `bw/*` blocks are dynamic (self-closing or container-only, rendered by their
`render.php`), so they cannot fail validation. They are the safe part.

**`wp_slash()`** is required if you ever write content from PHP instead of wp-cli, or
block-attribute JSON gets its escapes eaten.

## Verifying a build

```bash
curl -s -H "Host: brentwood.demoing.info" http://172.17.0.1:3097/<slug>/ -o /tmp/r.html
grep -c '<!-- wp:' /tmp/r.html        # 0 = every block rendered; >0 = one failed
grep -ciE 'fatal error|warning:' /tmp/r.html
```

To screenshot past the BW auth gate, rewrite asset URLs at both schemes to the
container and load the file locally:

```bash
sed -e 's|https\?://brentwood\.demoing\.info|http://172.17.0.1:3097|g' /tmp/r.html > /tmp/local.html
google-chrome --headless=new --no-sandbox --hide-scrollbars \
  --window-size=1440,9000 --virtual-time-budget=30000 \
  --screenshot=/tmp/shot.png file:///tmp/local.html
```

Both `http://` and `https://` must be rewritten. WordPress emits stylesheet links over
`http://` here, so replacing only `https://` leaves the page unstyled and the
screenshot misleading.
