Template:Embed text

<% 
/* 
 * 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><%
}%>
Search for pages that use Template:Embed text to see example use cases and how many pages use this macro.

Document Tags and Contributors

Tags: 
Contributors to this page: ethertank, trevorh, Jeremie, lmorchard, teoli, Sheppy, SamB
Last updated by: ethertank,