Improve LaTeX worksheet export
ClosedPublic

Authored by sirgienko on May 8 2018, 10:19 PM.

Details

Summary

Remove unused filter, add extention for exported file, if it not setted, set correct xml attribute for latexresult and add decoding HTML '&', '>', '<' characters to valid for LaTeX characters

BUG: 387304
FIXED-IN: 18.04.2

Test Plan
  1. Write Maxima worksheet with matrixs and comparison operations.
  2. Export the worksheet to LaTeX
  3. See tex output and check, that the result is incorrect for LaTeX
  4. Apply the patch
  5. Export again and check, that now the result is correct and may be builded with LaTeX

Diff Detail

Repository
R55 Cantor
Branch
improve-latex-export
Lint
No Linters Available
Unit
No Unit Test Coverage
sirgienko created this revision.May 8 2018, 10:19 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptMay 8 2018, 10:19 PM
Restricted Application added a subscriber: KDE Edu. · View Herald Transcript
sirgienko requested review of this revision.May 8 2018, 10:19 PM
asemke added a comment.May 9 2018, 8:43 PM

I'm not familiar with XQuery. Do you understand where those html-tags come from? Isn't it better to adjust the xls transformation file and to avoid the generation of these tags completely?

Restricted Application edited subscribers, added: kde-edu; removed: KDE Edu. · View Herald TranscriptMay 9 2018, 8:43 PM
sirgienko added a comment.EditedMay 9 2018, 8:56 PM

I'm not familiar with XQuery. Do you understand where those html-tags come from? Isn't it better to adjust the xls transformation file and to avoid the generation of these tags completely?

Xm, I don't sure, that fully understand your question. Do you ask about src/worksheet.cpp:952? XML don't keep '&', '<', '>' as '&', '<', '>' because, this is special symbols, using in tags, so XML keep they as '&amp', '&lt', '&gt'. And as i see, QDomText don't decode them to origin form (maybe bug), when is convertes to QString, so we need do it by hands.

asemke added a comment.May 9 2018, 9:09 PM

I'm not familiar with XQuery. Do you understand where those html-tags come from? Isn't it better to adjust the xls transformation file and to avoid the generation of these tags completely?

Xm, I don't sure, that fully understand your question. Do you ask about src/worksheet.cpp:952? XML don't keep '&', '<', '>' as '&', '<', '>' because, this is special symbols, using in tags, so XML keep they as '&amp', '&lt', '&gt'. And as i see, QDomText don't decode them to origin form (maybe bug), when is convertes to QString, so we need do it by hands.

Ok, I think this is not related to xls. I created now a maxima worksheet and did a simple matrix([1,2],[3,4]). The result xml content is

<!DOCTYPE CantorWorksheet>
<Worksheet backend="Maxima">
 <Expression>
  <Command>matrix([1,2],[3,4])</Command>
  <Result type="latex" filename="cantor_tex-SiCiCb.eps">\begin{eqnarray*}
\begin{pmatrix}1&amp;2\\ 3&amp;4\\ \end{pmatrix}
\end{eqnarray*}</Result>
 </Expression>
 <Expression>
  <Command></Command>
 </Expression>
</Worksheet>

Out of this Cantor generates without your fix

\documentclass[a4paper,10pt,fleqn]{article}

\usepackage{fullpage}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}

\begin{document}
\begin{verbatim}
matrix([1,2],[3,4])
\end{verbatim}
\begin{eqnarray*} \begin{pmatrix}1&amp;2\\ 3&amp;4\\ \end{pmatrix} \end{eqnarray*}
\begin{verbatim}

\end{verbatim}
\end{document}

Do you see where those &amp's in the XML-content come from? They are not part of maxima output.

asemke accepted this revision.May 9 2018, 9:18 PM

I'm not familiar with XQuery. Do you understand where those html-tags come from? Isn't it better to adjust the xls transformation file and to avoid the generation of these tags completely?

Xm, I don't sure, that fully understand your question. Do you ask about src/worksheet.cpp:952? XML don't keep '&', '<', '>' as '&', '<', '>' because, this is special symbols, using in tags, so XML keep they as '&amp', '&lt', '&gt'. And as i see, QDomText don't decode them to origin form (maybe bug), when is convertes to QString, so we need do it by hands.

Do you see where those &amp's in the XML-content come from? They are not part of maxima output.

Sorry. I didn't read you reply carefully. The patch is ok.

18.04.1 is probably too late. 18.04.1 was tagged already... Let's bring this into 18.04.2.

This revision is now accepted and ready to land.May 9 2018, 9:18 PM

@asemke, Should I continue to use phabricator commit message, when I land the patches? I tired of long commit messages of my patches in git log, so I want to use only title and summary part. No problem with it?

sirgienko edited the summary of this revision. (Show Details)May 9 2018, 9:23 PM
asemke added a comment.May 9 2018, 9:26 PM

@asemke, Should I continue to use phabricator commit message, when I land the patches? I tired of long commit messages of my patches in git log, so I want to use only title and summary part. No problem with it?

I'm fine with short and compact commit messages.

This revision was automatically updated to reflect the committed changes.