Skip to content

Markdown template tweaks #2162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/src/model/categorization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ abstract class Categorization implements ModelElement {
return categories.where((c) => c.isDocumented);
}

bool get hasDisplayedCategories => displayedCategories.isNotEmpty;

/// True if categories, subcategories, a documentation icon, or samples were
/// declared.
bool get hasCategorization {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/render/type_parameters_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ class TypeParametersRendererMd extends TypeParametersRenderer {
return '';
}
var joined = typeParameters.map(mapfn).join(', ');
return '<${joined}>';
return '&lt;${joined}>';
}
}
3 changes: 2 additions & 1 deletion lib/templates/md/_accessor_getter.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{#getter}}
{{{ linkedReturnType }}} {{>name_summary}}
{{{ linkedReturnType }}} {{>name_summary}} {{!two spaces intentional}}
{{>features}}

{{>documentation}}

{{>source_code}}
{{/getter}}
3 changes: 2 additions & 1 deletion lib/templates/md/_accessor_setter.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{#setter}}
{{>name_summary}}({{{ linkedParamsNoMetadata }}})
{{>name_summary}}({{{ linkedParamsNoMetadata }}}) {{!two spaces intentional}}
{{>features}}

{{>documentation}}

{{>source_code}}
{{/setter}}
6 changes: 4 additions & 2 deletions lib/templates/md/_callable.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{{linkedName}}}{{{linkedGenericParameters}}}({{{ linkedParamsNoMetadata }}}) {{{ linkedReturnType }}} {{>categorization}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
##### {{{linkedName}}}{{{linkedGenericParameters}}}({{{ linkedParamsNoMetadata }}}) {{{ linkedReturnType }}}
{{>categorization}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}} {{!two spaces intentional}}
{{>features}}
5 changes: 3 additions & 2 deletions lib/templates/md/_categorization.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{#hasCategoryNames}}
{{#hasDisplayedCategories}}
Categories:
{{#displayedCategories}}
{{{categoryLabel}}}
{{/displayedCategories}}
{{/hasCategoryNames}}
{{/hasDisplayedCategories}}
6 changes: 4 additions & 2 deletions lib/templates/md/_class.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{{{linkedName}}}{{{linkedGenericParameters}}} {{>categorization}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
##### {{{linkedName}}}{{{linkedGenericParameters}}}
{{>categorization}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}}
6 changes: 4 additions & 2 deletions lib/templates/md/_constant.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{{ linkedName }}} const {{{ linkedReturnType }}} {{>categorization}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
##### {{{ linkedName }}} const {{{ linkedReturnType }}}
{{>categorization}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}} {{!two spaces intentional}}
{{>features}}
6 changes: 4 additions & 2 deletions lib/templates/md/_extension.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{{{linkedName}}} {{>categorization}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
##### {{{linkedName}}}
{{>categorization}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}}
5 changes: 3 additions & 2 deletions lib/templates/md/_library.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{{ linkedName }}} ({{>categorization}})
##### {{{ linkedName }}}
{{#isDocumented}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
{{{ oneLineDoc }}} {{{ extendedDocLink }}}

{{/isDocumented}}
6 changes: 4 additions & 2 deletions lib/templates/md/_mixin.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{{{linkedName}}}{{{linkedGenericParameters}}} {{>categorization}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
##### {{{linkedName}}}{{{linkedGenericParameters}}}
{{>categorization}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}}
6 changes: 4 additions & 2 deletions lib/templates/md/_property.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{{linkedName}}} {{{ arrow }}} {{{ linkedReturnType }}} {{>categorization}}
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
##### {{{linkedName}}} {{{ arrow }}} {{{ linkedReturnType }}}
{{>categorization}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}} {{!two spaces intentional}}
{{>features}}
2 changes: 1 addition & 1 deletion lib/templates/md/_source_link.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#hasSourceHref}}
[source]({{{sourceHref}}})
[view source]({{{sourceHref}}})
{{/hasSourceHref}}
9 changes: 9 additions & 0 deletions lib/templates/md/category.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

{{#publicLibraries}}
{{>library}}

{{/publicLibraries}}
{{/hasPublicLibraries}}

Expand All @@ -18,6 +19,7 @@

{{#publicClasses}}
{{>class}}

{{/publicClasses}}
{{/hasPublicClasses}}

Expand All @@ -26,6 +28,7 @@

{{#publicMixins}}
{{>mixin}}

{{/publicMixins}}
{{/hasPublicMixins}}

Expand All @@ -34,6 +37,7 @@

{{#publicConstants}}
{{>constant}}

{{/publicConstants}}
{{/hasPublicConstants}}

Expand All @@ -42,6 +46,7 @@

{{#publicProperties}}
{{>property}}

{{/publicProperties}}
{{/hasPublicProperties}}

Expand All @@ -50,6 +55,7 @@

{{#publicFunctions}}
{{>callable}}

{{/publicFunctions}}
{{/hasPublicFunctions}}

Expand All @@ -58,6 +64,7 @@

{{#publicEnums}}
{{>class}}

{{/publicEnums}}
{{/hasPublicEnums}}

Expand All @@ -66,6 +73,7 @@

{{#publicTypedefs}}
{{>callable}}

{{/publicTypedefs}}
{{/hasPublicTypedefs}}

Expand All @@ -74,6 +82,7 @@

{{#publicExceptions}}
{{>class}}

{{/publicExceptions}}
{{/hasPublicExceptions}}
{{/self}}
Expand Down
12 changes: 10 additions & 2 deletions lib/templates/md/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@

{{#publicConstructors}}
{{{linkedName}}} ({{{ linkedParams }}})
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
{{#isConst}}const{{/isConst}} {{#isFactory}}factory{{/isFactory}}

{{{ oneLineDoc }}} {{{ extendedDocLink }}} {{!two spaces intentional}}
{{#isConst}}_const_{{/isConst}} {{#isFactory}}_factory_{{/isFactory}}

{{/publicConstructors}}
{{/hasPublicConstructors}}

Expand All @@ -77,6 +79,7 @@

{{#allPublicInstanceProperties}}
{{>property}}

{{/allPublicInstanceProperties}}
{{/hasPublicProperties}}

Expand All @@ -85,6 +88,7 @@

{{#allPublicInstanceMethods}}
{{>callable}}

{{/allPublicInstanceMethods}}
{{/hasPublicMethods}}

Expand All @@ -93,6 +97,7 @@

{{#allPublicOperators}}
{{>callable}}

{{/allPublicOperators}}
{{/hasPublicOperators}}

Expand All @@ -101,6 +106,7 @@

{{#publicStaticProperties}}
{{>property}}

{{/publicStaticProperties}}
{{/hasPublicStaticProperties}}

Expand All @@ -109,6 +115,7 @@

{{#publicStaticMethods}}
{{>callable}}

{{/publicStaticMethods}}
{{/hasPublicStaticMethods}}

Expand All @@ -117,6 +124,7 @@

{{#publicConstants}}
{{>constant}}

{{/publicConstants}}
{{/hasPublicConstants}}
{{/clazz}}
Expand Down
1 change: 1 addition & 0 deletions lib/templates/md/constant.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{{{ linkedReturnType }}} {{>name_summary}} = {{{ constantValue }}}

{{>documentation}}

{{>source_code}}
{{/property}}

Expand Down
14 changes: 11 additions & 3 deletions lib/templates/md/enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@

{{#publicConstants}}
{{>constant}}

{{/publicConstants}}
{{/hasPublicConstants}}

{{#hasPublicConstructors}}
## Constructors

{{#publicConstructors}}
{{{linkedName}}} ({{{ linkedParams }}})
: {{{ oneLineDoc }}} {{{ extendedDocLink }}}
{{#isConst}}const{{/isConst}} {{#isFactory}}factory{{/isFactory}}
{{{linkedName}}}({{{ linkedParams }}})

{{{ oneLineDoc }}} {{{ extendedDocLink }}} {{!two spaces intentional}}
{{#isConst}}_const_{{/isConst}} {{#isFactory}}_factory_{{/isFactory}}

{{/publicConstructors}}
{{/hasPublicConstructors}}

Expand All @@ -77,6 +80,7 @@

{{#allPublicInstanceProperties}}
{{>property}}

{{/allPublicInstanceProperties}}
{{/hasPublicProperties}}

Expand All @@ -85,6 +89,7 @@

{{#allPublicInstanceMethods}}
{{>callable}}

{{/allPublicInstanceMethods}}
{{/hasPublicMethods}}

Expand All @@ -93,6 +98,7 @@

{{#allPublicOperators}}
{{>callable}}

{{/allPublicOperators}}
{{/hasPublicOperators}}

Expand All @@ -101,6 +107,7 @@

{{#publicStaticProperties}}
{{>property}}

{{/publicStaticProperties}}
{{/hasPublicStaticProperties}}

Expand All @@ -109,6 +116,7 @@

{{#publicStaticMethods}}
{{>callable}}

{{/publicStaticMethods}}
{{/hasPublicStaticMethods}}
{{/eNum}}
Expand Down
13 changes: 8 additions & 5 deletions lib/templates/md/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@

{{#self}}
# {{{nameWithGenerics}}} {{kind}}
on {{#extendedType}}{{{linkedName}}}{{/extendedType}}

{{>source_link}}

{{>categorization}}
{{/self}}

{{#extension}}
{{>documentation}}

on
{{#extendedType}}
: {{{linkedName}}}
{{/extendedType}}

{{#hasPublicProperties}}
## Properties

{{#allPublicInstanceProperties}}
{{>property}}

{{/allPublicInstanceProperties}}
{{/hasPublicProperties}}

Expand All @@ -28,6 +26,7 @@ on

{{#allPublicInstanceMethods}}
{{>callable}}

{{/allPublicInstanceMethods}}
{{/hasPublicMethods}}

Expand All @@ -36,6 +35,7 @@ on

{{#allPublicOperators}}
{{>callable}}

{{/allPublicOperators}}
{{/hasPublicOperators}}

Expand All @@ -44,6 +44,7 @@ on

{{#publicStaticProperties}}
{{>property}}

{{/publicStaticProperties}}
{{/hasPublicStaticProperties}}

Expand All @@ -52,6 +53,7 @@ on

{{#publicStaticMethods}}
{{>callable}}

{{/publicStaticMethods}}
{{/hasPublicStaticMethods}}

Expand All @@ -60,6 +62,7 @@ on

{{#publicConstants}}
{{>constant}}

{{/publicConstants}}
{{/hasPublicConstants}}
{{/extension}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/md/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{{/defaultCategory.publicLibraries}}

{{#categoriesWithPublicLibraries}}
### {{name}}
### Category {{{categoryLabel}}}

{{#publicLibraries}}
{{>library}}
Expand Down
Loading