From b039430bf75e259afd2643e9c31c7a9cc4aeb442 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Sat, 1 Aug 2020 18:17:21 +0200 Subject: lyx - add html export, image path encrypt Signed-off-by: Pavel Sanda --- app-office/lyx/Manifest | 2 +- app-office/lyx/files/2.3.patches | 86 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/app-office/lyx/Manifest b/app-office/lyx/Manifest index f8c2a9d..b034667 100644 --- a/app-office/lyx/Manifest +++ b/app-office/lyx/Manifest @@ -1,6 +1,6 @@ AUX 2.1-python.patch 1019 BLAKE2B 1ca2692b77850998f49e93f43dc371d05e33438f867c352bdbf085a86a280e11fa5d00d738661875ede0041907683ced98407ce75676d638f35ae0a92cfd0f54 SHA512 039d3521bc1d646669fcccb43d04354dfe7ed32477a338c27a576c77e5ffcf15fcf0419c14df43aa37d727431cce6ab0327aa04199d09ce1749051ab12686df8 AUX 2.3-python.patch 1049 BLAKE2B 94591099e6b0d52429fa1e066475283ae35ba89a5d07f190dd80aa38ad040cbf53dda3f85f4f12894fc39822309aa7b4cc2bf947d8720caf228c734b7fcee8b1 SHA512 8f2fda91c4c35ffdf3325fc6613df1c5ecd87ced88e4d690aef5c7085edda1b66c0ae704e266521627f7a82eb8b4e2f35fed0f14b37feb367422ef1c5693e31d -AUX 2.3.patches 7766 BLAKE2B e43702cfd4b171fe01c193b7d4dc63c74351394431ba6cfd59ab96c1414e6a9fb1c66533ca0f33e0600b60620470a53c91e270daaca06f09d2e2be893e48da93 SHA512 e9d0f9d375c6166095e5ae2015abc3299bd08acdc11538ea2950175dfbe5a9d9860ca2b6fc6d5196e7295318899720404b40638586a5d3c0ae28af101bc12b8f +AUX 2.3.patches 10947 BLAKE2B 55f6a9a5196ea74ebc9a31bd9e052fb878d4858c14756624cfc69b8f75594a194e8662ee0aee8c0d44893851f5d28b799074ac405e104d858219e027d1b29704 SHA512 5792b440cac5e577f3295229dd7933a6a24293a178bb7472f0a50f3686e871cbfbe7269773746a97187dca032ee7bcfeef53891012eb07e8b26d05a85af4baf3 AUX legacy.patch 1491 BLAKE2B 0e6164120f436b4620e314b827686b3977ea925f48ce566170228cecb8cd8a3fb97341a30ba80e99b372c38726e7646ee02842bbbb38d086c2faf6aaa952f49a SHA512 c2a02a20f10a24e2c06ce0a1958b62809ec0149f05c875ddff223f2ee12f15e8991ff93f7f7b7672b68d7b2ff27f9320fc181a4a96b1e8ad412fa7948b832e8f DIST lyx-2.2.4.tar.xz 15596628 BLAKE2B f60d1a4ba66d5d42629d02f084ec5a168a4d6f46a88d4f0432fb7a331fdee74c82b42eb62c14d7e11eb3a4146a03b5109619dee9e3f23ffaf5ed627e8e85f092 SHA512 0c3907abedf40a05af2584d4566c805522cd0f3e1d427da982170824944d15a41f0ed0aae2a11204a4c6b61dfc366ea849411a3d718f12f4152e9450fef2c990 EBUILD lyx-2.2.4.ebuild 4369 BLAKE2B 139a8f7198de12dde8b5ac21e185b4ee3ff239e4f7a0bbfbc615585166a15fa7adc346028d2b8ec41c97401a1c359bfed0f72a69a947b21364e780ae52c3e2bd SHA512 5a7e911ff23ff6a3839cc873d6c15fdbb921c6675c8e3ed0e5cd609fcf2316dda1beb0f63dbad4bc898b4c5b6842cbbd269fe84e2ebb07dbcab0407b38b78143 diff --git a/app-office/lyx/files/2.3.patches b/app-office/lyx/files/2.3.patches index c2b2407..b5aeabc 100644 --- a/app-office/lyx/files/2.3.patches +++ b/app-office/lyx/files/2.3.patches @@ -216,3 +216,89 @@ index df20f7b285..34a1b87721 100644 if (prefixIs(token, "LaTeX Warning:") || prefixIs(token, "! pdfTeX warning")) { +diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp +index 88ee9a0320..a3ea0e141a 100644 +--- a/src/insets/InsetGraphics.cpp ++++ b/src/insets/InsetGraphics.cpp +@@ -580,7 +580,7 @@ copyToDirIfNeeded(DocFileName const & file, string const & dir) + if (rtrim(only_path, "/") == rtrim(dir, "/")) + return make_pair(IDENTICAL_PATHS, FileName(file_in)); + +- string mangled = file.mangledFileName(); ++ string mangled = file.mangledFileName(empty_string(), false, true); + if (theFormats().isZippedFile(file)) { + // We need to change _eps.gz to .eps.gz. The mangled name is + // still unique because of the counter in mangledFileName(). +diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp +index df5b443381..f5a67af3cf 100644 +--- a/src/support/FileName.cpp ++++ b/src/support/FileName.cpp +@@ -22,6 +22,7 @@ + #include "support/Package.h" + #include "support/qstring_helpers.h" + ++#include + #include + #include + #include +@@ -942,6 +943,11 @@ string DocFileName::outputFileName(string const & path) const + + + string DocFileName::mangledFileName(string const & dir) const ++{ ++ return mangledFileName(dir, true, false); ++}; ++ ++string DocFileName::mangledFileName(string const & dir, bool use_counter, bool encrypt_path) const + { + // Concurrent access to these variables is possible. + +@@ -961,6 +967,19 @@ string DocFileName::mangledFileName(string const & dir) const + string mname = os::internal_path(name); + // Remove the extension. + mname = support::changeExtension(name, string()); ++ ++ if (encrypt_path) { ++ QString qname = toqstr(mname); ++#if QT_VERSION >= 0x050000 ++ QByteArray hash = QCryptographicHash::hash(qname.toLocal8Bit(),QCryptographicHash::Sha256); ++#else ++ QByteArray hash = QCryptographicHash::hash(qname.toLocal8Bit(),QCryptographicHash::Sha1); ++#endif ++ hash = hash.toHex(); ++ mname = fromqstr(QString(hash)); ++ mname = mname + "_" + onlyFileName(); ++ } ++ + // The mangled name must be a valid LaTeX name. + // The list of characters to keep is probably over-restrictive, + // but it is not really a problem. +@@ -980,9 +999,12 @@ string DocFileName::mangledFileName(string const & dir) const + // Prepend a counter to the filename. This is necessary to make + // the mangled name unique. + static int counter = 0; +- ostringstream s; +- s << counter++ << mname; +- mname = s.str(); ++ ++ if (use_counter) { ++ ostringstream s; ++ s << counter++ << mname; ++ mname = s.str(); ++ } + + // MiKTeX's YAP (version 2.4.1803) crashes if the file name + // is longer than about 160 characters. MiKTeX's pdflatex +diff --git a/src/support/FileName.h b/src/support/FileName.h +index 3bfdf13f26..f46537ef33 100644 +--- a/src/support/FileName.h ++++ b/src/support/FileName.h +@@ -290,6 +290,8 @@ public: + */ + std::string + mangledFileName(std::string const & dir = empty_string()) const; ++ std::string ++ mangledFileName(std::string const & dir, bool use_counter, bool encrypt_path) const; + + /// \return the absolute file name without its .gz, .z, .Z extension + std::string unzippedFileName() const; -- cgit v1.2.3-65-gdbad