mozilla

Revision 344315 of Template:Embed text

  • Revision slug: Template:Embed_text
  • Revision title: Template:Embed text
  • Revision id: 344315
  • Created:
  • Creator: ethertank
  • Is current revision? Yes
  • Comment
Tags: 

Revision Content

<% /* * 2 parameters expected * $0 : the file name to embed * $1 : the syntaxe color to apply */ var found = false; var brush = ['bash', 'shell', 'css', 'java', 'js', 'jscript', 'javascript', 'php', 'py', 'python', 'sql', 'xml', 'xhtml', 'xslt', 'html', 'xhtml'] var syntaxe = "txt"; var m1 = mdn.localString({ "en-US" : "Unable to find file ", "ja" : "ファイル「 " }); var m2 = mdn.localString({ "en-US" : "", "ja" : " 」が見つかりません。" }); if (brush.indexOf($1) > -1) { syntaxe = $1; }   env.files.forEach(function(aFile) { if ($0 === aFile.filename) { found = true; %>
<%= mdn.getFileContent(aFile) %>
<% } });   if (!found) { %>

<%-m1%><%= $0 %><%-m2%>

<% }%>

Revision Source

<% 
/* 
 * 2 parameters expected
 * $0 : the file name to embed
 * $1 : the syntaxe color to apply
 */

var found = false;
var brush = ['bash', 'shell', 'css', 'java', 'js', 'jscript', 'javascript', 'php', 'py', 'python', 'sql', 'xml', 'xhtml', 'xslt', 'html', 'xhtml']
var syntaxe = "txt";

var m1 = mdn.localString({
    "en-US" : "Unable to find file ",
    "ja" : "ファイル「 "
});

var m2 = mdn.localString({
    "en-US" : "",
    "ja" : " 」が見つかりません。"
});

if (brush.indexOf($1) > -1) {
    syntaxe = $1;
}
  
env.files.forEach(function(aFile) {
    if ($0 === aFile.filename) {
        found = true;
%><pre class="brush: <%= syntaxe %>"><%= mdn.getFileContent(aFile) %></pre><%
    }
});
  
if (!found) {
    %><p><%-m1%><em><%= $0 %></em><%-m2%></p><%
}%>