-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy path_theme_template_variables.astro
28 lines (26 loc) · 1.24 KB
/
_theme_template_variables.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
---
import templates from 'src/content/json/themes/templates.json';
import Aside from 'src/components/Aside.astro';
import APIBlock from 'src/components/api/APIBlock.astro';
import API from 'src/components/api/API.astro';
import APIField from 'src/components/api/APIField.astro';
import RemovedSince from 'src/components/api/RemovedSince.astro';
import { marked } from 'marked';
templates.sort((a, b) => { return a.fieldName.toUpperCase().localeCompare(b.fieldName.toUpperCase())});
const makeId = (name) => { return name.toLowerCase().replaceAll(' ', '-') };
---
{templates.filter((t) => t.onlyAPI === undefined).map((t) =>
<APIBlock>
<h3 id={makeId(t.displayName)}>{t.displayName}</h3>
{t.version && <Aside type="version">Available since {t.version}</Aside>}
{t.path && <API method="" uri={t.path}/>}
<h4>Variables</h4>
{!t.variables && <p>No template specific variables.</p>}
{t.variables && t.variables.sort((a,b) => a.name.toUpperCase().localeCompare(b.name.toUpperCase())).map((tvar) =>
<APIField name={tvar.name} type={tvar.type} since={tvar.since} deprecated={tvar.deprecated}>
<span set:html={marked.parse(tvar.description)}></span>
{tvar.removed && <><br /><RemovedSince since={tvar.removed}/></>}
</APIFIeld>
)}
</APIBlock>
)}