aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-13 22:08:53 -0400
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-13 22:11:11 -0400
commite3fc312c8e31b4c99e3ecbdcbb890ffc2dc51f05 (patch)
tree7af7d96e91bc4226e0b21e4cb8c5bd950410f1c2
parent517c4befd8ab959697f3f6474acbaf210461fabb (diff)
downloadpatchfoo-e3fc312c8e31b4c99e3ecbdcbb890ffc2dc51f05.tar.gz
patchfoo-e3fc312c8e31b4c99e3ecbdcbb890ffc2dc51f05.zip
render symbols for dillo
-rw-r--r--lib/render.js10
-rw-r--r--static/styles.css4
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/render.js b/lib/render.js
index ed60216..ef77f35 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -80,6 +80,14 @@ Render.prototype.emoji = function (emoji) {
}) : name
}
+function fixSymbols(str) {
+ // Dillo doesn't do fallback fonts, so specifically render fancy characters
+ // with Symbola
+ return str.replace(/[^\u0000-\u00ff]+/, function ($0) {
+ return '<span class="symbol">' + $0 + '</span>'
+ })
+}
+
Render.prototype.markdown = function (text, mentions) {
if (!text) return ''
var mentionsObj = this._mentions = {}
@@ -92,7 +100,7 @@ Render.prototype.markdown = function (text, mentions) {
})
var out = marked(String(text), this.markedOpts)
delete this._mentions
- return out
+ return fixSymbols(out)
}
Render.prototype.imageUrl = function (ref) {
diff --git a/static/styles.css b/static/styles.css
index 8a7129b..fd23b82 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -8,6 +8,10 @@ section {
padding: 1ex;
}
+.symbol {
+ font-family: Symbola;
+}
+
.ssb-post img {
max-width: 100%;
width: 640px;