mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-24 05:43:43 +00:00
fix documentation for ie
This commit is contained in:
parent
5a3c9190dc
commit
55ce859998
3 changed files with 10 additions and 10 deletions
|
|
@ -86,7 +86,7 @@ describe('ngdoc', function(){
|
||||||
'<doc:source>\n<>\n</doc:source></doc:example> after');
|
'<doc:source>\n<>\n</doc:source></doc:example> after');
|
||||||
doc.parse();
|
doc.parse();
|
||||||
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
||||||
'<doc:source>\n<>\n</doc:source></doc:example><p>after</p>');
|
'<pre class="doc-source">\n<>\n</pre></doc:example><p>after</p>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should escape <doc:scenario> element', function(){
|
it('should escape <doc:scenario> element', function(){
|
||||||
|
|
@ -94,7 +94,7 @@ describe('ngdoc', function(){
|
||||||
'<doc:scenario>\n<>\n</doc:scenario></doc:example> after');
|
'<doc:scenario>\n<>\n</doc:scenario></doc:example> after');
|
||||||
doc.parse();
|
doc.parse();
|
||||||
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
||||||
'<doc:scenario>\n<>\n</doc:scenario></doc:example><p>after</p>');
|
'<pre class="doc-scenario">\n<>\n</pre></doc:example><p>after</p>');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('sorting', function(){
|
describe('sorting', function(){
|
||||||
|
|
@ -364,8 +364,8 @@ describe('ngdoc', function(){
|
||||||
' <doc:scenario><scenario></doc:scenario>\n' +
|
' <doc:scenario><scenario></doc:scenario>\n' +
|
||||||
'</doc:example>').parse();
|
'</doc:example>').parse();
|
||||||
var html = doc.html();
|
var html = doc.html();
|
||||||
expect(html).toContain('<doc:source><escapeme></doc:source>');
|
expect(html).toContain('<pre class="doc-source"><escapeme></pre>');
|
||||||
expect(html).toContain('<doc:scenario><scenario></doc:scenario>');
|
expect(html).toContain('<pre class="doc-scenario"><scenario></pre>');
|
||||||
expect(doc.scenarios).toEqual(['<scenario>']);
|
expect(doc.scenarios).toEqual(['<scenario>']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -77,12 +77,12 @@ Doc.prototype = {
|
||||||
} else if (text.match(/^<doc:example>/)) {
|
} else if (text.match(/^<doc:example>/)) {
|
||||||
text = text.replace(/(<doc:source>)([\s\S]*)(<\/doc:source>)/mi,
|
text = text.replace(/(<doc:source>)([\s\S]*)(<\/doc:source>)/mi,
|
||||||
function(_, before, content, after){
|
function(_, before, content, after){
|
||||||
return before + htmlEscape(content) + after;
|
return '<pre class="doc-source">' + htmlEscape(content) + '</pre>';
|
||||||
});
|
});
|
||||||
text = text.replace(/(<doc:scenario>)([\s\S]*)(<\/doc:scenario>)/mi,
|
text = text.replace(/(<doc:scenario>)([\s\S]*)(<\/doc:scenario>)/mi,
|
||||||
function(_, before, content, after){
|
function(_, before, content, after){
|
||||||
self.scenarios.push(content);
|
self.scenarios.push(content);
|
||||||
return before + htmlEscape(content) + after;
|
return '<pre class="doc-scenario">' + htmlEscape(content) + '</pre>';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>');
|
text = text.replace(/<angular\/>/gm, '<tt><angular/></tt>');
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
var angularJsUrl;
|
var angularJsUrl;
|
||||||
var scripts = document.getElementsByTagName("script");
|
var scripts = document.getElementsByTagName("script");
|
||||||
var angularJsRegex = /^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/
|
var angularJsRegex = /^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/;
|
||||||
for(var j = 0; j < scripts.length; j++) {
|
for(var j = 0; j < scripts.length; j++) {
|
||||||
var src = scripts[j].src;
|
var src = scripts[j].src;
|
||||||
if (src && src.match(angularJsRegex)) {
|
if (src && src.match(angularJsRegex)) {
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
this.descend(true); //compile the example code
|
this.descend(true); //compile the example code
|
||||||
element.hide();
|
element.hide();
|
||||||
|
|
||||||
var example = element.find('doc\\:source').eq(0),
|
var example = element.find('pre.doc-source').eq(0),
|
||||||
exampleSrc = example.text(),
|
exampleSrc = example.text(),
|
||||||
scenario = element.find('doc\\:scenario').eq(0);
|
scenario = element.find('pre.doc-scenario').eq(0);
|
||||||
|
|
||||||
var code = indent(exampleSrc);
|
var code = indent(exampleSrc);
|
||||||
var tabHtml =
|
var tabHtml =
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
function indent(text) {
|
function indent(text) {
|
||||||
if (!text) return text;
|
if (!text) return text;
|
||||||
var lines = text.split(/\n/);
|
var lines = text.split(/[\n|\r]/);
|
||||||
var lineNo = [];
|
var lineNo = [];
|
||||||
// remove any leading blank lines
|
// remove any leading blank lines
|
||||||
while (lines[0].match(/^\s*$/)) lines.shift();
|
while (lines[0].match(/^\s*$/)) lines.shift();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue