A semantic search engine for source code https://bitshift.benkurtovic.com/
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

27 行
686 B

  1. """
  2. :synopsis: Helper functions for use inside the project's Jinja templates.
  3. """
  4. from flask import Markup
  5. ASSET_HTML_TEMPLATES = {
  6. 'css': "<link rel='stylesheet' type='text/css' href='/static/css/%s'>",
  7. 'js': "<script src='/static/js/%s'></script>"
  8. }
  9. def tag(filename):
  10. """
  11. Generate an HTML tag for a CSS/JS asset, based on its file extension.
  12. :param filename: The filename of the asset to create a tag for.
  13. :type filename: str
  14. :return: A string containing a `<source>` tag for JS files, and a `<link>`
  15. for CSS files.
  16. :rtype: str
  17. """
  18. file_ext = filename.split(".")[-1]
  19. return Markup(ASSET_HTML_TEMPLATES[file_ext] % filename)