diff options
| author | Igor Minar | 2010-11-17 17:26:25 -0800 |
|---|---|---|
| committer | Igor Minar | 2010-11-18 02:35:29 -0800 |
| commit | 65989c6f0d13b8f205ab929999a4b9f66c8c1c93 (patch) | |
| tree | c7a2e05a696c6cdf9f9f296730aadb8303c960f1 /docs/collect.js | |
| parent | 4491bbdede825df78302301d4689dd73bcf9c256 (diff) | |
| download | angular.js-65989c6f0d13b8f205ab929999a4b9f66c8c1c93.tar.bz2 | |
add support for {@link} tags within @description and remove implicit linking
use as:
- foo {@link bar}
- foo {@link bar desc}
I'm removing implicit linking because it unintentionally links stuff and
generally interferes with other conversions. We have to link stuff explicitely
from now on.
Diffstat (limited to 'docs/collect.js')
| -rw-r--r-- | docs/collect.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/docs/collect.js b/docs/collect.js index a4db4ed1..7fe326b4 100644 --- a/docs/collect.js +++ b/docs/collect.js @@ -163,14 +163,24 @@ function markdownTag(doc, name, value) { replace(/\<\/pre\>/gmi, '</pre></div>'); } +R_LINK = /{@link ([^\s}]+)((\s|\n)+(.+?))?\s*}/m + // 1 123 3 4 42 + function markdown(text) { - var parts = text.split(/(<pre>[\s\S]*?<\/pre>)/); + var parts = text.split(/(<pre>[\s\S]*?<\/pre>)/), + match; + parts.forEach(function(text, i){ if (!text.match(/^<pre>/)) { text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>'); text = new Showdown.converter().makeHtml(text); - text = text.replace(/[^#][^!](angular\.[\$\w\._\-:]+)/gm, '<a href="#!$1">$1</a>'); - text = text.replace(/(`(ng:[\w\._\-]+)`)/gm, '<a href="#!angular.directive.$2">$1</a>'); + + while (match = text.match(R_LINK)) { + text = text.replace(match[0], '<a href="#!' + match[1] + '"><code>' + + (match[4] || match[1]) + + '</code></a>'); + } + parts[i] = text; } }); |
