Skip to content

Commit efc364c

Browse files
committed
Plain wording on the merge tag pages
- The reference intro says what the page lists and where its outputs come from, without dashes or "verified ... not invented". - Headings: "Merge tags" in sentence case; "Merge tag {x}" and "Modifier :x" with the tag in code, instead of "Modifier: :value". - "Solid value" becomes "Same for every entry"; "Canonical output" becomes "Example output". - Field-kind lists end with ", and", and the examples line reads "Output from the real plugin code, run against a test entry."
1 parent 5b90494 commit efc364c

5 files changed

Lines changed: 43 additions & 34 deletions

File tree

‎src/components/merge-tags/ModifierPage.jsx‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ import Layout from '@theme/Layout';
22
import { MergeTagsNav, PRODUCT_NAMES, SECTIONS, requiresText, sectionOf } from './shared';
33
import Examples, { UsageExample } from './Examples';
44

5+
/** "a and b", "a, b, and c" */
6+
function listText(items) {
7+
if (items.length < 3) return items.join(' and ');
8+
return `${items.slice(0, -1).join(', ')}, and ${items[items.length - 1]}`;
9+
}
10+
511
function appliesToText(modifier, fieldTypeNames = {}) {
612
const tags = modifier.applies_to?.tags;
713
const types = modifier.applies_to?.field_types;
8-
const tagText = Array.isArray(tags) ? tags.map((t) => (t === '*field*' ? 'form fields' : `{${t}}`)).join(', ') : 'any merge tag';
14+
const tagText = Array.isArray(tags) ? listText(tags.map((t) => (t === '*field*' ? 'form fields' : `{${t}}`))) : 'any merge tag';
915
if (!Array.isArray(types)) return tagText;
10-
const typeText = types.map((t) => fieldTypeNames[t] || t).join(', ');
16+
const typeText = listText(types.map((t) => fieldTypeNames[t] || t));
1117
return tagText === 'form fields' ? `${typeText} fields` : `${tagText} (${typeText})`;
1218
}
1319

@@ -46,7 +52,7 @@ function Entry({ entry, index, many, reasons, fieldTypeNames }) {
4652
{modifier.exclusive && (
4753
<tr>
4854
<th scope="row">Combining</th>
49-
<td>Only works on its own: with any other modifier, it is ignored.</td>
55+
<td>Use it alone. Combined with any other modifier, it is ignored.</td>
5056
</tr>
5157
)}
5258
</tbody>
@@ -64,7 +70,7 @@ function Entry({ entry, index, many, reasons, fieldTypeNames }) {
6470
{examples.length > 0 && (
6571
<>
6672
<h3>Examples</h3>
67-
<p>Rendered by real Gravity Forms and GravityKit PHP against a test entry.</p>
73+
<p>Output from the real plugin code, run against a test entry.</p>
6874
<Examples examples={examples} />
6975
</>
7076
)}
@@ -143,12 +149,14 @@ export default function ModifierPage({ data }) {
143149
<MergeTagsNav current="modifier" />
144150
<article className="theme-doc-markdown markdown">
145151
<header>
146-
<h1>Modifier: :{name}</h1>
152+
<h1>
153+
Modifier <code>:{name}</code>
154+
</h1>
147155
</header>
148156
{many ? (
149157
<>
150158
<p>
151-
<code>:{name}</code> means different things depending on the merge tag or the kind of field:
159+
<code>:{name}</code> does different things depending on the merge tag or the kind of field:
152160
</p>
153161
<ul>
154162
{entries.map((entry, index) => (

‎src/components/merge-tags/TagPage.jsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export default function TagPage({ data }) {
2222
<MergeTagsNav current="tag" />
2323
<article className="theme-doc-markdown markdown">
2424
<header>
25-
<h1>Merge tag: {tag.syntax}</h1>
25+
<h1>
26+
Merge tag <code>{tag.syntax}</code>
27+
</h1>
2628
</header>
2729
<p>
2830
<strong>{tag.label}.</strong> {tag.description}
@@ -42,7 +44,7 @@ export default function TagPage({ data }) {
4244
)}
4345
<tr>
4446
<th scope="row">Needs an entry</th>
45-
<td>{tag.entry_dependent ? 'Yes: its value comes from a form entry' : 'No'}</td>
47+
<td>{tag.entry_dependent ? 'Yes. Its value comes from a form entry.' : 'No'}</td>
4648
</tr>
4749
</tbody>
4850
</table>
@@ -156,7 +158,7 @@ export default function TagPage({ data }) {
156158
{(plain.length > 0 || withModifier.length > 0) && (
157159
<>
158160
<h2 id="examples">Examples</h2>
159-
<p>Rendered by real Gravity Forms and GravityKit PHP against a test entry.</p>
161+
<p>Output from the real plugin code, run against a test entry.</p>
160162
{plain.length > 0 && <Examples examples={plain} showBefore={false} />}
161163
{withModifier.length > 0 && (
162164
<>
@@ -169,7 +171,7 @@ export default function TagPage({ data }) {
169171

170172
{isField && (
171173
<p>
172-
Each modifier's own page has examples on real fields: see <a href="/merge-tags/fields/">Modifiers by field</a>.
174+
For examples on each kind of field, open a modifier from <a href="/merge-tags/fields/">Modifiers by field</a>.
173175
</p>
174176
)}
175177
</article>

‎src/pages/merge-tags.jsx‎

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ const HAZARD_REPARSES_INPUT_ORDER = 'reparses-input-order';
7575
const HAZARD_ANNOTATIONS = {
7676
[HAZARD_REPARSES_INPUT_ORDER]:
7777
'This modifier re-reads the text the earlier steps produced and interprets it as a date. ' +
78-
'Because an earlier step already reshaped that text, the result is silently wrong — often ' +
79-
"today's date instead of the field's. Put the re-parsing modifier first so it reads the field's own value.",
78+
'Because an earlier step already changed that text, the result is wrong with no warning, often ' +
79+
"today's date instead of the field's. Put this modifier first so it reads the field's own value.",
8080
};
8181

8282
function hazardAnnotation(hazard) {
@@ -116,12 +116,12 @@ function entryDependenceBadge(row) {
116116
if (row.type === 'tag') {
117117
return tagEntryDependent(row.entry)
118118
? { text: 'Varies by entry', tone: 'entryVaries' }
119-
: { text: 'Solid value', tone: 'entrySolid' };
119+
: { text: 'Same for every entry', tone: 'entrySolid' };
120120
}
121121
if (!hasEntryDependenceOverride(row.entry)) return null;
122122
return row.entry.entry_dependent === false
123-
? { text: 'Forces a solid value', tone: 'entrySolid' }
124-
: { text: 'Forces varying by entry', tone: 'entryVaries' };
123+
? { text: 'Makes it the same for every entry', tone: 'entrySolid' }
124+
: { text: 'Makes it vary by entry', tone: 'entryVaries' };
125125
}
126126

127127
/**
@@ -326,7 +326,7 @@ function CaptureOutput({ out }) {
326326
return (
327327
<details>
328328
<summary style={{ cursor: 'pointer', color: 'var(--ifm-color-emphasis-600)' }}>
329-
{out.length.toLocaleString()} characters &mdash; expand to view
329+
{out.length.toLocaleString()} characters. Expand to view.
330330
</summary>
331331
<pre style={{ maxHeight: 320, overflow: 'auto', background: 'var(--ifm-color-emphasis-100)', padding: 8, borderRadius: 4 }}>
332332
<code>{out}</code>
@@ -432,7 +432,7 @@ function TagRow({ entry, catalog, expanded, onToggle }) {
432432
<p style={{ fontSize: 12, color: 'var(--ifm-color-emphasis-600)' }}>
433433
{entryDependence?.tone === 'entryVaries'
434434
? 'Changes depending on which entry is being viewed.'
435-
: "Renders the same value no matter which entry is selected — a solid value, not read from the entry."}
435+
: 'Shows the same value whichever entry is selected. It is not read from the entry.'}
436436
</p>
437437
<CapturePair capture={canonical} />
438438
{entry.requires ? (
@@ -488,9 +488,9 @@ function ModifierRow({ entry, catalog, expanded, onToggle }) {
488488
cross-entry total. */}
489489
{entryDependence ? (
490490
<p style={{ fontSize: 12, color: 'var(--ifm-color-emphasis-600)' }}>
491-
<strong>{entryDependence.text}:</strong> the field this modifies normally changes per entry, but this
492-
modifier computes a total, count, or average across every entry in scope — not this one — so the
493-
result is the same no matter which entry is selected.
491+
<strong>{entryDependence.text}:</strong> the field normally changes from entry to entry, but this
492+
modifier adds up, counts, or averages every entry in scope, so the result is the same whichever
493+
entry is selected.
494494
</p>
495495
) : null}
496496
{captures.length ? captures.map((c) => <CapturePair key={c.in} capture={c} />) : <CapturePair capture={null} />}
@@ -623,9 +623,9 @@ function MergeTagTable({ catalog }) {
623623
title="Whether a tag's rendered value changes depending on which entry is being viewed"
624624
style={{ padding: '6px 10px', borderRadius: 6 }}
625625
>
626-
<option value="all">Varies or solid</option>
626+
<option value="all">Varies or not</option>
627627
<option value="varies">Varies by entry</option>
628-
<option value="solid">Solid value</option>
628+
<option value="solid">Same for every entry</option>
629629
</select>
630630
<span style={{ color: 'var(--ifm-color-emphasis-600)', fontSize: 14 }}>
631631
{filtered.length} entries &middot; {catalog.captures?.count ?? 0} captured renders
@@ -641,7 +641,7 @@ function MergeTagTable({ catalog }) {
641641
<th style={{ width: '120px' }}>Kind / group</th>
642642
<th style={{ width: '180px' }}>Scope</th>
643643
<th>Label</th>
644-
<th>Canonical output</th>
644+
<th>Example output</th>
645645
</tr>
646646
</thead>
647647
<tbody>
@@ -673,22 +673,21 @@ export default function MergeTagsPage() {
673673

674674
return (
675675
<Layout
676-
title="GravityKit Merge Tags"
676+
title="GravityKit merge tags"
677677
description="Every merge tag and modifier across GravityKit and the products it extends, with real rendered examples."
678678
>
679679
<main className="container margin-vert--lg">
680680
<MergeTagsNav current="all" />
681-
<h1>Merge Tags</h1>
681+
<h1>Merge tags</h1>
682682
<p>
683-
Every merge tag GravityKit and the products it extends can resolve, every modifier each one accepts, and a
684-
real captured render for each &mdash; verified against actual PHP on a frozen fixture, not invented.
685-
Search, or filter by product and kind. This table is generated from the same schema the merge tag picker
686-
in wp-admin uses, so it never drifts from what the picker offers.
683+
Every merge tag that Gravity Forms and GravityKit products understand, the modifiers each one takes, and
684+
the output each one gives. The outputs come from running the real plugin code against a test entry.
685+
Search, or filter by product and kind. The list is built from the same data as the merge tag picker in
686+
WordPress, so the two always match.
687687
</p>
688688
<p>
689-
Want to try a tag against your own data? The merge tag picker in wp-admin renders live, against your
690-
site's real entries &mdash; this page can't do that (there's no site behind it), so it documents instead
691-
of guessing.
689+
To see a tag's output for your own entries, use the merge tag picker in WordPress. It shows each tag's
690+
value from your site as you build.
692691
</p>
693692

694693
<MergeTagTable catalog={catalog} />

‎src/pages/merge-tags/compare.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function MergeTagComparePage() {
100100
const item = byName.get(column.name);
101101
const modifier = item && byId.get(item.id);
102102
const locked = item?.locked;
103-
const title = modifier ? `${modifier.label} (${requiresText(modifier.requires)})${locked ? ` — locked: ${locked}` : ''}` : undefined;
103+
const title = modifier ? `${modifier.label} (${requiresText(modifier.requires)})${locked ? `. Locked: ${locked}` : ''}` : undefined;
104104
return (
105105
<td key={column.name} title={title} className={item ? styles[`cell_${column.section}`] : undefined}>
106106
{item ? (locked ? '○' : '●') : ''}

‎src/pages/merge-tags/fields.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default function MergeTagFieldsPage() {
174174
};
175175

176176
return (
177-
<Layout title="Modifiers by field" description="What the merge tag picker offers for each kind of Gravity Forms field, and why the rest is left out.">
177+
<Layout title="Modifiers by field" description="What the merge tag picker offers for each kind of Gravity Forms field, and why it leaves out the rest.">
178178
<main className="container margin-vert--lg">
179179
<MergeTagsNav current="fields" />
180180
<h1>Modifiers by field</h1>

0 commit comments

Comments
 (0)