www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6a81434b164c3f8cca44cf712989f48222bc6139
parent d31dad0e79479c1d38dadc3e7d98fa74329f32cc
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Sun, 15 Mar 2015 10:40:09 -0400

Remove font-based styles (this will be looked up later on token elements)

Diffstat:
Munpacked/jax/output/CommonHTML/jax.js | 24+++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js @@ -946,7 +946,12 @@ /********************************************************/ - arrayEntry: function (a,i) {return a[Math.max(0,Math.min(i,a.length-1))]} + arrayEntry: function (a,i) {return a[Math.max(0,Math.min(i,a.length-1))]}, + + // + // Styles to be removed from style="..." attributes + // + removeStyles: ["fontSize","fontFamily","fontWeight","fontStyle","fontVariant","font"] }); @@ -1132,13 +1137,22 @@ }, CHTMLhandleStyle: function (node) { - var BBOX = this.CHTML, style = node.style, w; - if (this.style) style.cssText = this.style; - for (var i = 0, m = CHTML.BBOX.styleAdjust.length; i < m; i++) { + if (!this.style) return; + var BBOX = this.CHTML, style = node.style, i, m; + style.cssText = this.style; + // ### FIXME: adjust for width, height, vertical-align? + for (i = 0, m = CHTML.BBOX.styleAdjust.length; i < m; i++) { var data = CHTML.BBOX.styleAdjust[i]; if (style[data[0]]) BBOX.adjust(style[data[0]],data[1],data[2],data[3]); } - // ### FIXME: remove font size and other font settings from non-token elements? + this.removedStyles = {}; + for (i = 0, m = CHTML.removeStyles.length; i < m; i++) { + var id = CHTML.removeStyles[i]; + if (style[id]) { + this.removedStyles[id] = style[id]; + style[id] = ""; + } + } }, CHTMLhandleColor: function (node) {