A semantic search engine for source code https://bitshift.benkurtovic.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
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)