aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bg/js/templates.js17
-rw-r--r--ext/fg/css/popup.css17
-rwxr-xr-xutil/compile.py8
-rw-r--r--util/tmpl/term.html2
4 files changed, 34 insertions, 10 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index 1609cc97..ae7c4a0d 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -77,14 +77,23 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
+ ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "</div>\n";
},"11":function(container,depth0,helpers,partials,data) {
- var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+ var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
- return " <span class=\"tag\" title=\""
+ return " <span class=\"tag "
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0["class"] : depth0),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.program(14, data, 0),"data":data})) != null ? stack1 : "")
+ + "\" title=\""
+ alias4(((helper = (helper = helpers.desc || (depth0 != null ? depth0.desc : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"desc","hash":{},"data":data}) : helper)))
+ "\">"
+ alias4(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"key","hash":{},"data":data}) : helper)))
+ "</span>\n";
-},"13":function(container,depth0,helpers,partials,data) {
+},"12":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return "tag-"
+ + container.escapeExpression(((helper = (helper = helpers["class"] || (depth0 != null ? depth0["class"] : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"class","hash":{},"data":data}) : helper)));
+},"14":function(container,depth0,helpers,partials,data) {
+ return "tag-default";
+},"16":function(container,depth0,helpers,partials,data) {
return " <li><span>"
+ container.escapeExpression(container.lambda(depth0, depth0))
+ "</span></li>\n";
@@ -97,7 +106,7 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
+ "\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n<div class=\"glossary\">\n <ol>\n"
- + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </ol>\n</div>\n";
},"useData":true});
templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data) {
diff --git a/ext/fg/css/popup.css b/ext/fg/css/popup.css
index 1c40bdfd..b10c06f2 100644
--- a/ext/fg/css/popup.css
+++ b/ext/fg/css/popup.css
@@ -43,7 +43,6 @@ body {
}
.tag {
- background-color: #777;
border-radius: 0.25em;
color: #fff;
cursor: default;
@@ -57,6 +56,22 @@ body {
white-space: nowrap;
}
+.tag-default {
+ background-color: #8a8a91;
+}
+
+.tag-name {
+ background-color: #5cb85c;
+}
+
+.tag-expression {
+ background-color: #f0ad4e;
+}
+
+.tag-popular {
+ background-color: #0275d8;
+}
+
ol {
padding-left: 1.2em;
}
diff --git a/util/compile.py b/util/compile.py
index 9c5a6bdd..d5a916fd 100755
--- a/util/compile.py
+++ b/util/compile.py
@@ -193,15 +193,15 @@ def parse_edict(path):
for index, dfn in enumerate(filter(None, segments[1:])):
dfn_match = re.search(r'^((?:\((?:[\w\-\,\:]*)*\)\s*)*)(.*)$', dfn)
- gloss = dfn_match.group(2).strip()
- if len(gloss) == 0:
- continue
-
tags_raw = set(filter(None, re.split(r'[\s\(\),]', dfn_match.group(1))))
tags_raw = fixup_godan_verbs(tags_raw)
tags_raw = tags_raw.intersection(set(PARSED_TAGS.keys()))
tags = tags.union(tags_raw)
+ gloss = dfn_match.group(2).strip()
+ if len(gloss) == 0:
+ continue
+
if index == 0 or len(dfn_match.group(1)) > 0:
defs.append([gloss])
else:
diff --git a/util/tmpl/term.html b/util/tmpl/term.html
index abcbb215..e97104f1 100644
--- a/util/tmpl/term.html
+++ b/util/tmpl/term.html
@@ -15,7 +15,7 @@
{{#if tags}}
<div class="tags">
{{#each tags}}
- <span class="tag" title="{{desc}}">{{@key}}</span>
+ <span class="tag {{#if class}}tag-{{class}}{{else}}tag-default{{/if}}" title="{{desc}}">{{@key}}</span>
{{/each}}
</div>
{{/if}}