A semantic search engine for source code https://bitshift.benkurtovic.com/
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

23 righe
553 B

  1. """
  2. Module contains helper functions to be used inside the project's Jinja
  3. templates.
  4. """
  5. from flask import Markup
  6. ASSET_HTML_TEMPLATES = {
  7. 'css': "<link rel='stylesheet' type='text/css' href='/static/css/%s'>",
  8. 'js': "<script src='/static/js/%s'></script>"
  9. }
  10. def tag(filename):
  11. """
  12. Return HTML tag for asset named filename.
  13. Return either a <script> or <link> tag to the file named filename,
  14. based on its extension.
  15. """
  16. file_ext = filename.split(".")[-1]
  17. return Markup(ASSET_HTML_TEMPLATES[file_ext] % filename)