#LyX 2.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 495
+\lyxformat 497
\begin_document
\begin_header
\origin /systemlyxdir/doc/
\end_inset
The file extension (including the dot).
+\change_inserted -195340706 1437418878
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -195340706 1437418878
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -195340706 1437418878
+$$pngOrjpg
+\end_layout
+
+\end_inset
+
+ This will be the string
+\begin_inset Quotes eld
+\end_inset
+
+jpg
+\begin_inset Quotes erd
+\end_inset
+
+ if the file is in JPEG format, otherwise it will be the string
+\begin_inset Quotes eld
+\end_inset
+
+png
+\begin_inset Quotes erd
+\end_inset
+
+.
+ This is useful to avoid uneeded conversions for output formats that support
+ both PNG and JPEG fomats.
+ The predefined RasterImage template uses this macro for the PDFLATeX output
+ format.
+\change_unchanged
+
\end_layout
\begin_layout Description
# what the template can provide him with.
HelpText
A bitmap file.
- Use this template to include bitmap images of any kind except
- photos in JPEG format: These will be uncompressed by this
- template, therefore it is better to include them with a
- graphics inset, since the graphics inset preserves the
- compression if the pdflatex compiler is used.
+ Use this template to include bitmap images of any kind.
HelpTextEnd
# ANY file type can be displayed as a RasterImage.
# Specifically, LyX will attempt to interrogate the file itself
TransformOption Extra ExtraOption
Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]"
Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}"
- UpdateFormat png
- UpdateResult "$$AbsPath$$Basename.png"
+ UpdateFormat "$$pngOrjpg"
+ UpdateResult "$$AbsPath$$Basename.$$pngOrjpg"
Requirement "graphicx"
- ReferencedFile pdflatex "$$AbsPath$$Basename.png"
+ ReferencedFile pdflatex "$$AbsPath$$Basename.$$pngOrjpg"
FormatEnd
Format Ascii
Product "$$Contents(\"$$AbsPath$$Basename.asc\")"
bool external_in_tmpdir,
Substitute what)
{
+ string result = s;
+ if (what != PATHS && contains(result, "$$pngOrjpg")) {
+ // This is for raster images and pdflatex:
+ // Since pdflatex supports both jpg and png, we choose the best format:
+ // jpg if the original file is jpg to retain the compression, else png.
+ string format = formats.getFormatFromFile(params.filename);
+ if (format == "jpg")
+ result = subst(result, "$$pngOrjpg", "jpg");
+ else
+ result = subst(result, "$$pngOrjpg", "png");
+ }
+
+ if (what == FORMATS)
+ return result;
+
Buffer const * masterBuffer = buffer.masterBuffer();
string const parentpath = external_in_tmpdir ?
masterBuffer->temppath() :
onlyFileName(filename), string());
string const absname = makeAbsPath(filename, parentpath).absFileName();
- string result = s;
if (what != ALL_BUT_PATHS) {
string const filepath = onlyPath(filename);
string const abspath = onlyPath(absname);
return; // FAILURE
}
- string const to_format = outputFormat.updateFormat;
+ string const to_format = doSubstitution(params, buffer,
+ outputFormat.updateFormat, false, external_in_tmpdir, FORMATS);
if (to_format.empty())
return; // NOT_NEEDED
enum Substitute {
ALL,
PATHS,
- ALL_BUT_PATHS
+ ALL_BUT_PATHS,
+ FORMATS
};
/** Substitute meta-variables in string \p s, making use of \p params and