Template:Embed text

  • Revision slug: Template:Embed_text
  • Revision title: Template:Embed text
  • Revision id: 290723
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

<% /* * 2 parameters expected * $0 : the file name to embed * $1 : the syntaxe color to apply * * /!\ FIXE ME : There is a CSRF risk with an unfiltered $1 parameter */   var found = false;     env.files.forEach(function(aFile) {     if ($0 === aFile.filename) {       found = true; %>
<%= mdn.getFileContent(aFile) %>
<%     }   });     if (!found) { %>

Unable to find file <%= $0 %>

<%   } %>

Revision Source

<% 
/* 
 * 2 parameters expected
 * $0 : the file name to embed
 * $1 : the syntaxe color to apply
 *
 * /!\ FIXE ME : There is a CSRF risk with an unfiltered $1 parameter
 */
  var found = false;
  
  env.files.forEach(function(aFile) {
    if ($0 === aFile.filename) {
      found = true;
%>
<pre class="brush: <%= $1 %>"><%= mdn.getFileContent(aFile) %></pre>
<%
    }
  });
  
  if (!found) {
%><p>Unable to find file <em><%= $0 %></em></p><%
  }
%>
Revert to this revision