comparison sat/tools/common/template.py @ 2877:f8427bf8c072

tools (common/template): always use highlight.css if present.
author Goffi <goffi@goffi.org>
date Mon, 25 Mar 2019 18:40:11 +0100
parents 003b8b4b56a7
children 68a7543ebbb3
comparison
equal deleted inserted replaced
2876:84f82d014d06 2877:f8427bf8c072
558 """Retrieve CSS files to use according template_data 558 """Retrieve CSS files to use according template_data
559 559
560 For each element of the path, a .css file is looked for in /static, and returned 560 For each element of the path, a .css file is looked for in /static, and returned
561 if it exists. 561 if it exists.
562 Previous element are kept by replacing '/' with '_'. 562 Previous element are kept by replacing '/' with '_'.
563 styles_extra.css, styles.css and fonts.css are always used if they exist. 563 styles_extra.css, styles.css, highlight.css and fonts.css are always used if they
564 exist.
564 For each found file, if a file with the same name and "_noscript" suffix exists, 565 For each found file, if a file with the same name and "_noscript" suffix exists,
565 it will be return is second part of resulting tuple. 566 it will be return is second part of resulting tuple.
566 For instance, if template_data is (some_site, some_theme, blog/articles.html), 567 For instance, if template_data is (some_site, some_theme, blog/articles.html),
567 following files are returned, earch time trying [some_site root] first, 568 following files are returned, earch time trying [some_site root] first,
568 then default site (i.e. sat_templates) root: 569 then default site (i.e. sat_templates) root:
587 588
588 css_path = self.getStaticPath(template_data, u'fonts.css') 589 css_path = self.getStaticPath(template_data, u'fonts.css')
589 if css_path is not None: 590 if css_path is not None:
590 css_files.append(self.getFrontURL(css_path)) 591 css_files.append(self.getFrontURL(css_path))
591 592
592 for name_root in (u'styles', u'styles_extra'): 593 for name_root in (u'styles', u'styles_extra', u'highlight'):
593 self._appendCSSPaths(template_data, css_files, css_files_noscript, name_root) 594 self._appendCSSPaths(template_data, css_files, css_files_noscript, name_root)
594 595
595 for idx in xrange(len(path_elems)): 596 for idx in xrange(len(path_elems)):
596 name_root = u"_".join(path_elems[:idx+1]) 597 name_root = u"_".join(path_elems[:idx+1])
597 self._appendCSSPaths(template_data, css_files, css_files_noscript, name_root) 598 self._appendCSSPaths(template_data, css_files, css_files_noscript, name_root)