[LyX/2.1.x] Fix bug #9146 (Graphics conversion problem).
commit e2d834e8d07a73c5e4fa49ca3e7aff651e2c0b8a Author: Enrico Forestieri Date: Mon Aug 4 18:52:20 2014 +0200 Fix bug #9146 (Graphics conversion problem). If LyX does not know about a given file format, it may easily happen that the format is recognized as "latex" and this causes bug #9146. This patch limits the check for a latex format to non-binary files. The strategy for deciding that a file has binary content is the same as that adopted by the "less" program. This is a stripped down backport of the more complex fix in master. diff --git a/src/Format.cpp b/src/Format.cpp index 93383ac..71437de 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -238,12 +238,17 @@ string guessFormatFromContents(FileName const & fn) int const max_count = 50; int count = 0; + // Maximum number of binary chars allowed for latex detection + int const max_bin = 5; + string str; string format; bool firstLine = true; bool backslash = false; + bool maybelatex = false; + int binchars = 0; int dollars = 0; - while ((count++ < max_count) && format.empty()) { + while ((count++ < max_count) && format.empty() && binchars <= max_bin) { if (ifs.eof()) break; @@ -359,16 +364,26 @@ string guessFormatFromContents(FileName const & fn) contains(str, "$$") || contains(str, "\\[") || contains(str, "\\]")) - format = "latex"; + maybelatex = true; else { if (contains(str, '\\')) backslash = true; dollars += count_char(str, '$'); + if (backslash && dollars > 1) + // inline equation + maybelatex = true; } + + // Note that this is formally not correct, since count_bin_chars + // expects utf8, and str can be anything: plain text in any + // encoding, or really binary data. In practice it works, since + // QString::fromUtf8() drops invalid utf8 sequences, and while + // the exact number may not be correct, we still get a high + // number for truly binary files. + binchars += count_bin_chars(str); } - if (format.empty() && backslash && dollars > 1) - // inline equation + if (format.empty() && binchars <= max_bin && maybelatex) format = "latex"; if (format.empty()) { diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp index d4b1ccf..103976a 100644 --- a/src/support/lstrings.cpp +++ b/src/support/lstrings.cpp @@ -917,6 +917,31 @@ int count_char(docstring const & str, docstring::value_type chr) } +int count_bin_chars(string const & str) +{ + QString const qstr = toqstr(str).simplified(); + int count = 0; + QString::const_iterator cit = qstr.begin(); + QString::const_iterator end = qstr.end(); + for (; cit != end; ++cit) { + switch (cit->category()) { + case QChar::Separator_Line: + case QChar::Separator_Paragraph: + case QChar::Other_Control: + case QChar::Other_Format: + case QChar::Other_Surrogate: + case QChar::Other_PrivateUse: + case QChar::Other_NotAssigned: + ++count; + break; + default: + break; + } + } + return count; +} + + docstring const trim(docstring const & a, char const * p) { LASSERT(p, return a); diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 576a5b9..20a73c4 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -196,6 +196,14 @@ int count_char(std::string const & str, char chr); /// Count all occurences of char \a chr inside \a str int count_char(docstring const & str, docstring::value_type chr); +/** Count all occurences of binary chars inside \a str. +It is assumed that \a str is utf-8 encoded and that a binary char +belongs to the unicode class names Zl, Zp, Cc, Cf, Cs, Co, or Cn +(excluding white space characters such as '\t', '\n', '\v', '\f', '\r'). +See http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt +*/ +int count_bin_chars(std::string const & str); + /** Trims characters off the end and beginning of a string. \code trim("ccabccc", "c") == "ab". diff --git a/status.21x b/status.21x index 012fb1d..4bd5f69 100644 --- a/status.21x +++ b/status.21x @@ -95,6 +95,8 @@ What's new - Fix reverse search in insets (figures, tables, branches, etc.) (bug 9151). +- Fix on-screen display of images whose type is not known to LyX (bug 9146). + * INTERNALS
[LyX GSoC/tex4htTesting] Added the tex file for the previous commit. Run "mk4ht ooxelatex PS_Report_Final.tex imageconv.cfg" for the conversion
The branch, tex4htTesting, has been updated. - Log - commit 32bb3609197b3422fb987980536e2020e3439521 Author: Prannoy Pilligundla Date: Tue Aug 5 00:17:59 2014 +0530 Added the tex file for the previous commit. Run "mk4ht ooxelatex PS_Report_Final.tex imageconv.cfg" for the conversion diff --git a/tests/PS_Report_Final.tex b/tests/PS_Report_Final.tex new file mode 100644 index 000..11e1d3b --- /dev/null +++ b/tests/PS_Report_Final.tex @@ -0,0 +1, @@ +%% LyX 2.1.0dev created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[english]{report} +\usepackage[T1]{fontenc} +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{3} +\usepackage{graphicx} +\usepackage{subscript} +\usepackage{babel} +\begin{document} + +\title{Implementing PLC based system in Upgrading Plant} + + +\author{Prannoy Pilligundla 2012A8PS264P\\ +Siddarth Singh 2012AAPS823P\\ +Vineet Cherian 2012A3PS015P} + +\maketitle +\tableofcontents +\begin{abstract} +Heavy water which is used a moderator in a PHWR is often contaminated +with some chemical impurities and Light water. The chemical impurities +like corrosion products, oil, dirt etc are removed from the downgraded +Heavy water in the cleanup system before sending it to Upgrading plant +for further processing. Basis of seperation of Heavy water and Light +water is the difference in Boiling point of 1.41\textsuperscript{o}C. +Upgrading is done by the continuous distillation under sub-atmospheric +condition. The downgraded heavy water is boiled in a reboiler and +made to ascend through the packed distillation column. It is condensed +at the top in the reflux condensor and the condensed liquid is putback +at the top of the tower as reflux. The vapour ascending and liquid +descending will come in intimate contact in tower section. Due to +this mass transfer takes place. Ligher component H\textsubscript{2}O +is transferred to the vapour phase from liquid phase. The mass transfer +taking place in the tower sets up a concentration gradient throughout +the tower section. Thus at the bottom of the tower it will be pure +heavy water and at the top of the column it will be light water. The +process instrumentation logic is based on the philosophy of simple +and safe operation. Interlocks have been provided with process parameters +to trip the plant whenever unsafe conditions are developed. + +Our main objective here is to upgrade an existing relay based control +system with a Programmable Logic Controller(PLC) in this Heavy Water +Upgradation Plant +\end{abstract} +Heavy water which is used a moderator in a PHWR is often contaminated +with some chemical impurities and Light water. The chemical impurities +like corrosion products, oil, dirt etc are removed from the downgraded +Heavy water in the cleanup system before sending it to Upgrading plant +for further processing. Basis of seperation of Heavy water and Light +water is the difference in Boiling point of 1.41\textsuperscript{o}C. +Upgrading is done by the continuous distillation under sub-atmospheric +condition. The downgraded heavy water is boiled in a reboiler and +made to ascend through the packed distillation column. It is condensed +at the top in the reflux condensor and the condensed liquid is putback +at the top of the tower as reflux. The vapour ascending and liquid +descending will come in intimate contact in tower section. Due to +this mass transfer takes place. Ligher component H\textsubscript{2}O +is transferred to the vapour phase from liquid phase. The mass transfer +taking place in the tower sets up a concentration gradient throughout +the tower section. Thus at the bottom of the tower it will be pure +heavy water and at the top of the column it will be light water. The +process instrumentation logic is based on the philosophy of simple +and safe operation. Interlocks have been provided with process parameters +to trip the plant whenever unsafe conditions are developed. + + +\chapter{Upgrading Plant} + + +\section{Introduction} + +The Madras Atomic Power Station is designed of the CANDU type,almost +similar to the Rajasthan Atomic Power Station. The Nuclear reactor +is of natural Uranium, Heavy water moderated and cooled. This Heavy +Water gets depleted due to leakages in the system. These leakages +are mainly collected from fuelling machine vault, Primary heat transfer +system and boiler room. In the ``PHWR'' type of reactors heavy water +is used both as moderator and as heat transport fluid. Downgrading +of high quality water occurs through two mechanisms: +\begin{enumerate} +\item Light water leakage into the heavy water system. +\item Heavy water escape from PHT and Moderator systems where it comes in +contact with light water +\end{enumerate} +Downgraded D\textsubscript{2}O is a mixture of light water, D\textsubscript{2}O +and other solid and chemical impurities. The downgra
[LyX/master] installer: update changelog
commit ad1a553454054b76fb8e1b3faf52bbe033409423 Author: Uwe Stöhr Date: Mon Aug 4 23:59:29 2014 +0200 installer: update changelog diff --git a/development/Win32/packaging/installer/ChangeLog.txt b/development/Win32/packaging/installer/ChangeLog.txt index 57106e5..29ece14 100644 --- a/development/Win32/packaging/installer/ChangeLog.txt +++ b/development/Win32/packaging/installer/ChangeLog.txt @@ -1,4 +1,14 @@ -Changelog for LyX-210-2: +Changelog for LyX-211-2: +- updated to Python 2.7.8 + + +Changelog for LyX-211-1: +- installs LyX 2.1.1 +- updated to Ghostscript 8.14 +- updated to Qt 4.8.6 + + +Changelog for LyX-210-2: - LyX can now also be installed over an existing installation of the same LyX version if the users really wants this. - LyX can now also be installed if the uninstaller executable of a former LyX was