Skip to content

Commit

Permalink
Add @apiDeprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
rottmann committed Jan 13, 2017
1 parent 08eaf40 commit 9edff16
Showing 2 changed files with 23 additions and 7 deletions.
13 changes: 6 additions & 7 deletions template/index.html
Original file line number Diff line number Diff line change
@@ -118,16 +118,15 @@ <h1>{{article.groupTitle}}{{#if article.title}} - {{article.title}}{{/if}}</h1>
{{/if}}
<div class="clearfix"></div>

{{#if article.description}}
<p>{{{nl2br article.description}}}</p>
{{/if}}
{{#if article.deprecated}}
<p class="deprecated"><span>DEPRECATED</span>
{{#if article.deprecated.url}}
use <a href="#api-{{article.deprecated.group}}-{{article.deprecated.url}}">{{article.deprecated.name}}</a>
{{/if}}
<p class="deprecated"><span>{{__ "DEPRECATED"}}</span>
{{{markdown article.deprecated.content}}}
</p>
{{/if}}

{{#if article.description}}
<p>{{{nl2br article.description}}}</p>
{{/if}}
<pre class="prettyprint language-html" data-type="{{toLowerCase article.type}}"><code>{{article.url}}</code></pre>

{{#if article.permission}}
17 changes: 17 additions & 0 deletions template/utils/handlebars_helper.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,23 @@ define([
'diffMatchPatch'
], function(locale, Handlebars, DiffMatchPatch) {

/**
* Return a text as markdown.
* Currently only a little helper to replace apidoc-inline Links (#Group:Name).
* Should be replaced with a full markdown lib.
* @param string text
*/
Handlebars.registerHelper('markdown', function(text) {
if ( ! text ) {
return text;
}
text = text.replace(/((\[(.*?)\])?\(#)((.+?):(.+?))(\))/mg, function(match, p1, p2, p3, p4, p5, p6) {
var link = p3 || p5 + '/' + p6;
return '<a href="#api-' + p5 + '-' + p6 + '">' + link + '</a>';
});
return text;
});

/**
* start/stop timer for simple performance check.
*/

0 comments on commit 9edff16

Please sign in to comment.