]> git.lyx.org Git - features.git/commitdiff
Split external_templates to individual *.xtemplate files
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 26 Mar 2017 13:32:01 +0000 (15:32 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 26 Mar 2017 13:32:01 +0000 (15:32 +0200)
This makes it easier to add new templates or change existing ones
in the user directory.

Fixes: #3983
The CMake changes should be double-checked.

20 files changed:
development/cmake/Install.cmake
lib/Makefile.am
lib/RELEASE-NOTES
lib/configure.py
lib/doc/Customization.lyx
lib/external_templates [deleted file]
lib/xtemplates/chess.xtemplate [new file with mode: 0644]
lib/xtemplates/dia.xtemplate [new file with mode: 0644]
lib/xtemplates/gnumeric.xtemplate [new file with mode: 0644]
lib/xtemplates/inkscape.xtemplate [new file with mode: 0644]
lib/xtemplates/lilypond.xtemplate [new file with mode: 0644]
lib/xtemplates/pdfpages.xtemplate [new file with mode: 0644]
lib/xtemplates/raster_image.xtemplate [new file with mode: 0644]
lib/xtemplates/vector_graphics.xtemplate [new file with mode: 0644]
lib/xtemplates/xfig.xtemplate [new file with mode: 0644]
po/CMakeLists.txt
po/Rules-lyx
po/lyx_pot.py
src/LyX.cpp
src/insets/ExternalTemplate.cpp

index 839d9534efb1c895ff6aebaa2582b84631747b70..d428dcb674e7b65d70923620ad169734ea7b64f7 100755 (executable)
@@ -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 .            *      .)
index b8a8a5dddaf066d1b0aeaad14eb1cf9b349ab985..5b92c532f9814b2e3c720f6a1f53140f43663104 100644 (file)
@@ -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.
index 496d0a91d3a3ef445360327b88b301c3eef730d6..b4534cbca0fa9845019fa3ca1a24f35d40bb4596 100644 (file)
 !!!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:
 
 
 
 * 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
index e43e1b5774e83f6eb61aa464ea240eb0a4cba99a..7f46ec6531244f0dbf6c1a8a595e127b5f64471a 100644 (file)
@@ -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()
index a9a23de2d9265ea8bf753c9daad813e45b62bc4c..761003ac77910393f26f034438372cbd1ec5ab85 100644 (file)
@@ -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 (file)
index 84d41fa..0000000
+++ /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\")</p>"
-               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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
-               UpdateFormat eps
-               UpdateResult "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
-       FormatEnd
-       Format XHTML
-               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
-               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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
-               UpdateFormat eps
-               UpdateResult "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
-       FormatEnd
-       Format XHTML
-               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
-               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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
-               UpdateFormat eps
-               UpdateResult "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
-       FormatEnd
-       Format XHTML
-               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
-               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 "<pre>$$Contents(\"$$AbsPath$$Basename.asc\")</pre>"
-               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 "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
-               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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
-               UpdateFormat eps
-               UpdateResult "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
-               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
-       FormatEnd
-       Format XHTML
-               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
-               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 (file)
index 0000000..16e3042
--- /dev/null
@@ -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 "<pre>$$Contents(\"$$AbsPath$$Basename.asc\")</pre>"
+               UpdateFormat asciichess
+               UpdateResult "$$AbsPath$$Basename.asc"
+       FormatEnd
+TemplateEnd
+
diff --git a/lib/xtemplates/dia.xtemplate b/lib/xtemplates/dia.xtemplate
new file mode 100644 (file)
index 0000000..69714ab
--- /dev/null
@@ -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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
+               UpdateFormat eps
+               UpdateResult "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
+       FormatEnd
+       Format XHTML
+               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
+               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 (file)
index 0000000..1f9e092
--- /dev/null
@@ -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\")</p>"
+               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 (file)
index 0000000..840d126
--- /dev/null
@@ -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 (file)
index 0000000..72b08bd
--- /dev/null
@@ -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 "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
+               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 (file)
index 0000000..9d375a8
--- /dev/null
@@ -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 (file)
index 0000000..1872d62
--- /dev/null
@@ -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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
+               UpdateFormat eps
+               UpdateResult "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
+       FormatEnd
+       Format XHTML
+               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.png\" />"
+               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 (file)
index 0000000..103a602
--- /dev/null
@@ -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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
+               UpdateFormat eps
+               UpdateResult "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
+       FormatEnd
+       Format XHTML
+               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
+               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 (file)
index 0000000..e24a8de
--- /dev/null
@@ -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 "<graphic fileref=\"$$AbsOrRelPathMaster$$Basename.eps\"></graphic>"
+               UpdateFormat eps
+               UpdateResult "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook     "$$AbsPath$$Basename.eps"
+               ReferencedFile docbook-xml "$$AbsPath$$Basename.eps"
+       FormatEnd
+       Format XHTML
+               Product "<img src=\"$$AbsOrRelPathMaster$$Basename.svg\" />"
+               UpdateFormat svg
+               UpdateResult "$$AbsPath$$Basename.svg"
+               ReferencedFile xhtml "$$AbsPath$$Basename.svg"
+       FormatEnd
+TemplateEnd
+
index 590921cd6c52d3e24bac2a84513598c1140872c7..a2350853521dbd50634157a1f41d57cd551c9835 100755 (executable)
@@ -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)
 
index a70a61d1c48e0bb15c437153d56b64e88c31f571..85a653db93299fb6c673010880e876c0db807272 100644 (file)
@@ -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
index 8cb9a4d9540bfa24b335cf49d39f32114d5aa546..d783fe9ff84a77d5c3ba7f4e8e3454873dfe2e5e 100755 (executable)
@@ -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
 '''
 
index f0fc71cfe955654c8ec4b00b1d96403382f11b8b..9b54463730a4b72eb9cb31d92dfbad7bd0e81190 100644 (file)
@@ -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;
index 64f31343a67d13817daa093e40e5b6dfbd5c2d5c..651f2b61ec0b0052fe8e6ab3da49d823e43ec661 100644 (file)
@@ -260,43 +260,91 @@ void TemplateManager::readTemplates(FileName const & path)
                { "templateend", TM_TEMPLATE_END }
        };
 
-       Lexer lex(templatetags);
+       // Read the templates list
+       vector<string> templateslist;
+       FileName const real_file = libFileSearch("", "xtemplates.lst");
+       LYXERR(Debug::EXTERNAL, "Reading external templates from `" << real_file << '\'');
+
+       if (real_file.empty()) {
+               LYXERR0("unable to find external templates file `xtemplates.lst'.\n"
+                       << "No external templates will be available.");
+               return;
+       }
 
-       FileName const filename = libFileSearch("", "external_templates");
-       if (filename.empty() || !lex.setFile(filename)) {
-               lex.printError("external::TemplateManager::readTemplates: "
-                              "No template file");
+       Lexer tlex;
+       if (!tlex.setFile(real_file)) {
+               LYXERR0("lyxlex was not able to set file: "
+                       << real_file << ".\nNo external templates will be available.");
                return;
        }
 
-       char const * const preamble_end_tag =
-               templatetags[TM_PREAMBLEDEF_END-1].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;
+       }
 
-       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));
+       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<string>::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;
+                       }
                }
        }
 }