Template:Embed text

  • Revision slug: Template:Embed_text
  • Revision title: Template:Embed text
  • Revision id: 290717
  • 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;   var allFiles = env.files || [];       allFiles.forEach(function(aFile) { %><%= aFile.name %>
<%     if ($0 === aFile.name) {       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;
  var allFiles = env.files || [];
  
  
  allFiles.forEach(function(aFile) {
%><%= aFile.name %><br><%
    if ($0 === aFile.name) {
      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