Skip to content

Commit bf9f568

Browse files
authored
Create some initial templates for md (#2145)
* Create some initial templates for md * Add footer, include head and footer in other templates * Fix in enum template
1 parent 5272c6a commit bf9f568

36 files changed

+868
-2
lines changed

lib/src/model/category.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Category extends Nameable
127127
@override
128128
String get href => isCanonical ? '${package.baseHref}$filePath' : null;
129129

130-
String get categorization => _categoryRenderer.renderCategoryLabel(this);
130+
String get categoryLabel => _categoryRenderer.renderCategoryLabel(this);
131131

132132
String get linkedName => _categoryRenderer.renderLinkedName(this);
133133

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#hasCategoryNames}}
22
{{#displayedCategories}}
3-
{{{categorization}}}
3+
{{{categoryLabel}}}
44
{{/displayedCategories}}
55
{{/hasCategoryNames}}

lib/templates/md/404error.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 404
2+
3+
Oops, something's gone wrong :-(
4+
5+
You've tried to visit a page that doesn't exist. Luckily this site has other
6+
[pages](index.md).

lib/templates/md/_accessor_getter.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{#getter}}
2+
{{{ linkedReturnType }}} {{>name_summary}}
3+
{{>features}}
4+
5+
{{>documentation}}
6+
{{>source_code}}
7+
{{/getter}}

lib/templates/md/_accessor_setter.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{#setter}}
2+
{{>name_summary}}({{{ linkedParamsNoMetadata }}})
3+
{{>features}}
4+
5+
{{>documentation}}
6+
{{>source_code}}
7+
{{/setter}}

lib/templates/md/_callable.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#isDeprecated}}~~{{/isDeprecated}}{{{linkedName}}}{{{linkedGenericParameters}}}({{{ linkedParamsNoMetadata }}}) {{{ linkedReturnType }}} {{>categorization}}{{#isDeprecated}}~~{{/isDeprecated}}
2+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
3+
{{>features}}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{#hasAnnotations}}
2+
{{#annotations}}
3+
- {{{.}}}
4+
{{/annotations}}
5+
{{/hasAnnotations}}
6+
7+
{{{ linkedReturnType }}} {{>name_summary}}{{{genericParameters}}}({{#hasParameters}}{{{linkedParamsLines}}}{{/hasParameters}})

lib/templates/md/_categorization.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{#hasCategoryNames}}
2+
{{#displayedCategories}}
3+
{{{categoryLabel}}}
4+
{{/displayedCategories}}
5+
{{/hasCategoryNames}}

lib/templates/md/_class.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{#isDeprecated}}~~{{/isDeprecated}}{{{linkedName}}}{{{linkedGenericParameters}}} {{>categorization}}{{#isDeprecated}}~~{{/isDeprecated}}
2+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}

lib/templates/md/_constant.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#isDeprecated}}~~{{/isDeprecated}}{{{ linkedName }}} const {{{ linkedReturnType }}} {{>categorization}}{{#isDeprecated}}~~{{/isDeprecated}}
2+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
3+
{{>features}}

lib/templates/md/_documentation.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#hasDocumentation}}
2+
{{{ documentationAsHtml }}}
3+
{{/hasDocumentation}}

lib/templates/md/_extension.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{#isDeprecated}}~~{{/isDeprecated}}{{{linkedName}}} {{>categorization}}{{#isDeprecated}}~~{{/isDeprecated}}
2+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}

lib/templates/md/_features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ #featuresAsString.isNotEmpty }}_{{{featuresAsString}}}_{{ /featuresAsString.isNotEmpty }}

lib/templates/md/_footer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{! markdown has no dedicated footer element, so both placeholders are siblings }}
2+
{{! footer-text placeholder }}
3+
{{! footer placeholder }}

lib/templates/md/_head.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{! header placeholder }}

lib/templates/md/_library.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{{ linkedName }}} ({{>categorization}})
2+
{{#isDocumented}}
3+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
4+
{{/isDocumented}}

lib/templates/md/_mixin.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{#isDeprecated}}~~{{/isDeprecated}}{{{linkedName}}}{{{linkedGenericParameters}}} {{>categorization}}{{#isDeprecated}}~~{{/isDeprecated}}
2+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}

lib/templates/md/_name_summary.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{#isConst}}const {{/isConst}}{{#isDeprecated}}~~{{/isDeprecated}}{{name}}{{#isDeprecated}}~~{{/isDeprecated}}

lib/templates/md/_property.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{{linkedName}}} {{{ arrow }}} {{{ linkedReturnType }}} {{>categorization}}
2+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
3+
{{>features}}

lib/templates/md/_source_code.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{#hasSourceCode}}
2+
## Implementation
3+
4+
```dart
5+
{{{ sourceCode }}}
6+
```
7+
{{/hasSourceCode}}

lib/templates/md/_source_link.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#hasSourceHref}}
2+
[source]({{{sourceHref}}})
3+
{{/hasSourceHref}}

lib/templates/md/category.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{{>head}}
2+
3+
{{#self}}
4+
# {{name}} {{kind}}
5+
6+
{{>documentation}}
7+
8+
{{#hasPublicLibraries}}
9+
## Libraries
10+
11+
{{#publicLibraries}}
12+
{{>library}}
13+
{{/publicLibraries}}
14+
{{/hasPublicLibraries}}
15+
16+
{{#hasPublicClasses}}
17+
## Classes
18+
19+
{{#publicClasses}}
20+
{{>class}}
21+
{{/publicClasses}}
22+
{{/hasPublicClasses}}
23+
24+
{{#hasPublicMixins}}
25+
## Mixins
26+
27+
{{#publicMixins}}
28+
{{>mixin}}
29+
{{/publicMixins}}
30+
{{/hasPublicMixins}}
31+
32+
{{#hasPublicConstants}}
33+
## Constants
34+
35+
{{#publicConstants}}
36+
{{>constant}}
37+
{{/publicConstants}}
38+
{{/hasPublicConstants}}
39+
40+
{{#hasPublicProperties}}
41+
## Properties
42+
43+
{{#publicProperties}}
44+
{{>property}}
45+
{{/publicProperties}}
46+
{{/hasPublicProperties}}
47+
48+
{{#hasPublicFunctions}}
49+
## Functions
50+
51+
{{#publicFunctions}}
52+
{{>callable}}
53+
{{/publicFunctions}}
54+
{{/hasPublicFunctions}}
55+
56+
{{#hasPublicEnums}}
57+
## Enums
58+
59+
{{#publicEnums}}
60+
{{>class}}
61+
{{/publicEnums}}
62+
{{/hasPublicEnums}}
63+
64+
{{#hasPublicTypedefs}}
65+
## Typedefs
66+
67+
{{#publicTypedefs}}
68+
{{>callable}}
69+
{{/publicTypedefs}}
70+
{{/hasPublicTypedefs}}
71+
72+
{{#hasPublicExceptions}}
73+
## Exceptions / Errors
74+
75+
{{#publicExceptions}}
76+
{{>class}}
77+
{{/publicExceptions}}
78+
{{/hasPublicExceptions}}
79+
{{/self}}
80+
81+
{{>footer}}

lib/templates/md/class.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{{>head}}
2+
3+
{{#self}}
4+
# {{{nameWithGenerics}}} {{kind}}
5+
6+
{{>source_link}}
7+
{{>categorization}}
8+
{{/self}}
9+
10+
{{#clazz}}
11+
{{>documentation}}
12+
13+
{{#hasModifiers}}
14+
{{#hasPublicSuperChainReversed}}
15+
**Inheritance**
16+
17+
- {{{linkedObjectType}}}
18+
{{#publicSuperChainReversed}}
19+
- {{{linkedName}}}
20+
{{/publicSuperChainReversed}}
21+
- {{{name}}}
22+
{{/hasPublicSuperChainReversed}}
23+
24+
{{#hasPublicInterfaces}}
25+
**Implemented types**
26+
27+
{{#publicInterfaces}}
28+
- {{{linkedName}}}
29+
{{/publicInterfaces}}
30+
{{/hasPublicInterfaces}}
31+
32+
{{#hasPublicMixins}}
33+
**Mixed in types**
34+
35+
{{#publicMixins}}
36+
- {{{linkedName}}}
37+
{{/publicMixins}}
38+
{{/hasPublicMixins}}
39+
40+
{{#hasPublicImplementors}}
41+
**Implementers**
42+
43+
{{#publicImplementors}}
44+
- {{{linkedName}}}
45+
{{/publicImplementors}}
46+
{{/hasPublicImplementors}}
47+
48+
{{#hasPotentiallyApplicableExtensions}}
49+
**Available Extensions**
50+
51+
{{#potentiallyApplicableExtensions}}
52+
- {{{linkedName}}}
53+
{{/potentiallyApplicableExtensions}}
54+
{{/hasPotentiallyApplicableExtensions}}
55+
56+
{{#hasAnnotations}}
57+
**Annotations**
58+
59+
{{#annotations}}
60+
- {{{.}}}
61+
{{/annotations}}
62+
{{/hasAnnotations}}
63+
{{/hasModifiers}}
64+
65+
{{#hasPublicConstructors}}
66+
## Constructors
67+
68+
{{#publicConstructors}}
69+
{{{linkedName}}} ({{{ linkedParams }}})
70+
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
71+
{{#isConst}}const{{/isConst}} {{#isFactory}}factory{{/isFactory}}
72+
{{/publicConstructors}}
73+
{{/hasPublicConstructors}}
74+
75+
{{#hasPublicProperties}}
76+
## Properties
77+
78+
{{#allPublicInstanceProperties}}
79+
{{>property}}
80+
{{/allPublicInstanceProperties}}
81+
{{/hasPublicProperties}}
82+
83+
{{#hasPublicMethods}}
84+
## Methods
85+
86+
{{#allPublicInstanceMethods}}
87+
{{>callable}}
88+
{{/allPublicInstanceMethods}}
89+
{{/hasPublicMethods}}
90+
91+
{{#hasPublicOperators}}
92+
## Operators
93+
94+
{{#allPublicOperators}}
95+
{{>callable}}
96+
{{/allPublicOperators}}
97+
{{/hasPublicOperators}}
98+
99+
{{#hasPublicStaticProperties}}
100+
## Static Properties
101+
102+
{{#publicStaticProperties}}
103+
{{>property}}
104+
{{/publicStaticProperties}}
105+
{{/hasPublicStaticProperties}}
106+
107+
{{#hasPublicStaticMethods}}
108+
## Static Methods
109+
110+
{{#publicStaticMethods}}
111+
{{>callable}}
112+
{{/publicStaticMethods}}
113+
{{/hasPublicStaticMethods}}
114+
115+
{{#hasPublicConstants}}
116+
## Constants
117+
118+
{{#publicConstants}}
119+
{{>constant}}
120+
{{/publicConstants}}
121+
{{/hasPublicConstants}}
122+
{{/clazz}}
123+
124+
{{>footer}}

lib/templates/md/constant.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{>head}}
2+
3+
{{#self}}
4+
# {{{name}}} {{kind}}
5+
6+
{{>source_link}}
7+
{{/self}}
8+
9+
{{#property}}
10+
{{{ linkedReturnType }}} {{>name_summary}} = {{{ constantValue }}}
11+
12+
{{>documentation}}
13+
{{>source_code}}
14+
{{/property}}
15+
16+
{{>footer}}

lib/templates/md/constructor.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{>head}}
2+
3+
{{#self}}
4+
# {{{nameWithGenerics}}} {{kind}}
5+
6+
{{>source_link}}
7+
{{/self}}
8+
9+
{{#constructor}}
10+
{{#hasAnnotations}}
11+
{{#annotations}}
12+
- {{{.}}}
13+
{{/annotations}}
14+
{{/hasAnnotations}}
15+
16+
{{#isConst}}const{{/isConst}}
17+
{{#isDeprecated}}~~{{/isDeprecated}}{{{nameWithGenerics}}}({{#hasParameters}}{{{linkedParamsLines}}}{{/hasParameters}}){{#isDeprecated}}~~{{/isDeprecated}}
18+
19+
{{>documentation}}
20+
21+
{{>source_code}}
22+
23+
{{/constructor}}
24+
25+
{{>footer}}

0 commit comments

Comments
 (0)