mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-20 04:11:51 +00:00
remove extra toolbar directive and support multiple pre's in describe
This commit is contained in:
parent
fc78738cc6
commit
71c2f24fc6
2 changed files with 15 additions and 3 deletions
|
|
@ -142,12 +142,12 @@ function escapedHtmlTag(doc, name, value) {
|
||||||
|
|
||||||
function markdownTag(doc, name, value) {
|
function markdownTag(doc, name, value) {
|
||||||
doc[name] = markdown(value.replace(/^#/gm, '##')).
|
doc[name] = markdown(value.replace(/^#/gm, '##')).
|
||||||
replace(/\<pre\>/gmi, '<div ng:non-bindable><pre class="brush: js; html-script: true; toolbar: false;">').
|
replace(/\<pre\>/gmi, '<div ng:non-bindable><pre class="brush: js; html-script: true;">').
|
||||||
replace(/\<\/pre\>/gmi, '</pre></div>');
|
replace(/\<\/pre\>/gmi, '</pre></div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function markdown(text) {
|
function markdown(text) {
|
||||||
var parts = text.split(/(<pre>[\s\S]*<\/pre>)/);
|
var parts = text.split(/(<pre>[\s\S]*?<\/pre>)/);
|
||||||
parts.forEach(function(text, i){
|
parts.forEach(function(text, i){
|
||||||
if (!text.match(/^<pre>/)) {
|
if (!text.match(/^<pre>/)) {
|
||||||
text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>');
|
text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>');
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,19 @@ describe('collect', function(){
|
||||||
describe('@description', function(){
|
describe('@description', function(){
|
||||||
it('should support pre blocks', function(){
|
it('should support pre blocks', function(){
|
||||||
TAG.description(doc, 'description', '<pre>abc</pre>');
|
TAG.description(doc, 'description', '<pre>abc</pre>');
|
||||||
expect(doc.description).toEqual('<div ng:non-bindable><pre class="brush: js; html-script: true; toolbar: false;">abc</pre></div>');
|
expect(doc.description).
|
||||||
|
toBe('<div ng:non-bindable><pre class="brush: js; html-script: true;">abc</pre></div>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should support multiple pre blocks', function() {
|
||||||
|
TAG.description(doc, 'description', 'foo \n<pre>abc</pre>\n#bah\nfoo \n<pre>cba</pre>');
|
||||||
|
expect(doc.description).
|
||||||
|
toBe('<p>foo </p>' +
|
||||||
|
'<div ng:non-bindable><pre class="brush: js; html-script: true;">abc</pre></div>' +
|
||||||
|
'<h2>bah</h2>\n\n' +
|
||||||
|
'<p>foo </p>' +
|
||||||
|
'<div ng:non-bindable><pre class="brush: js; html-script: true;">cba</pre></div>');
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue