diff --git a/development/cmake/Install.cmake b/development/cmake/Install.cmake index 839d9534ef..d428dcb674 100755 --- a/development/cmake/Install.cmake +++ b/development/cmake/Install.cmake @@ -116,6 +116,7 @@ lyx_install("data" ${TOP_SRC_DIR}/lib citeengines *.citeengine .) lyx_install("data" ${TOP_SRC_DIR}/lib . *.py .) lyx_install("data" ${TOP_SRC_DIR}/lib scripts *.R .) lyx_install("data" ${TOP_SRC_DIR}/lib templates * . springer) +lyx_install("data" ${TOP_SRC_DIR}/lib xtemplates *.xtemplate .) lyx_install("tex" ${TOP_SRC_DIR}/lib/tex . * .) lyx_install("data" ${TOP_SRC_DIR}/lib ui * .) lyx_install("data" ${TOP_SRC_DIR}/lib . * .) diff --git a/lib/Makefile.am b/lib/Makefile.am index b8a8a5ddda..5b92c532f9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,7 +6,7 @@ CHMOD = chmod EXTRA_DIST = examples/CMakeLists.txt scripts/CMakeLists.txt -dist_pkgdata_DATA = CREDITS autocorrect chkconfig.ltx external_templates \ +dist_pkgdata_DATA = CREDITS autocorrect chkconfig.ltx \ encodings layouttranslations languages latexfonts RELEASE-NOTES \ symbols syntax.default unicodesymbols @@ -2421,6 +2421,18 @@ dist_ui_DATA = \ ui/stdmenus.inc \ ui/stdtoolbars.inc +xtemplatesdir = $(pkgdatadir)/xtemplates +dist_xtemplates_DATA = \ + xtemplates/chess.xtemplate \ + xtemplates/dia.xtemplate \ + xtemplates/gnumeric.xtemplate \ + xtemplates/inkscape.xtemplate \ + xtemplates/lilypond.xtemplate \ + xtemplates/pdfpages.xtemplate \ + xtemplates/raster_image.xtemplate \ + xtemplates/vector_graphics.xtemplate \ + xtemplates/xfig.xtemplate + if INSTALL_POSIX # install application icons. The 'hicolor' theme is the default theme # where applications themselves should install their icons. diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES index 496d0a91d3..b4534cbca0 100644 --- a/lib/RELEASE-NOTES +++ b/lib/RELEASE-NOTES @@ -74,6 +74,21 @@ !!!The following LyX documents have been moved in 2.3: +!!!The following new folders have been added to the LyX directory + +* citeengines: Contains the *.citeengine files that determine the citation + formatting and features. + +* xtemplates: Contains the *.xtemplate files that define the external templates + (previously in the external_templates file). + + +!!!The following preferences files have been removed from the tarball in 2.3: + +* external_templates. This files has been split into multiple *.xtemplate + files that are now shipped as content of the xtemplates directory. + + !!!The following metadata files have been added to the tarball in 2.3: @@ -83,11 +98,18 @@ * Add some editor/viewer applications to (re)configure checks. + !!Known issues in version 2.3.0 !!Caveats when upgrading from earlier versions to 2.3.x +* The external_templates file has been split into one file per template, + which are now located in lib/xtemplates/*.xtemplate. This makes it easier + to add new templates or modify existing ones. If you have modified + the external_templates file, you will have to move the modifications to + the respective *.xtemplate file manually. + * If using TeX fonts and en- and em-dashes are output as font ligatures, when exporting documents containing en- and em-dashes to the format of LyX 2.0 or earlier, the following line has to be manually added to the diff --git a/lib/configure.py b/lib/configure.py index e43e1b5774..7f46ec6531 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -1663,6 +1663,39 @@ def processCiteEngineFile(file, filename, bool_docbook): return '"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, cfm, db, desc, pkgs) +def checkXTemplates(): + removeFiles(['xtemplates.lst']) + + logger.info('+checking list of external templates... ') + tx = open('xtemplates.lst', 'w') + tx.write('''## This file lists external templates. +## It has been automatically generated by configure +## Use "Options/Reconfigure" if you need to update it after a +## configuration change. +''') + + # build the list of available templates + seen = [] + # note that this searches the local directory first, then the + # system directory. that way, we pick up the user's version first. + for file in glob.glob( os.path.join('xtemplates', '*.xtemplate') ) + \ + glob.glob( os.path.join(srcdir, 'xtemplates', '*.xtemplate' ) ) : + # valid file? + logger.info(file) + if not os.path.isfile(file): + continue + + filename = file.split(os.sep)[-1] + if seen.count(filename): + continue + + seen.append(filename) + if filename != "": + tx.write(filename + "\n") + tx.close() + logger.info('\tdone') + + def checkTeXAllowSpaces(): ''' Let's check whether spaces are allowed in TeX file names ''' tex_allows_spaces = 'false' @@ -1786,6 +1819,7 @@ Format %i rescanTeXFiles() checkModulesConfig() checkCiteEnginesConfig() + checkXTemplates() # --without-latex-config can disable lyx_check_config ret = checkLatexConfig(lyx_check_config and LATEX != '', bool_docbook) removeTempFiles() diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index a9a23de2d9..761003ac77 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -1,5 +1,5 @@ #LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 530 +\lyxformat 535 \begin_document \begin_header \save_transient_properties true @@ -57,6 +57,7 @@ logicalmkup \font_sf_scale 100 100 \font_tt_scale 100 100 \use_microtype false +\use_dash_ligatures true \graphics default \default_output_format pdf2 \output_sync 0 @@ -151,6 +152,7 @@ n mailing list, LatexCommand href target "lyx-docs@lists.lyx.org" type "mailto:" +literal "false" \end_inset @@ -908,6 +910,49 @@ status collapsed . That is, the files define which items appear in which menus and the items appearing on the toolbar. +\change_inserted -712698321 1490533733 + +\end_layout + +\begin_layout Labeling +\labelwidthstring 00.00.0000 + +\change_inserted -712698321 1490533849 +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1490533738 +xtemplates/ +\end_layout + +\end_inset + + contains files with the extension +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1490533759 +.xtemplate +\end_layout + +\end_inset + + which define the templates for the insertion of external material to a + \SpecialChar LyX + document; see +\begin_inset CommandInset ref +LatexCommand ref +reference "chap:Including-External-Material" + +\end_inset + +. +\change_unchanged + \end_layout \begin_layout Subsection @@ -1004,6 +1049,8 @@ encodings \begin_layout Labeling \labelwidthstring 00.00.0000 + +\change_deleted -712698321 1490533856 \begin_inset Flex Code status collapsed @@ -1035,6 +1082,8 @@ reference "chap:Including-External-Material" \end_inset . +\change_unchanged + \end_layout \begin_layout Labeling @@ -1617,6 +1666,7 @@ MIME LatexCommand href name "IANA" target "http://www.iana.org/assignments/media-types/" +literal "false" \end_inset @@ -1627,6 +1677,7 @@ target "http://www.iana.org/assignments/media-types/" LatexCommand href name "freedesktop.org" target "http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec" +literal "false" \end_inset @@ -3009,6 +3060,7 @@ Check out the \SpecialChar LyX LatexCommand href name "information on the web" target "http://www.lyx.org/HowToUseGIT" +literal "false" \end_inset @@ -3440,6 +3492,7 @@ Check out the documentation translation web page at LatexCommand href name "http://www.lyx.org/Translation" target "http://www.lyx.org/Translation" +literal "false" \end_inset @@ -3554,6 +3607,7 @@ Sometimes the original document (from the \SpecialChar LyX LatexCommand href name "http://www.lyx.org/trac/timeline" target "http://www.lyx.org/trac/timeline" +literal "false" \end_inset @@ -6033,6 +6087,7 @@ Get the package from LatexCommand href name "CTAN" target "http://www.ctan.org/" +literal "false" \end_inset @@ -6568,6 +6623,7 @@ As you prepare to write a new layout, it is extremely helpful to look at LatexCommand href name "layout section on the LyX wiki" target "http://wiki.lyx.org/Layouts/Layouts" +literal "false" \end_inset @@ -25647,6 +25703,10 @@ Besides supporting the production of different products according to the \begin_layout Section The external template configuration file +\change_inserted -712698321 1490533960 +s +\change_unchanged + \end_layout \begin_layout Standard @@ -25674,27 +25734,84 @@ Having said that, we encourage you to submit any interesting templates that \end_layout \begin_layout Standard -The external templates are defined in the +The external templates are defined in the +\change_inserted -712698321 1490534022 + \begin_inset Flex Code status collapsed \begin_layout Plain Layout -LyXDir/lib/external_templates + +\change_inserted -712698321 1490533996 +*.xtemplate \end_layout \end_inset - file. - You can place your own version in + files that are stored in the +\change_unchanged + \begin_inset Flex Code status collapsed \begin_layout Plain Layout -UserDir/external_templates +LyXDir/lib/ +\change_deleted -712698321 1490533984 +external_ +\change_inserted -712698321 1490533984 +x +\change_unchanged +templates +\change_inserted -712698321 1490534077 +/ +\change_unchanged + \end_layout \end_inset + +\change_deleted -712698321 1490534025 +file +\change_inserted -712698321 1490534028 +directory +\change_unchanged +. + +\change_inserted -712698321 1490534233 +Each template is defined in a file of its own. + +\change_unchanged +You can place your own +\change_deleted -712698321 1490534089 +version +\change_inserted -712698321 1490534090 +templates +\change_unchanged + in +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +UserDir/ +\change_deleted -712698321 1490534069 +external_ +\change_inserted -712698321 1490534069 +x +\change_unchanged +templates +\change_inserted -712698321 1490534080 +/ +\change_unchanged + +\end_layout + +\end_inset + + +\change_inserted -712698321 1490534112 + or copy existing templates to that directory in order to modify them +\change_unchanged . \end_layout diff --git a/lib/external_templates b/lib/external_templates deleted file mode 100644 index 84d41faa97..0000000000 --- a/lib/external_templates +++ /dev/null @@ -1,551 +0,0 @@ -# -# file external_templates -# This file is part of LyX, the document processor. -# Licence details can be found in the file COPYING. -# -# author Asger Alstrup Nielsen -# author Angus Leeming -# author Johnathan Burchill -# -# Full author contact details are available in file CREDITS. - -# This file contains the definitions of those External Templates that are -# part of the official LyX distribution. -# Feel free to create your own External Templates, storing them in -# .lyx/external_templates -# Note that a user-defined external_templates file would replace this -# definition. Thus, if you would like to keep the external templates defined -# in this file, please copy this file and add on futher external templates -# to the end. For more information, see http://www.lyx.org/trac/ticket/3983. - - -PreambleDef WarnNotFound - %% Print a warning encased in an fbox. - \def\lyxstripprefix#1>{} - \newcommand{\warnNotFound}[1]{% - \def\lyxtempfilename{#1}% - \fbox{Could not find - \ttfamily\expandafter\lyxstripprefix\meaning\lyxtempfilename!}% - \typeout{Could not find \lyxtempfilename!}% - } -PreambleDefEnd - - -PreambleDef InputOrWarn - %% Input the file if it exists, using \input, else print a warning - \newcommand{\inputOrWarn}[1]{% - \IfFileExists{#1}{\input{#1}}{\warnNotFound{#1}}} -PreambleDefEnd - -Template GnumericSpreadsheet - GuiName "Spreadsheet" - HelpText - A spreadsheet made with Gnumeric, LibreOffice, OpenOffice or Excel. - It imports as a multi-page table, so any length - is ok. Excessive width could be a problem. - The gnumeric software is necessary for conversion, - both for gnumeric and excel files. - HelpTextEnd - InputFormat "gnumeric" - FileFilter "*.{gnumeric,ods,xls,xlsx}" - AutomaticProduction true - Format LaTeX - Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}" - UpdateFormat latex - UpdateResult "$$AbsPath$$Basename.tex" - Requirement "color" - Requirement "array" - Requirement "longtable" - Requirement "calc" - Requirement "multirow" - Requirement "hhline" - Requirement "ifthen" - ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.tex" - FormatEnd - Format PDFLaTeX - Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}" - UpdateFormat latex - UpdateResult "$$AbsPath$$Basename.tex" - Requirement "color" - Requirement "array" - Requirement "longtable" - Requirement "calc" - Requirement "multirow" - Requirement "hhline" - Requirement "ifthen" - ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.tex" - FormatEnd - Format Ascii - Product "[Spreadsheet: $$FName]" - FormatEnd - Format DocBook - Product "[Spreadsheet: $$FName]" - FormatEnd - Format XHTML - Product "$$Contents(\"$$AbsPath$$Basename.html\")

" - UpdateFormat html_table - UpdateResult "$$AbsPath$$Basename.html" - FormatEnd -TemplateEnd - -Template RasterImage - # By default, InsetExternal is displayed as a grey button - # containing this text. - GuiName "Raster image" - # This text is used in the External dialog. - # Provide enough information to explain to the user just - # what the template can provide him with. - HelpText - A bitmap file. - 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 - # in order to deduce its format. - InputFormat "*" - # Globbing pattern used when browsing for a Raster image file. - FileFilter "*.{gif,png,jpg,bmp,pbm,ppm,tga,tif,xpm,xbm}" - # Set to "true" if the file represented by the template - # must be generated by LyX. - AutomaticProduction true - # LyX has hard-coded support for these transformations - Transform Rotate - Transform Resize - Transform Clip - Transform Extra - # LyX preview options: - # Off: LyX will not attempt to show this material on screen. - # Graphics: LyX will attempt to show this material as-is or via a - # conversion to a showable format. - # InstantPreview: LyX will attempt to use the 'instant preview' - # mechanism in order to show this material. - Preview Graphics - Format LaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - # This string is what is output to the LaTeX file. - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - Requirement "graphicx" - ReferencedFile latex "$$AbsPath$$Basename.eps" - ReferencedFile dvi "$$AbsPath$$Basename.eps" - FormatEnd - Format PDFLaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat "$$pngOrjpg" - UpdateResult "$$AbsPath$$Basename.$$pngOrjpg" - Requirement "graphicx" - ReferencedFile pdflatex "$$AbsPath$$Basename.$$pngOrjpg" - FormatEnd - Format Ascii - Product "[RasterImage: $$FName]" - FormatEnd - Format DocBook - Product "" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - ReferencedFile docbook "$$AbsPath$$Basename.eps" - ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" - FormatEnd - Format XHTML - Product "" - UpdateFormat png - UpdateResult "$$AbsPath$$Basename.png" - ReferencedFile xhtml "$$AbsPath$$Basename.png" - FormatEnd -TemplateEnd - -Template VectorGraphics - GuiName "Vector graphics" - HelpText - A vector graphics file. - Use this template to include vector graphics of any kind. - LyX will try to retain the vector properties of the image for - the final output. - Note that specialized templates exist for Xfig figures and Dia diagrams. - The specialized templates allow to automatically use the document font in - the figures, which is not possible with this general template. - HelpTextEnd - # ANY file type can be displayed as a VectorGraphics. - # Specifically, LyX will attempt to interrogate the file itself - # in order to deduce its format. - InputFormat "*" - # Globbing pattern used when browsing for a vector graphics file. - # xfig, dia, fen and ly are exlcuded, since we have specialized templates - FileFilter "*.{agr,dot,emf,eps,odg,obj,sxd,svg,svgz,tgo,pdf,wmf}" - AutomaticProduction true - # LyX has hard-coded support for these transformations - Transform Rotate - Transform Resize - Transform Clip - Transform Extra - Preview Graphics - Format LaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - # This string is what is output to the LaTeX file. - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - Requirement "graphicx" - ReferencedFile latex "$$AbsPath$$Basename.eps" - ReferencedFile dvi "$$AbsPath$$Basename.eps" - FormatEnd - Format PDFLaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat pdf6 - UpdateResult "$$AbsPath$$Basename.pdf" - Requirement "graphicx" - ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" - FormatEnd - Format Ascii - Product "[VectorGraphics: $$FName]" - FormatEnd - Format DocBook - Product "" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - ReferencedFile docbook "$$AbsPath$$Basename.eps" - ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" - FormatEnd - Format XHTML - Product "" - UpdateFormat svg - UpdateResult "$$AbsPath$$Basename.svg" - ReferencedFile xhtml "$$AbsPath$$Basename.svg" - FormatEnd -TemplateEnd - -Template XFig - GuiName "Xfig figure" - HelpText - An Xfig figure. - HelpTextEnd - InputFormat fig - FileFilter "*.fig" - AutomaticProduction true - Transform Rotate - Transform Resize - Preview InstantPreview - Format LaTeX - TransformCommand Rotate RotationLatexCommand - TransformCommand Resize ResizeLatexCommand - Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pstex_t}$$ResizeBack$$RotateBack" - UpdateFormat pstex - UpdateResult "$$AbsPath$$Basename.pstex_t" - Requirement "color" - Requirement "graphicx" - # Preamble WarnNotFound - # Preamble InputOrWarn - ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.pstex_t" - ReferencedFile latex "$$AbsPath$$Basename.eps" - ReferencedFile dvi "$$AbsPath$$Basename.eps" - FormatEnd - Format PDFLaTeX - TransformCommand Rotate RotationLatexCommand - TransformCommand Resize ResizeLatexCommand - Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pdftex_t}$$ResizeBack$$RotateBack" - UpdateFormat pdftex - UpdateResult "$$AbsPath$$Basename.pdftex_t" - Requirement "color" - Requirement "graphicx" - # Preamble WarnNotFound - # Preamble InputOrWarn - ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdftex_t" - ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" - FormatEnd - Format Ascii - Product "[XFig: $$FName]" - FormatEnd - Format DocBook - Product "" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - ReferencedFile docbook "$$AbsPath$$Basename.eps" - ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" - FormatEnd - Format XHTML - Product "" - UpdateFormat svg - UpdateResult "$$AbsPath$$Basename.svg" - ReferencedFile xhtml "$$AbsPath$$Basename.svg" - FormatEnd -TemplateEnd - - -Template Inkscape - GuiName "Inkscape figure" - HelpText - An Inkscape figure. - This template should work flawlessly with Inkscape 0.48. - For Inkscape 0.91, there is a (reported) bug in the - LaTeX + PDF output which makes a workaround necessary, - see Embedded Objects manual. - Note that using this template automatically uses the - document text in the image (like with the Xfig template). - HelpTextEnd - InputFormat svg - FileFilter "*.svg" - AutomaticProduction true - Transform Rotate - Preview InstantPreview - Format PDFLaTeX - TransformCommand Rotate RotationLatexCommand - # Resize is not desirable here, as fonts are sized to surrounding LaTeX font - Product "$$RotateFront\\input{$$AbsOrRelPathMaster$$Basename.pdf_tex}$$RotateBack" - UpdateFormat pdftex - UpdateResult "$$AbsPath$$Basename.pdf_tex" - Requirement "color" - Requirement "graphicx" - # Preamble WarnNotFound - # Preamble InputOrWarn - ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdf_tex" - ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" - FormatEnd - Format LaTeX - TransformCommand Rotate RotationLatexCommand - Product "$$RotateFront\\input{$$AbsOrRelPathMaster$$Basename.eps_tex}$$RotateBack" - UpdateFormat pstex - UpdateResult "$$AbsPath$$Basename.eps_tex" - Requirement "color" - Requirement "graphicx" - # Preamble WarnNotFound - # Preamble InputOrWarn - ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.eps_tex" - ReferencedFile latex "$$AbsPath$$Basename.eps" - ReferencedFile dvi "$$AbsPath$$Basename.eps" - FormatEnd -TemplateEnd - - -Template ChessDiagram - GuiName "Chess diagram" - HelpText - A chess position diagram. - This template will use XBoard to edit the position. - Use the 'File->Save Position' in XBoard to save - the position that you want to display. - Make sure to give it a '.fen' extension - and remember to type in a relative path - to the LyX document location. - Within XBoard, use 'Edit->Edit Position' - to enable general editing of the board. - You might also check out the - 'Options->Test legality' option, and - remember to middle and right click to - insert new material in the board. - In order for this to work, you have to - put the bundled lyxskak.sty in a place - that TeX will find it, and you will need - to install the skak package from CTAN. - HelpTextEnd - InputFormat fen - FileFilter "*.fen" - AutomaticProduction true - Preview InstantPreview - Format LaTeX - Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard" - Requirement "chess" - UpdateFormat fen - UpdateResult "$$AbsPath$$Basename$$Extension" - ReferencedFile latex "$$AbsPath$$Basename$$Extension" - FormatEnd - Format PDFLaTeX - Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard" - Requirement "chess" - UpdateFormat fen - UpdateResult "$$AbsPath$$Basename$$Extension" - ReferencedFile pdflatex "$$AbsPath$$Basename$$Extension" - FormatEnd - Format Ascii - Product "$$Contents(\"$$AbsPath$$Basename.asc\")" - UpdateFormat asciichess - UpdateResult "$$AbsPath$$Basename.asc" - FormatEnd - Format DocBook - Product "[Chess: $$AbsOrRelPathMaster$$Basename]" - FormatEnd - Format XHTML - Product "
$$Contents(\"$$AbsPath$$Basename.asc\")
" - UpdateFormat asciichess - UpdateResult "$$AbsPath$$Basename.asc" - FormatEnd -TemplateEnd - - -Template LilyPond - GuiName "Lilypond typeset music" - HelpText - Sheet music typeset by GNU LilyPond, - converted to .pdf or .eps for inclusion - Using .eps requires at least lilypond 2.6 - Using .pdf requires at least lilypond 2.9 - HelpTextEnd - InputFormat "lilypond" - FileFilter "*.ly" - AutomaticProduction true - Transform Rotate - Transform Resize - Transform Clip - Transform Extra - Preview InstantPreview - Format LaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - Requirement "graphicx" - ReferencedFile latex "$$AbsPath$$Basename.eps" - ReferencedFile dvi "$$AbsPath$$Basename.eps" - FormatEnd - Format PDFLaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat pdf6 - UpdateResult "$$AbsPath$$Basename.pdf" - Requirement "graphicx" - ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" - FormatEnd - Format Ascii - Product "[LilyPond: $$FName]" - FormatEnd - Format DocBook - Product "[LilyPond: $$FName]" - FormatEnd - Format XHTML - Product "" - UpdateFormat png - UpdateResult "$$AbsPath$$Basename.png" - ReferencedFile xhtml "$$AbsPath$$Basename.png" - FormatEnd -TemplateEnd - -Template PDFPages - GuiName "PDF pages" - HelpText - Includes PDF documents, using the 'pdfpages' package. - To include multiple pages, use the 'pages'-option, - which must be inserted to 'Options'. - Examples: - * pages={x-y} (for a range of pages) - * pages={x,y,z} (for specific pages) - * pages=- (to include all pages) - * pages=last-1 (to include all pages in reverse order) - With the option 'noautoscale' the PDF pages are - inserted in their original size. - Read the documentation of the pdfpages package - for further options and details. - HelpTextEnd - InputFormat pdf6 - FileFilter "*.pdf" - AutomaticProduction true - Transform Rotate - Transform Resize - Transform Extra - Preview Graphics - Format LaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize]" - Product "\\includepdf$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat pdf6 - UpdateResult "$$AbsPath$$Basename.pdf" - Requirement "pdfpages" - ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" - FormatEnd - Format Ascii - Product "[PDFPages: $$FName]" - FormatEnd - Format DocBook - Product "[PDFPages: $$FName]" - FormatEnd - Format XHTML - Product "[PDFPages: $$FName]" - FormatEnd -TemplateEnd - - -Template Dia - GuiName "Dia diagram" - HelpText - Dia diagram. - HelpTextEnd - InputFormat dia - FileFilter "*.dia" - AutomaticProduction true - # LyX has hard-coded support for these transformations - Transform Rotate - Transform Resize - Transform Clip - Transform Extra - Preview InstantPreview - Format LaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - # This string is what is output to the LaTeX file. - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - Requirement "graphicx" - ReferencedFile latex "$$AbsPath$$Basename.eps" - ReferencedFile dvi "$$AbsPath$$Basename.eps" - FormatEnd - Format PDFLaTeX - TransformOption Rotate RotationLatexOption - TransformOption Resize ResizeLatexOption - TransformOption Clip ClipLatexOption - TransformOption Extra ExtraOption - Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" - Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" - UpdateFormat pdf6 - UpdateResult "$$AbsPath$$Basename.pdf" - Requirement "graphicx" - ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" - FormatEnd - Format Ascii - Product "[Dia: $$FName]" - FormatEnd - Format DocBook - Product "" - UpdateFormat eps - UpdateResult "$$AbsPath$$Basename.eps" - ReferencedFile docbook "$$AbsPath$$Basename.eps" - ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" - FormatEnd - Format XHTML - Product "" - UpdateFormat svg - UpdateResult "$$AbsPath$$Basename.svg" - ReferencedFile xhtml "$$AbsPath$$Basename.svg" - FormatEnd -TemplateEnd - diff --git a/lib/xtemplates/chess.xtemplate b/lib/xtemplates/chess.xtemplate new file mode 100644 index 0000000000..16e304258b --- /dev/null +++ b/lib/xtemplates/chess.xtemplate @@ -0,0 +1,67 @@ +# +# Chess Diagram External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +Template ChessDiagram + GuiName "Chess diagram" + HelpText + A chess position diagram. + This template will use XBoard to edit the position. + Use the 'File->Save Position' in XBoard to save + the position that you want to display. + Make sure to give it a '.fen' extension + and remember to type in a relative path + to the LyX document location. + Within XBoard, use 'Edit->Edit Position' + to enable general editing of the board. + You might also check out the + 'Options->Test legality' option, and + remember to middle and right click to + insert new material in the board. + In order for this to work, you have to + put the bundled lyxskak.sty in a place + that TeX will find it, and you will need + to install the skak package from CTAN. + HelpTextEnd + InputFormat fen + FileFilter "*.fen" + AutomaticProduction true + Preview InstantPreview + Format LaTeX + Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard" + Requirement "chess" + UpdateFormat fen + UpdateResult "$$AbsPath$$Basename$$Extension" + ReferencedFile latex "$$AbsPath$$Basename$$Extension" + FormatEnd + Format PDFLaTeX + Product "\\loadgame{$$AbsOrRelPathMaster$$Basename}\\showboard" + Requirement "chess" + UpdateFormat fen + UpdateResult "$$AbsPath$$Basename$$Extension" + ReferencedFile pdflatex "$$AbsPath$$Basename$$Extension" + FormatEnd + Format Ascii + Product "$$Contents(\"$$AbsPath$$Basename.asc\")" + UpdateFormat asciichess + UpdateResult "$$AbsPath$$Basename.asc" + FormatEnd + Format DocBook + Product "[Chess: $$AbsOrRelPathMaster$$Basename]" + FormatEnd + Format XHTML + Product "
$$Contents(\"$$AbsPath$$Basename.asc\")
" + UpdateFormat asciichess + UpdateResult "$$AbsPath$$Basename.asc" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/dia.xtemplate b/lib/xtemplates/dia.xtemplate new file mode 100644 index 0000000000..69714abc56 --- /dev/null +++ b/lib/xtemplates/dia.xtemplate @@ -0,0 +1,71 @@ +# +# Dia External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +Template Dia + GuiName "Dia diagram" + HelpText + Dia diagram. + HelpTextEnd + InputFormat dia + FileFilter "*.dia" + AutomaticProduction true + # LyX has hard-coded support for these transformations + Transform Rotate + Transform Resize + Transform Clip + Transform Extra + Preview InstantPreview + Format LaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + # This string is what is output to the LaTeX file. + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + Requirement "graphicx" + ReferencedFile latex "$$AbsPath$$Basename.eps" + ReferencedFile dvi "$$AbsPath$$Basename.eps" + FormatEnd + Format PDFLaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat pdf6 + UpdateResult "$$AbsPath$$Basename.pdf" + Requirement "graphicx" + ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" + FormatEnd + Format Ascii + Product "[Dia: $$FName]" + FormatEnd + Format DocBook + Product "" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + ReferencedFile docbook "$$AbsPath$$Basename.eps" + ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" + FormatEnd + Format XHTML + Product "" + UpdateFormat svg + UpdateResult "$$AbsPath$$Basename.svg" + ReferencedFile xhtml "$$AbsPath$$Basename.svg" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/gnumeric.xtemplate b/lib/xtemplates/gnumeric.xtemplate new file mode 100644 index 0000000000..1f9e092778 --- /dev/null +++ b/lib/xtemplates/gnumeric.xtemplate @@ -0,0 +1,63 @@ +# +# Gumeric Spreadsheet External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + +Template GnumericSpreadsheet + GuiName "Spreadsheet" + HelpText + A spreadsheet made with Gnumeric, LibreOffice, OpenOffice or Excel. + It imports as a multi-page table, so any length + is ok. Excessive width could be a problem. + The gnumeric software is necessary for conversion, + both for gnumeric and excel files. + HelpTextEnd + InputFormat "gnumeric" + FileFilter "*.{gnumeric,ods,xls,xlsx}" + AutomaticProduction true + Format LaTeX + Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}" + UpdateFormat latex + UpdateResult "$$AbsPath$$Basename.tex" + Requirement "color" + Requirement "array" + Requirement "longtable" + Requirement "calc" + Requirement "multirow" + Requirement "hhline" + Requirement "ifthen" + ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.tex" + FormatEnd + Format PDFLaTeX + Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}" + UpdateFormat latex + UpdateResult "$$AbsPath$$Basename.tex" + Requirement "color" + Requirement "array" + Requirement "longtable" + Requirement "calc" + Requirement "multirow" + Requirement "hhline" + Requirement "ifthen" + ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.tex" + FormatEnd + Format Ascii + Product "[Spreadsheet: $$FName]" + FormatEnd + Format DocBook + Product "[Spreadsheet: $$FName]" + FormatEnd + Format XHTML + Product "$$Contents(\"$$AbsPath$$Basename.html\")

" + UpdateFormat html_table + UpdateResult "$$AbsPath$$Basename.html" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/inkscape.xtemplate b/lib/xtemplates/inkscape.xtemplate new file mode 100644 index 0000000000..840d126882 --- /dev/null +++ b/lib/xtemplates/inkscape.xtemplate @@ -0,0 +1,76 @@ +# +# Inkscape External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +PreambleDef WarnNotFound + %% Print a warning encased in an fbox. + \def\lyxstripprefix#1>{} + \newcommand{\warnNotFound}[1]{% + \def\lyxtempfilename{#1}% + \fbox{Could not find + \ttfamily\expandafter\lyxstripprefix\meaning\lyxtempfilename!}% + \typeout{Could not find \lyxtempfilename!}% + } +PreambleDefEnd + + +PreambleDef InputOrWarn + %% Input the file if it exists, using \input, else print a warning + \newcommand{\inputOrWarn}[1]{% + \IfFileExists{#1}{\input{#1}}{\warnNotFound{#1}}} +PreambleDefEnd + + +Template Inkscape + GuiName "Inkscape figure" + HelpText + An Inkscape figure. + This template should work flawlessly with Inkscape 0.48. + For Inkscape 0.91, there is a (reported) bug in the + LaTeX + PDF output which makes a workaround necessary, + see Embedded Objects manual. + Note that using this template automatically uses the + document text in the image (like with the Xfig template). + HelpTextEnd + InputFormat svg + FileFilter "*.svg" + AutomaticProduction true + Transform Rotate + Preview InstantPreview + Format PDFLaTeX + TransformCommand Rotate RotationLatexCommand + # Resize is not desirable here, as fonts are sized to surrounding LaTeX font + Product "$$RotateFront\\input{$$AbsOrRelPathMaster$$Basename.pdf_tex}$$RotateBack" + UpdateFormat pdftex + UpdateResult "$$AbsPath$$Basename.pdf_tex" + Requirement "color" + Requirement "graphicx" + # Preamble WarnNotFound + # Preamble InputOrWarn + ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdf_tex" + ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" + FormatEnd + Format LaTeX + TransformCommand Rotate RotationLatexCommand + Product "$$RotateFront\\input{$$AbsOrRelPathMaster$$Basename.eps_tex}$$RotateBack" + UpdateFormat pstex + UpdateResult "$$AbsPath$$Basename.eps_tex" + Requirement "color" + Requirement "graphicx" + # Preamble WarnNotFound + # Preamble InputOrWarn + ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.eps_tex" + ReferencedFile latex "$$AbsPath$$Basename.eps" + ReferencedFile dvi "$$AbsPath$$Basename.eps" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/lilypond.xtemplate b/lib/xtemplates/lilypond.xtemplate new file mode 100644 index 0000000000..72b08bd8de --- /dev/null +++ b/lib/xtemplates/lilypond.xtemplate @@ -0,0 +1,68 @@ +# +# LilyPond External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +Template LilyPond + GuiName "Lilypond typeset music" + HelpText + Sheet music typeset by GNU LilyPond, + converted to .pdf or .eps for inclusion + Using .eps requires at least lilypond 2.6 + Using .pdf requires at least lilypond 2.9 + HelpTextEnd + InputFormat "lilypond" + FileFilter "*.ly" + AutomaticProduction true + Transform Rotate + Transform Resize + Transform Clip + Transform Extra + Preview InstantPreview + Format LaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + Requirement "graphicx" + ReferencedFile latex "$$AbsPath$$Basename.eps" + ReferencedFile dvi "$$AbsPath$$Basename.eps" + FormatEnd + Format PDFLaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat pdf6 + UpdateResult "$$AbsPath$$Basename.pdf" + Requirement "graphicx" + ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" + FormatEnd + Format Ascii + Product "[LilyPond: $$FName]" + FormatEnd + Format DocBook + Product "[LilyPond: $$FName]" + FormatEnd + Format XHTML + Product "" + UpdateFormat png + UpdateResult "$$AbsPath$$Basename.png" + ReferencedFile xhtml "$$AbsPath$$Basename.png" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/pdfpages.xtemplate b/lib/xtemplates/pdfpages.xtemplate new file mode 100644 index 0000000000..9d375a84c7 --- /dev/null +++ b/lib/xtemplates/pdfpages.xtemplate @@ -0,0 +1,57 @@ +# +# PDFPages External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + +Template PDFPages + GuiName "PDF pages" + HelpText + Includes PDF documents, using the 'pdfpages' package. + To include multiple pages, use the 'pages'-option, + which must be inserted to 'Options'. + Examples: + * pages={x-y} (for a range of pages) + * pages={x,y,z} (for specific pages) + * pages=- (to include all pages) + * pages=last-1 (to include all pages in reverse order) + With the option 'noautoscale' the PDF pages are + inserted in their original size. + Read the documentation of the pdfpages package + for further options and details. + HelpTextEnd + InputFormat pdf6 + FileFilter "*.pdf" + AutomaticProduction true + Transform Rotate + Transform Resize + Transform Extra + Preview Graphics + Format LaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize]" + Product "\\includepdf$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat pdf6 + UpdateResult "$$AbsPath$$Basename.pdf" + Requirement "pdfpages" + ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" + FormatEnd + Format Ascii + Product "[PDFPages: $$FName]" + FormatEnd + Format DocBook + Product "[PDFPages: $$FName]" + FormatEnd + Format XHTML + Product "[PDFPages: $$FName]" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/raster_image.xtemplate b/lib/xtemplates/raster_image.xtemplate new file mode 100644 index 0000000000..1872d62757 --- /dev/null +++ b/lib/xtemplates/raster_image.xtemplate @@ -0,0 +1,89 @@ +# +# Raster Image External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +Template RasterImage + # By default, InsetExternal is displayed as a grey button + # containing this text. + GuiName "Raster image" + # This text is used in the External dialog. + # Provide enough information to explain to the user just + # what the template can provide him with. + HelpText + A bitmap file. + 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 + # in order to deduce its format. + InputFormat "*" + # Globbing pattern used when browsing for a Raster image file. + FileFilter "*.{gif,png,jpg,bmp,pbm,ppm,tga,tif,xpm,xbm}" + # Set to "true" if the file represented by the template + # must be generated by LyX. + AutomaticProduction true + # LyX has hard-coded support for these transformations + Transform Rotate + Transform Resize + Transform Clip + Transform Extra + # LyX preview options: + # Off: LyX will not attempt to show this material on screen. + # Graphics: LyX will attempt to show this material as-is or via a + # conversion to a showable format. + # InstantPreview: LyX will attempt to use the 'instant preview' + # mechanism in order to show this material. + Preview Graphics + Format LaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + # This string is what is output to the LaTeX file. + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + Requirement "graphicx" + ReferencedFile latex "$$AbsPath$$Basename.eps" + ReferencedFile dvi "$$AbsPath$$Basename.eps" + FormatEnd + Format PDFLaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat "$$pngOrjpg" + UpdateResult "$$AbsPath$$Basename.$$pngOrjpg" + Requirement "graphicx" + ReferencedFile pdflatex "$$AbsPath$$Basename.$$pngOrjpg" + FormatEnd + Format Ascii + Product "[RasterImage: $$FName]" + FormatEnd + Format DocBook + Product "" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + ReferencedFile docbook "$$AbsPath$$Basename.eps" + ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" + FormatEnd + Format XHTML + Product "" + UpdateFormat png + UpdateResult "$$AbsPath$$Basename.png" + ReferencedFile xhtml "$$AbsPath$$Basename.png" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/vector_graphics.xtemplate b/lib/xtemplates/vector_graphics.xtemplate new file mode 100644 index 0000000000..103a602ae8 --- /dev/null +++ b/lib/xtemplates/vector_graphics.xtemplate @@ -0,0 +1,82 @@ +# +# Vector Graphics External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +Template VectorGraphics + GuiName "Vector graphics" + HelpText + A vector graphics file. + Use this template to include vector graphics of any kind. + LyX will try to retain the vector properties of the image for + the final output. + Note that specialized templates exist for Xfig figures and Dia diagrams. + The specialized templates allow to automatically use the document font in + the figures, which is not possible with this general template. + HelpTextEnd + # ANY file type can be displayed as a VectorGraphics. + # Specifically, LyX will attempt to interrogate the file itself + # in order to deduce its format. + InputFormat "*" + # Globbing pattern used when browsing for a vector graphics file. + # xfig, dia, fen and ly are exlcuded, since we have specialized templates + FileFilter "*.{agr,dot,emf,eps,odg,obj,sxd,svg,svgz,tgo,pdf,wmf}" + AutomaticProduction true + # LyX has hard-coded support for these transformations + Transform Rotate + Transform Resize + Transform Clip + Transform Extra + Preview Graphics + Format LaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + # This string is what is output to the LaTeX file. + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + Requirement "graphicx" + ReferencedFile latex "$$AbsPath$$Basename.eps" + ReferencedFile dvi "$$AbsPath$$Basename.eps" + FormatEnd + Format PDFLaTeX + TransformOption Rotate RotationLatexOption + TransformOption Resize ResizeLatexOption + TransformOption Clip ClipLatexOption + TransformOption Extra ExtraOption + Option Arg "[$$Extra,$$Rotate,$$Resize,$$Clip]" + Product "\\includegraphics$$Arg{$$AbsOrRelPathMaster$$Basename}" + UpdateFormat pdf6 + UpdateResult "$$AbsPath$$Basename.pdf" + Requirement "graphicx" + ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" + FormatEnd + Format Ascii + Product "[VectorGraphics: $$FName]" + FormatEnd + Format DocBook + Product "" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + ReferencedFile docbook "$$AbsPath$$Basename.eps" + ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" + FormatEnd + Format XHTML + Product "" + UpdateFormat svg + UpdateResult "$$AbsPath$$Basename.svg" + ReferencedFile xhtml "$$AbsPath$$Basename.svg" + FormatEnd +TemplateEnd + diff --git a/lib/xtemplates/xfig.xtemplate b/lib/xtemplates/xfig.xtemplate new file mode 100644 index 0000000000..e24a8de41d --- /dev/null +++ b/lib/xtemplates/xfig.xtemplate @@ -0,0 +1,88 @@ +# +# XFig External Template +# +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# author Asger Alstrup Nielsen +# author Angus Leeming +# author Johnathan Burchill +# +# Full author contact details are available in file CREDITS. + + +PreambleDef WarnNotFound + %% Print a warning encased in an fbox. + \def\lyxstripprefix#1>{} + \newcommand{\warnNotFound}[1]{% + \def\lyxtempfilename{#1}% + \fbox{Could not find + \ttfamily\expandafter\lyxstripprefix\meaning\lyxtempfilename!}% + \typeout{Could not find \lyxtempfilename!}% + } +PreambleDefEnd + + +PreambleDef InputOrWarn + %% Input the file if it exists, using \input, else print a warning + \newcommand{\inputOrWarn}[1]{% + \IfFileExists{#1}{\input{#1}}{\warnNotFound{#1}}} +PreambleDefEnd + + +Template XFig + GuiName "Xfig figure" + HelpText + An Xfig figure. + HelpTextEnd + InputFormat fig + FileFilter "*.fig" + AutomaticProduction true + Transform Rotate + Transform Resize + Preview InstantPreview + Format LaTeX + TransformCommand Rotate RotationLatexCommand + TransformCommand Resize ResizeLatexCommand + Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pstex_t}$$ResizeBack$$RotateBack" + UpdateFormat pstex + UpdateResult "$$AbsPath$$Basename.pstex_t" + Requirement "color" + Requirement "graphicx" + # Preamble WarnNotFound + # Preamble InputOrWarn + ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.pstex_t" + ReferencedFile latex "$$AbsPath$$Basename.eps" + ReferencedFile dvi "$$AbsPath$$Basename.eps" + FormatEnd + Format PDFLaTeX + TransformCommand Rotate RotationLatexCommand + TransformCommand Resize ResizeLatexCommand + Product "$$RotateFront$$ResizeFront\\input{$$AbsOrRelPathMaster$$Basename.pdftex_t}$$ResizeBack$$RotateBack" + UpdateFormat pdftex + UpdateResult "$$AbsPath$$Basename.pdftex_t" + Requirement "color" + Requirement "graphicx" + # Preamble WarnNotFound + # Preamble InputOrWarn + ReferencedFile pdflatex "$$AbsOrRelPathMaster$$Basename.pdftex_t" + ReferencedFile pdflatex "$$AbsPath$$Basename.pdf" + FormatEnd + Format Ascii + Product "[XFig: $$FName]" + FormatEnd + Format DocBook + Product "" + UpdateFormat eps + UpdateResult "$$AbsPath$$Basename.eps" + ReferencedFile docbook "$$AbsPath$$Basename.eps" + ReferencedFile docbook-xml "$$AbsPath$$Basename.eps" + FormatEnd + Format XHTML + Product "" + UpdateFormat svg + UpdateResult "$$AbsPath$$Basename.svg" + ReferencedFile xhtml "$$AbsPath$$Basename.svg" + FormatEnd +TemplateEnd + diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 590921cd6c..a235085352 100755 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -93,7 +93,7 @@ add_gettext_python(languages lib languages) add_gettext_python(latexfonts lib latexfonts) add_gettext_python(encodings lib encodings) add_gettext_python(ui lib/ui *.ui *.inc) -add_gettext_python(external lib external_templates) +add_gettext_python(external lib/xtemplates *.xtemplate) add_gettext_python(formats lib configure.py) add_gettext_python(layouttranslations lib/layouts *.layout *.inc *.module) diff --git a/po/Rules-lyx b/po/Rules-lyx index a70a61d1c4..85a653db93 100644 --- a/po/Rules-lyx +++ b/po/Rules-lyx @@ -50,7 +50,7 @@ encodings_l10n.pot: $(top_srcdir)/lib/encodings ui_l10n.pot: $(top_srcdir)/lib/ui/*.ui $(top_srcdir)/lib/ui/*.inc $(LYX_POT) -o $@ -t ui $^ -external_l10n.pot: $(top_srcdir)/lib/external_templates +external_l10n.pot: $(top_srcdir)/lib/xtemplates/*.xtemplate $(LYX_POT) -o $@ -t external $^ formats_l10n.pot: $(top_srcdir)/lib/configure.py diff --git a/po/lyx_pot.py b/po/lyx_pot.py index 8cb9a4d954..d783fe9ff8 100755 --- a/po/lyx_pot.py +++ b/po/lyx_pot.py @@ -512,7 +512,7 @@ def latexfonts_l10n(input_files, output, base): def external_l10n(input_files, output, base): - '''Generate pot file from lib/external_templates''' + '''Generate pot file from lib/xtemplates''' output = io.open(output, 'w', encoding='utf_8', newline='\n') Template = re.compile(r'^Template\s+(.*)', re.IGNORECASE) GuiName = re.compile(r'\s*GuiName\s+(.*)', re.IGNORECASE) @@ -631,7 +631,7 @@ where languages: file lib/languages latexfonts: file lib/latexfonts encodings: file lib/encodings - external: external templates file + external: external templates files formats: formats predefined in lib/configure.py ''' diff --git a/src/LyX.cpp b/src/LyX.cpp index f0fc71cfe9..9b54463730 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -1057,7 +1057,8 @@ bool LyX::queryUserLyXDir(bool explicit_userdir) || configFileNeedsUpdate("lyxmodules.lst") || configFileNeedsUpdate("textclass.lst") || configFileNeedsUpdate("packages.lst") - || configFileNeedsUpdate("lyxciteengines.lst"); + || configFileNeedsUpdate("lyxciteengines.lst") + || configFileNeedsUpdate("xtemplates.lst"); } first_start = !explicit_userdir; diff --git a/src/insets/ExternalTemplate.cpp b/src/insets/ExternalTemplate.cpp index 64f31343a6..651f2b61ec 100644 --- a/src/insets/ExternalTemplate.cpp +++ b/src/insets/ExternalTemplate.cpp @@ -260,43 +260,91 @@ void TemplateManager::readTemplates(FileName const & path) { "templateend", TM_TEMPLATE_END } }; - Lexer lex(templatetags); + // Read the templates list + vector templateslist; + FileName const real_file = libFileSearch("", "xtemplates.lst"); + LYXERR(Debug::EXTERNAL, "Reading external templates from `" << real_file << '\''); - FileName const filename = libFileSearch("", "external_templates"); - if (filename.empty() || !lex.setFile(filename)) { - lex.printError("external::TemplateManager::readTemplates: " - "No template file"); + if (real_file.empty()) { + LYXERR0("unable to find external templates file `xtemplates.lst'.\n" + << "No external templates will be available."); return; } - char const * const preamble_end_tag = - templatetags[TM_PREAMBLEDEF_END-1].tag; + Lexer tlex; + if (!tlex.setFile(real_file)) { + LYXERR0("lyxlex was not able to set file: " + << real_file << ".\nNo external templates will be available."); + return; + } - while (lex.isOK()) { - switch (lex.lex()) { - case TM_PREAMBLEDEF: { - lex.next(); - string const name = lex.getString(); - preambledefs[name] = lex.getLongString(from_ascii(preamble_end_tag)); + if (!tlex.isOK()) { + LYXERR0("unable to open external templates file `" + << to_utf8(makeDisplayPath(real_file.absFileName(), 1000)) + << "'\nNo external templates will be available."); + return; + } + + bool finished = false; + // Parse external templates files + LYXERR(Debug::EXTERNAL, "Starting parsing of xtemplates.lst"); + while (tlex.isOK() && !finished) { + LYXERR(Debug::EXTERNAL, "\tline by line"); + switch (tlex.lex()) { + case Lexer::LEX_FEOF: + finished = true; + break; + default: + string const name = tlex.getString(); + LYXERR(Debug::EXTERNAL, "Template name: " << name); + templateslist.push_back(name); + break; } - break; + } - case TM_TEMPLATE: { - lex.next(); - string const name = lex.getString(); - Template & tmp = templates[name]; - tmp.lyxName = name; - tmp.readTemplate(lex); + LYXERR(Debug::EXTERNAL, "End of parsing of xtemplates.lst"); + + for (vector::const_iterator it = templateslist.begin(); it != templateslist.end(); ++it) { + FileName const filename = libFileSearch("xtemplates", *it); + LYXERR(Debug::EXTERNAL, "Reading template file " << filename.absFileName()); + Lexer lex(templatetags); + if (filename.empty() || !lex.setFile(filename)) { + lex.printError("external::TemplateManager::readTemplates: " + "No template file"); + return; } - break; - case TM_TEMPLATE_END: - lex.printError("Warning: End outside Template."); - break; + char const * const preamble_end_tag = + templatetags[TM_PREAMBLEDEF_END-1].tag; - case TM_PREAMBLEDEF_END: - lex.printError("Warning: End outside PreambleDef."); - break; + while (lex.isOK()) { + switch (lex.lex()) { + case TM_PREAMBLEDEF: { + lex.next(); + string const name = lex.getString(); + preambledefs[name] = lex.getLongString(from_ascii(preamble_end_tag)); + break; + } + + case TM_TEMPLATE: { + lex.next(); + string const name = lex.getString(); + Template & tmp = templates[name]; + tmp.lyxName = name; + tmp.readTemplate(lex); + break; + } + + case TM_TEMPLATE_END: + lex.printError("Warning: End outside Template."); + break; + + case TM_PREAMBLEDEF_END: + lex.printError("Warning: End outside PreambleDef."); + break; + default: + break; + } } } }