From 081de07a27637dd3068d073f9aaf4c1d63334ce7 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sun, 13 Mar 2016 17:42:35 -0400 Subject: [PATCH 1/2] chore(docs): add platforms decorator --- scripts/docs/templates/common.template.html | 193 +++++++++++--------- 1 file changed, 103 insertions(+), 90 deletions(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index b8da35c3..b1becc38 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -12,65 +12,65 @@ docType: "<$ doc.docType $>" --- <@ macro paramList(paramData) -@> - <@- if paramData -@>( +<@- if paramData -@>( <@- for param in paramData -@> <$ param | escape $><@ if not loop.last @>, <@ endif @> <@- endfor @>) - <@- endif @> +<@- endif @> <@- endmacro -@> <@ macro githubViewLink(doc) -@> - <$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>) +<$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>) <@- endmacro -@> <@ macro paramTable(params, isDirective) -@> - - - - - + + + + + - <@ for param in params @> - - - - - - <@ endfor @> + <@ for param in params @> + + + + + + <@ endfor @>
<@ if isDirective @>Attr<@ else @>Param<@ endif @>TypeDetails
<@ if isDirective @>Attr<@ else @>Param<@ endif @>TypeDetails
- <$ param.name $> - <@ if param.alias @>| <$ param.alias $><@ endif @> - <@ if param.type.optional @>
(optional)
<@ endif @> -
- <$ typeList(param.typeList) $> - - <$ param.description | marked $> - <@ if param.default @>

(default: <$ param.default $>)

<@ endif @> -
+ <$ param.name $> + <@ if param.alias @>| <$ param.alias $><@ endif @> + <@ if param.type.optional @>
(optional)
<@ endif @> +
+ <$ typeList(param.typeList) $> + + <$ param.description | marked $> + <@ if param.default @>

(default: <$ param.default $>)

<@ endif @> +
<@- endmacro -@> <@- macro functionSyntax(fn) @> - <@- set sep = joiner(', ') -@> - <$ fn.name $>(<@- for param in fn.params @><$ sep() $> +<@- set sep = joiner(', ') -@> +<$ fn.name $>(<@- for param in fn.params @><$ sep() $> <@- if param.type.optional @>[<@ endif -@> <$ param.name $> <@- if param.type.optional @>]<@ endif -@> <@ endfor @>) - <@ if fn.alias @>(alias: <$ fn.alias $>)<@ endif @> +<@ if fn.alias @>(alias: <$ fn.alias $>)<@ endif @> <@ endmacro -@> <@ macro typeList(types) -@> - <@ set separator = joiner("|") @> - <@ for type in types @><$ separator() $><$ type | code $><@ endfor @> +<@ set separator = joiner("|") @> +<@ for type in types @><$ separator() $><$ type | code $><@ endfor @> <@- endmacro -@> <@- macro typeInfo(fn) -@> - <$ typeList(fn.typeList) $> <$ fn.description $> +<$ typeList(fn.typeList) $> <$ fn.description $> <@- endmacro -@> <@ block body @> @@ -82,30 +82,30 @@ docType: "<$ doc.docType $>"

-<@ if doc.docType == "directive" @> -<$ doc.name | dashCase $> -<@ else @> -<$ doc.name $> -<@ endif @> + <@ if doc.docType == "directive" @> + <$ doc.name | dashCase $> + <@ else @> + <$ doc.name $> + <@ endif @> -<@ if doc.parent @> -
- -Child of <$ doc.parent $> - -<@ endif @> + <@ if doc.parent @> +
+ + Child of <$ doc.parent $> + + <@ endif @> -<@ if doc.delegate @> -
- -Delegate: <$ doc.delegate $> - -<@ endif @> + <@ if doc.delegate @> +
+ + Delegate: <$ doc.delegate $> + + <@ endif @>

-Improve this doc + Improve this doc <@ if doc.codepen @> @@ -119,9 +119,9 @@ Improve this doc <@ for prop in doc.decorators[0].argumentInfo @>
$ ionic plugin add <$ prop.plugin $>

Repo: - -<$ prop.repo $> - + + <$ prop.repo $> +

<@ endfor @> <@ endif -@> @@ -137,6 +137,14 @@ Improve this doc

<$ doc.directiveInfo.properties[0].name $>: <$ doc.directiveInfo.properties[0].values $>

<@ endif -@> + +<@ if doc.platforms @> +

Supported platforms

+<@ block platforms @> +<$ doc.platforms $> +<@ endblock @> +<@ endif @> + <@ if doc.usage @>

Usage

@@ -149,42 +157,42 @@ Improve this doc <@ if doc.properties @>

Attributes:

- - - + + + -<@ set hasTypes = false @> -<@ for prop in doc.properties @> -<@ if prop.type @> -<@ set hasTypes = true @> -<@ endif @> -<@ endfor @> -<@ if hasTypes @> - -<@ endif @> + <@ set hasTypes = false @> + <@ for prop in doc.properties @> + <@ if prop.type @> + <@ set hasTypes = true @> + <@ endif @> + <@ endfor @> + <@ if hasTypes @> + + <@ endif @> - - - - -<@ for prop in doc.properties @> - - + + + + + <@ for prop in doc.properties @> + + -<@ if hasTypes @> - -<@ endif @> + <@ if hasTypes @> + + <@ endif @> - - -<@ endfor @> - + + + <@ endfor @> +
Attribute
AttributeTypeTypeDescription
-<$ prop.name $> -Description
+ <$ prop.name $> + -<$ prop.type.name $> - + <$ prop.type.name $> + -<$ prop.description $> -
+ <$ prop.description $> +
<@ endif @> @@ -194,6 +202,11 @@ Improve this doc

<$ functionSyntax(method) $>

+<@ if method.platforms @> +

Platforms: <$ method.platforms $>

+ +<@ endif @> + <$ method.description $> <@ if method.params @> @@ -202,14 +215,14 @@ Improve this doc <@ if method.this @>

Method's `this` -<$ method.this $> + <$ method.this $>

<@ endif @> <@ if method.returns @>
- -Returns: <$ typeInfo(method.returns) $> + + Returns: <$ typeInfo(method.returns) $>
<@ endif @> <@ endif @> @@ -225,7 +238,7 @@ Improve this doc

-<$ functionSyntax(method) $> + <$ functionSyntax(method) $>

<$ method.description $> @@ -236,14 +249,14 @@ Improve this doc <@ if method.this @>

Method's `this` -<$ method.this $> + <$ method.this $>

<@ endif @> <@ if method.returns @>
- -Returns: <$ typeInfo(method.returns) $> + + Returns: <$ typeInfo(method.returns) $>
<@ endif @> From 23db55e7c169f1e81b78c07f552a6edbd3cde4b5 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Mon, 14 Mar 2016 13:22:37 -0400 Subject: [PATCH 2/2] docs(docs): add platforms decorator output --- scripts/docs/templates/common.template.html | 35 ++++++++++++++------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index bbec1640..5b9a307d 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -123,6 +123,19 @@ docType: "<$ doc.docType $>" <$ prop.repo $>

+ +<@ if prop.platforms @> + +

Supported platforms

+<@ block platforms @> +
    + <@- for platform in prop.platforms @> +
  • <$ platform $>
  • + <@ endfor -@> +
+<@ endblock @> +<@ endif @> + <@ endfor @> <@ endif -@> @@ -137,14 +150,6 @@ docType: "<$ doc.docType $>"

<$ doc.directiveInfo.properties[0].name $>: <$ doc.directiveInfo.properties[0].values $>

<@ endif -@> - -<@ if doc.platforms @> -

Supported platforms

-<@ block platforms @> -<$ doc.platforms $> -<@ endblock @> -<@ endif @> - <@ if doc.usage @>

Usage

@@ -202,10 +207,18 @@ docType: "<$ doc.docType $>"

<$ functionSyntax(method) $>

-<@ if method.platforms @> -

Platforms: <$ method.platforms $>

- +<@- if method.decorators @> +<@ for prop in method.decorators[0].argumentInfo @> +<@ if prop.platforms @> +

Platforms:

+
    +<@- for platform in prop.platforms @> +
  • <$ platform $>
  • +<@ endfor -@> +
<@ endif @> +<@ endfor @> +<@ endif -@> <$ method.description $>