Skip to content

Commit b4b39db

Browse files
recurse into brand.typography on reference page
somewhat messy but fairly complete
1 parent e62f294 commit b4b39db

File tree

6 files changed

+227
-16
lines changed

6 files changed

+227
-16
lines changed

docs/reference/formats/docx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"options": [
9494
{
9595
"name": "page-width",
96-
"description": "Target page width for output (used to compute columns widths for `layout` divs).\nDefaults to 6.5 inches, which corresponds to default letter page settings in \ndocx and odt.\n"
96+
"description": "Target body page width for output (used to compute columns widths for `layout` divs).\nDefaults to 6.5 inches, which corresponds to default letter page settings in \ndocx and odt (8.5 inches with 1 inch for each margins).\n"
9797
},
9898
{
9999
"name": "grid",

docs/reference/formats/odt.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"options": [
8686
{
8787
"name": "page-width",
88-
"description": "Target page width for output (used to compute columns widths for `layout` divs).\nDefaults to 6.5 inches, which corresponds to default letter page settings in \ndocx and odt.\n"
88+
"description": "Target body page width for output (used to compute columns widths for `layout` divs).\nDefaults to 6.5 inches, which corresponds to default letter page settings in \ndocx and odt (8.5 inches with 1 inch for each margins).\n"
8989
},
9090
{
9191
"name": "grid",

docs/reference/formats/presentations/revealjs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@
186186
{
187187
"name": "multiplex",
188188
"description": "Configuration for reveal presentation multiplexing."
189+
},
190+
{
191+
"name": "scroll-view",
192+
"description": "Control the scroll view feature of Revealjs"
189193
}
190194
]
191195
},

docs/reference/metadata/brand.json

Lines changed: 169 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"options": [
4646
{
4747
"name": "images",
48-
"description": ""
48+
"description": "A dictionary of named logo resources."
4949
},
5050
{
5151
"name": "small",
@@ -113,10 +113,6 @@
113113
"name": "dark",
114114
"description": "A dark color, used as a high-contrast foreground color on light elements or high-contrast background color on light elements.\n"
115115
},
116-
{
117-
"name": "emphasis",
118-
"description": "A color used to emphasize or highlight text or elements.\n"
119-
},
120116
{
121117
"name": "link",
122118
"description": "The color used for hyperlinks. If not defined, the `primary` color is used.\n"
@@ -133,27 +129,189 @@
133129
},
134130
{
135131
"name": "base",
136-
"description": "The base font settings for the brand. These are used as the default for all text.\n"
132+
"description": "The base font settings for the brand. These are used as the default for all text.\n See [base](#base) for more information."
137133
},
138134
{
139135
"name": "headings",
140-
"description": "Settings for headings\n"
136+
"description": "Settings for headings. See [headings](#headings) for more information."
141137
},
142138
{
143139
"name": "monospace",
144-
"description": "Settings for monospace text\n"
140+
"description": "Settings for monospace text. See [monospace](#monospace) for more information."
145141
},
146142
{
147143
"name": "monospace-inline",
148-
"description": "Settings for inline code"
144+
"description": "Settings for inline code. See [monospace-inline](#monospace-inline) for more information."
149145
},
150146
{
151147
"name": "monospace-block",
152-
"description": "Settings for code blocks"
148+
"description": "Settings for code blocks. See [monospace-block](#monospace-block) for more information."
153149
},
154150
{
155151
"name": "link",
156-
"description": "Settings for links"
152+
"description": "Settings for links. See [link](#link) for more information."
153+
}
154+
]
155+
},
156+
{
157+
"name": "brand-typography-options-base",
158+
"title": "base",
159+
"level": 3,
160+
"options": [
161+
{
162+
"name": "family",
163+
"description": "The font family."
164+
},
165+
{
166+
"name": "size",
167+
"description": "The font size."
168+
},
169+
{
170+
"name": "weight",
171+
"description": "The font weight."
172+
},
173+
{
174+
"name": "color",
175+
"description": "The text color."
176+
},
177+
{
178+
"name": "line-height",
179+
"description": "The distance between lines of text."
180+
}
181+
]
182+
},
183+
{
184+
"name": "brand-typography-options-headings",
185+
"title": "headings",
186+
"level": 3,
187+
"options": [
188+
{
189+
"name": "family",
190+
"description": "The font family."
191+
},
192+
{
193+
"name": "weight",
194+
"description": "The font weight."
195+
},
196+
{
197+
"name": "style",
198+
"description": "The font style."
199+
},
200+
{
201+
"name": "color",
202+
"description": "The text color."
203+
},
204+
{
205+
"name": "line-height",
206+
"description": "The distance between lines of text."
207+
}
208+
]
209+
},
210+
{
211+
"name": "brand-typography-options-monospace",
212+
"title": "monospace",
213+
"level": 3,
214+
"options": [
215+
{
216+
"name": "family",
217+
"description": "The font family."
218+
},
219+
{
220+
"name": "size",
221+
"description": "The font size."
222+
},
223+
{
224+
"name": "weight",
225+
"description": "The font weight."
226+
},
227+
{
228+
"name": "color",
229+
"description": "The text color."
230+
},
231+
{
232+
"name": "background-color",
233+
"description": "The text background color."
234+
}
235+
]
236+
},
237+
{
238+
"name": "brand-typography-options-monospace-inline",
239+
"title": "monospace-inline",
240+
"level": 3,
241+
"options": [
242+
{
243+
"name": "family",
244+
"description": "The font family."
245+
},
246+
{
247+
"name": "size",
248+
"description": "The font size."
249+
},
250+
{
251+
"name": "weight",
252+
"description": "The font weight."
253+
},
254+
{
255+
"name": "color",
256+
"description": "The text color."
257+
},
258+
{
259+
"name": "background-color",
260+
"description": "The text background color."
261+
}
262+
]
263+
},
264+
{
265+
"name": "brand-typography-options-monospace-block",
266+
"title": "monospace-block",
267+
"level": 3,
268+
"options": [
269+
{
270+
"name": "family",
271+
"description": "The font family."
272+
},
273+
{
274+
"name": "size",
275+
"description": "The font size."
276+
},
277+
{
278+
"name": "weight",
279+
"description": "The font weight."
280+
},
281+
{
282+
"name": "color",
283+
"description": "The text color."
284+
},
285+
{
286+
"name": "background-color",
287+
"description": "The text background color."
288+
},
289+
{
290+
"name": "line-height",
291+
"description": "The distance between lines of text."
292+
}
293+
]
294+
},
295+
{
296+
"name": "brand-typography-options-link",
297+
"title": "link",
298+
"level": 3,
299+
"options": [
300+
{
301+
"name": "weight",
302+
"description": "The font weight."
303+
},
304+
{
305+
"name": "color",
306+
"description": "The text color."
307+
},
308+
{
309+
"name": "background-color",
310+
"description": "The text background color."
311+
},
312+
{
313+
"name": "decoration",
314+
"description": "The text decoration, i.e. underline"
157315
}
158316
]
159317
}

docs/reference/reference.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function Pandoc(doc)
5252
local groups = jsonDecode(refJson)
5353
for _,group in ipairs(groups) do
5454
-- title
55-
doc.blocks:insert(pandoc.Header(2, markdownToInlines(group.title), pandoc.Attr(autoId(group.title))))
55+
doc.blocks:insert(pandoc.Header(group.level or 2, markdownToInlines(group.title), pandoc.Attr(autoId(group.title))))
5656
-- optionalal description
5757
if group.description then
5858
local description = pandoc.read(group.description).blocks

tools/reference.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,28 @@ function readDefinitionsId(id: string, descriptions?: Record<string, string>) {
267267
return results;
268268
}
269269

270+
function readTypographyOptions(id: string, toFollow: Array<string>) {
271+
const obj = definitions.find(value => value.id === id) as any;
272+
273+
const baseObject = (obj["object"] || obj["schema"]["object"]);
274+
const props = baseObject["properties"];
275+
const descriptions = {};
276+
277+
for (const [key, prop] of Object.entries(props).filter(([_, {ref}]) => ref)) {
278+
if (prop.hidden) {
279+
continue;
280+
}
281+
const shortref = prop.ref.replace(/^brand-typography-options-/, '');
282+
descriptions[key] = asDescriptionString(findVal(prop, "description")) +" See [" + shortref + "](#" + shortref + ") for more information.";
283+
toFollow.push(prop.ref)
284+
}
285+
286+
const results = [];
287+
results.push(...readProjectProperties(props, descriptions));
288+
289+
return results;
290+
}
291+
270292
function readNavigationItem(descriptions?: Record<string, string>) {
271293
const obj = definitions.find(value => value.id === "navigation-item") as any;
272294
const refId = obj["anyOf"][1]["ref"];
@@ -343,6 +365,19 @@ const brandOptions = readDefinitionsId("brand",{
343365
"defaults": "Default settings"
344366
});
345367

368+
const toFollow : Array<string> = []
369+
370+
const typographyOptionDescriptions = {
371+
"family": "The font family.",
372+
"size": "The font size.",
373+
"weight": "The font weight.",
374+
"style": "The font style.",
375+
"color": "The text color.",
376+
"background-color": "The text background color.",
377+
"decoration": "The text decoration, i.e. underline",
378+
"line-height": "The distance between lines of text.",
379+
};
380+
346381
const brandMetadata = [
347382
{
348383
"name": "brand",
@@ -367,8 +402,22 @@ const brandMetadata = [
367402
{
368403
"name": "brand-typography",
369404
"title": "Typography",
370-
"options": readDefinitionsId("brand-typography")
371-
}
405+
"options": readTypographyOptions("brand-typography", toFollow)
406+
},
407+
...toFollow.map(id => {
408+
const typography = definitions.find(value => value.id === id);
409+
const root = typography?.["anyOf"][1]?.object;
410+
if (root?.properties) {
411+
return {
412+
"name": id,
413+
"title": id.replace(/^brand-typography-options-/, ''),
414+
"level": 3,
415+
"options": readProjectProperties(root.properties, typographyOptionDescriptions)
416+
}
417+
} else {
418+
return null;
419+
}
420+
}).filter(x => x),
372421
]
373422
Deno.writeTextFileSync(`docs/reference/metadata/brand.json`, JSON.stringify(brandMetadata, undefined, 2));
374423

0 commit comments

Comments
 (0)