From: Michael Tremer Date: Thu, 27 Apr 2023 10:17:21 +0000 (+0000) Subject: packages: Improve viewing files X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d26e549cb720b30689de44365e53f89de86d9578;p=pbs.git packages: Improve viewing files Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index c244ece4..32f3acb9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -310,7 +310,6 @@ dist_static_DATA = \ staticdir = $(datadir)/static static_css_DATA = \ - src/static/css/highlight.css \ src/static/css/site.css static_cssdir = $(staticdir)/css diff --git a/src/buildservice/packages.py b/src/buildservice/packages.py index ffbf873e..15529d27 100644 --- a/src/buildservice/packages.py +++ b/src/buildservice/packages.py @@ -557,6 +557,9 @@ class File(base.Object): self.package = package self.data = data + def __str__(self): + return self.path + @property def path(self): return self.data.path diff --git a/src/static/css/site.scss b/src/static/css/site.scss index a723168f..268db64c 100644 --- a/src/static/css/site.scss +++ b/src/static/css/site.scss @@ -60,3 +60,49 @@ $link: $primary; color: $danger-invert; } } + +/* + Code Highlighting +*/ +.highlight { + .hll { + background-color: $grey; + } + + // Keywords + .k, .kc, .kd, .kn, .kp, .kr, .kt { + color: $grey-dark; + font-weight: bold; + } + + // Literals + .l, .ld { + color: $blue; + } + + // Literal Number + .m, .mb, .mf, .mh, .mi, .mo, .il { + color: $red; + } + + // Literal Strings + .s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss { + color: $blue; + } + + // Names + .n, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nx, .py, .nt, .nv, .bp, + .fm, .vc, .vg, .vi, .vm { + color: $text; + } + + // Operators + .o, .ow { + color: $text; + } + + // Comments + .c, .ch, .cm, .cp, .cpf, .c1, .cs { + color: $grey; + } +} diff --git a/src/templates/packages/view-file.html b/src/templates/packages/view-file.html index ff1077fd..5546d503 100644 --- a/src/templates/packages/view-file.html +++ b/src/templates/packages/view-file.html @@ -1,28 +1,33 @@ {% extends "../base.html" %} -{% block title %}{{ _("Package") }} - {{ package }} - {{ file }}{% end block %} +{% block title %}{{ package }} - {{ file }}{% end block %} {% block container %} -