From: Samuel GOUGEON Date: Sun, 4 Nov 2018 18:50:48 +0000 (+0100) Subject: * Bug 15259 fixed: provides formula as text X-Git-Tag: 6.0.2~141 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=dae6127e6acabf7b52e5bb1b9f71473ebc51976c * Bug 15259 fixed: provides formula as text http://bugzilla.scilab.org/15259 Change-Id: If8d79ec6839b9a50cc7eb2674ccad9911913874e --- diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 32105fb..d641d93 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -534,6 +534,7 @@ Known issues * [#15157](http://bugzilla.scilab.org/show_bug.cgi?id=15157): min/max on tlist or mlist did not call good overload. * [#15182](http://bugzilla.scilab.org/show_bug.cgi?id=15182): The result of `a.*.b` with mixed integer/decimal operands introduced in Scilab 6 returned some doubles instead of integers, inconsistently wrt the `*` and `.*` products. * [#15187](http://bugzilla.scilab.org/show_bug.cgi?id=15187): Super block diagram title (on the window bar) was not set. +* [#15259](http://bugzilla.scilab.org/show_bug.cgi?id=15259): LaTeX images did not have alt='..' attribute providing the LaTeX formula as text. * [#15263](http://bugzilla.scilab.org/show_bug.cgi?id=15263): Assignments in an array of structures often overwrote some untargeted elements. * [#15279](http://bugzilla.scilab.org/show_bug.cgi?id=15279): `unique` could not be used on sets of complex numbers. * [#15284](http://bugzilla.scilab.org/show_bug.cgi?id=15284): Port names are not set to the corresponding I/O block labels. diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java index 57a9641..007a0c1 100644 --- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java +++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java @@ -672,8 +672,9 @@ public class HTMLDocbookTagConverter extends DocbookTagConverter implements Temp String idAttr = attrs.get("id"); String alignAttr = attrs.get("align"); // mixes align and valign imagedata attributes String widthAttr = attrs.get("width"); - String heightAttr= attrs.get("height"); // officially named "depth" as imagedata attribute + String heightAttr= attrs.get("height"); // officially named "depth" as imagedata attribute String styleAttr = attrs.get("style"); + String altAttr = attrs.get("alt"); // for example: LaTeX content as text boolean addDiv = getGenerationType() != Backend.JAVAHELP || !isLinkedImage(); final StringBuilder buffer = new StringBuilder(128); if (addDiv && alignAttr != null) { @@ -695,7 +696,11 @@ public class HTMLDocbookTagConverter extends DocbookTagConverter implements Temp } } if (styleAttr != null) { - buffer.append("style=\'").append(styleAttr).append("\'"); + buffer.append("style=\'").append(styleAttr).append("\' "); + } + if (altAttr != null) { + altAttr = altAttr.replaceAll("\'", "'").replaceAll("\"", """); + buffer.append("alt=\'").append(altAttr).append("\'"); } buffer.append("/>\n"); if (addDiv && alignAttr != null) { diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java index 3312108..570fd0c 100644 --- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java +++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java @@ -61,6 +61,10 @@ public class LaTeXImageConverter implements ExternalImageConverter { try { TeXFormula formula = new TeXFormula(latex); String display = attributes.get("style"); + String alt = attributes.get("alt"); + if (alt == null) { + attributes.put("alt", latex); + } int style = TeXConstants.STYLE_DISPLAY; if (display != null && display.equals("text")) { style = TeXConstants.STYLE_TEXT;