]> git.lyx.org Git - features.git/commitdiff
Prepare the way for a shiny new external inset.
authorAngus Leeming <leeming@lyx.org>
Sat, 31 May 2003 16:52:33 +0000 (16:52 +0000)
committerAngus Leeming <leeming@lyx.org>
Sat, 31 May 2003 16:52:33 +0000 (16:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7072 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/configure.m4
lib/scripts/fig2pdftex.sh
lib/scripts/fig2pstex.sh [new file with mode: 0644]

index a5cb36370657e0da6c8d664b973f8e081c1c15bd..2d4bb3ee922ffb3a5b78a81187b688ad6ea9d75f 100644 (file)
@@ -1,3 +1,11 @@
+2003-05-31  Angus Leeming  <leeming@lyx.org>
+
+       * configure.m4 (latex_to_html_command): add a bunch of formats and
+       converters that are to be used by the external inset.
+
+       * fig2pdftex.sh: make it work as a "converter".
+       * fig2pstex.sh: new file: a converter from xfig to pstex_t.
+
 2003-05-30  John Levon  <levon@movementarian.org>
 
        * ui/stdmenus.ui: Force Normal Space -> Inter-word Space
index 6485b099bfe6f6b502dd2f8e43c5167db32d311e..8c73c77db2cb7a5ea4c6bce5342e3f70b7a7aad4 100644 (file)
@@ -430,62 +430,75 @@ cat >$outfile <<EOF
 # want to customize LyX, make a copy of the file LYXDIR/lyxrc as
 # ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
 # override the values given here.
-\\Format text    txt   ASCII           A
-\\Format textparagraph txt ASCII(paragraphs)   ""
-\\Format docbook  sgml DocBook         B
+\\Format asciichess asc "ASCII (chess output)" ""
+\\Format asciiimage asc "ASCII (image)" ""
+\\Format asciixfig  asc "ASCII (xfig output)" ""
+\\Format agr      agr  GRACE           ""
 \\Format bmp      bmp  BMP             ""
+\\Format date     ""    "date command"  ""
+\\Format dateout  ""    "date (output)" ""
+\\Format docbook  sgml DocBook         B
 \\Format dvi     dvi   DVI             D
 \\Format eps     eps   EPS             ""
 \\Format fax     ""    Fax             ""
+\\Format fen      fen   FEN             ""
 \\Format fig     fig   XFig            ""
-\\Format agr      agr  GRACE           ""
-\\Format html    html  HTML            H
 \\Format gif     gif   GIF             ""
+\\Format html    html  HTML            H
 \\Format jpg     jpg   JPG             ""
 \\Format latex   tex   LaTeX           L
 \\Format linuxdoc sgml LinuxDoc        x
 \\Format lyx      lyx  LyX             ""
+\\Format lyxpreview    lyxpreview      "LyX Preview"           ""
 \\Format literate nw   NoWeb           N
+\\Format pbm     pbm   PBM             ""
 \\Format pdf     pdf   PDF             P
 \\Format pdf2    pdf  "PDF (pdflatex)" F
 \\Format pdf3    pdf  "PDF (dvipdfm)"  m
+\\Format pdftex   pdftex_t PDFTEX       ""
+\\Format pgm     pgm   PGM             ""
 \\Format png     png   PNG             ""
 \\Format ppm     ppm   PPM             ""
-\\Format pgm     pgm   PGM             ""
-\\Format pbm     pbm   PBM             ""
-\\Format ps      ps    Postscript      t
 \\Format program  ""   Program         ""
+\\Format ps      ps    Postscript      t
+\\Format pstex    pstex_t PSTEX         ""
+\\Format text    txt   ASCII           A
+\\Format textparagraph txt ASCII(paragraphs)   ""
 \\Format tgif     obj  TGIF            ""
 \\Format tiff     tif  TIFF            ""
 \\Format word    doc   Word            W
 \\Format xbm     xbm   XBM             ""
 \\Format xpm     xpm   XPM             ""
-\\Format lyxpreview    lyxpreview      "LyX Preview"           ""
 
-\\converter latex dvi "$latex_to_dvi" "latex"
-\\converter latex pdf2 "$latex_to_pdf" "latex"
-\\converter latex html "$latex_to_html_command" "originaldir,needaux"
-\\converter literate latex "$literate_to_tex_command" ""
+\\converter date dateout "date +%d-%m-%Y > \$\$o" ""
+\\converter docbook dvi "$docbook_to_dvi_command" ""
+\\converter docbook html "$docbook_to_html_command" ""
 \\converter dvi pdf3 "$dvi_to_pdf_command" ""
 \\converter dvi ps "$dvi_to_ps_command" ""
-\\converter ps pdf "$ps_to_pdf_command" ""
-\\converter ps fax "$fax_command" ""
-\\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
-\\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
+\\converter fen asciichess "python \$\$s/fen2ascii.py \$\$i \$\$o" ""
+\\converter fig pdftex "sh \$\$s/fig2pdftex.sh \$\$i \$\$o" ""
+\\converter fig pstex  "sh \$\$s/fig2pstex.sh \$\$i \$\$o" ""
+\\converter html latex "$html_to_latex_command" ""
+\\converter latex html "$latex_to_html_command" "originaldir,needaux"
+\\converter latex dvi "$latex_to_dvi" "latex"
+\\converter latex lyx "$tex_to_lyx_command" ""
+\\converter latex pdf2 "$latex_to_pdf" "latex"
 \\converter linuxdoc dvi "$linuxdoc_to_dvi_command" ""
 \\converter linuxdoc html "$linuxdoc_to_html_command" ""
-\\converter docbook dvi "$docbook_to_dvi_command" ""
-\\converter docbook html "$docbook_to_html_command" ""
-\\converter lyxpreview ppm "$lyxpreview_to_bitmap_command" ""
-
-\\converter latex lyx "$tex_to_lyx_command" ""
+\\converter linuxdoc latex "$linuxdoc_to_latex_command" ""
+\\converter linuxdoc lyx "$linuxdoc_to_lyx_command" ""
+\\converter literate latex "$literate_to_tex_command" ""
 \\converter literate lyx "$literate_to_lyx_command" ""
-\\converter html latex "$html_to_latex_command" ""
+\\converter lyxpreview ppm "$lyxpreview_to_bitmap_command" ""
+\\converter ps fax "$fax_command" ""
+\\converter ps pdf "$ps_to_pdf_command" ""
 \\converter word latex "$word_to_latex_command" ""
 
 \\viewer dvi "$DVI_VIEWER"
 \\viewer html "$HTML_VIEWER"
 \\viewer pdf "$PDF_VIEWER"
+\\viewer pdf2 "$PDF_VIEWER"
+\\viewer pdf3 "$PDF_VIEWER"
 \\viewer ps "$GHOSTVIEW -swap"
 \\viewer eps "$GHOSTVIEW"
 
@@ -501,6 +514,7 @@ if test "$FIG2DEV" = "fig2dev"; then
 cat >>$outfile <<EOF
 \\converter fig eps "fig2dev -L eps \$\$i \$\$o" ""
 \\converter fig ppm "fig2dev -L ppm \$\$i \$\$o" ""
+\\converter fig png "fig2dev -L png \$\$i \$\$o" ""
 EOF
 fi
 
index 0af2724e7c8a39543abe01705a210a0b053c265b..c6bebf2affd8acd2a9f7fe846dfc698b4ba89ff9 100644 (file)
 # a PDF file ${base}.pdf and place the text in a LaTeX file
 # ${base}.pdftex_t for typesetting by pdflatex itself.
 modern_xfig() {
-    input=$1.fig
-    pdftex=$1.pdf
-    pdftex_t=$1.pdftex_t
+    echo modern_xfig
+
+    # Can we find fig2dev?
+    type fig2dev > /dev/null || exit 1
+
+    input=$1
+    pdftex_t=$2
+    pdftex=$3.pdf
 
     fig2dev -Lpdftex ${input} ${pdftex}
-    fig2dev -Lpdftex_t -p$1 ${input} ${pdftex_t}
+    fig2dev -Lpdftex_t -p${outbase} ${input} ${pdftex_t}
 
     exit 0;
 }
@@ -35,13 +40,20 @@ modern_xfig() {
 # Older versions of xfig cannot do this, so we emulate the behaviour using
 # pstex and pstex_t output.
 legacy_xfig() {
-    input=$1.fig
-    pstex=$1.pstex
-    png=$1.png
-    pdftex_t=$1.pdftex_t
+    echo legacy_xfig
+
+    # Can we find fig2dev, eps2eos or gs?
+    type fig2dev > /dev/null || exit 1
+    type eps2eps > /dev/null || exit 1
+    type gs > /dev/null || exit 1
+
+    input=$1
+    pdftex_t=$2
+    png=$3.png
+    pstex=$3.pstex
 
     fig2dev -Lpstex ${input} ${pstex}
-    fig2dev -Lpstex_t -p$1 ${input} ${pdftex_t}
+    fig2dev -Lpstex_t -p${outbase} ${input} ${pdftex_t}
 
     # Convert the ${pstex} EPS file (free of "special" text) to PDF format
     # using gs.
@@ -73,29 +85,42 @@ legacy_xfig() {
 # The main logic of the script is below.
 # All it does is ascertain which of the two functions above to call.
 
-# We expect a single arg, the name of the input file.
-test $# -eq 1 || exit 1
+# We expect two args, the names of the input and output files.
+test $# -eq 2 || exit 1
+
+input=$1
+output=$2
 
-# Remove the .fig extension
-input=`basename $1`
-base=`echo ${input} | sed 's/\.fig$//'`
+# Strip the extension from ${output}
+outbase=`echo ${output} | sed 's/[.][^.]*$//'`
 
 # Ascertain whether fig2dev is "modern enough".
 # Here "modern" means "fig2dev Version 3.2 Patchlevel 4"
 version_info=`fig2dev -h | sed '/^fig2dev/! d'`
 # If no line begins "fig2dev" then default to legacy_xfig
-test "x${version_info}" = "x" && legacy_xfig ${base}
+test "x${version_info}" = "x" && {
+    legacy_xfig ${input} ${output} ${outbase}
+}
 
 version=`echo ${version_info} | cut -d' ' -f3`
 patchlevel=`echo ${version_info} | cut -d' ' -f5`
 # If we cannot extract the version of patchlevel info
 # then default to legacy_xfig
-test "x${version}" = "x" -o "x${patchlevel}" = "x" && legacy_xfig ${base}
-echo ${version} ${patchlevel} | grep '[0-9]!' -o && legacy_xfig ${base}
+test "x${version}" = "x" -o "x${patchlevel}" = "x" && {
+    legacy_xfig ${input} ${output} ${outbase}
+}
+echo ${version} ${patchlevel} | grep '[0-9]!' -o && {
+    legacy_xfig ${input} ${output} ${outbase}
+}
 
-# So, is it am old version?
-test ${version} != "3.2" -o ${patchlevel} -lt 4 && legacy_xfig ${base}
+# So, is it an old version?
+test ${version} != "3.2" -o ${patchlevel} -lt 4 && {
+    legacy_xfig ${input} ${output} ${outbase}
+}
 # I guess not ;-)
-modern_xfig ${base}
+
+# Commented out for now to test legacy_xfig...
+#modern_xfig ${input} ${output} ${outbase}
+legacy_xfig ${input} ${output} ${outbase}
 
 # The end
diff --git a/lib/scripts/fig2pstex.sh b/lib/scripts/fig2pstex.sh
new file mode 100644 (file)
index 0000000..db61274
--- /dev/null
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+# file fig2pstex.sh
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# author Angus Leeming
+#
+# Full author contact details are available in file CREDITS
+
+
+# This script converts an XFIG image to something that latex can process
+# into high quality PostScript.
+
+# Usage: sh fig2pstex.sh ${input} ${output}
+# to generate the pstex_t file ${output}.
+# In turn this file will \includegraphics{${output_base}}.
+# The necessary ${output_base}.eps is also generated by this script.
+#
+# Thereafter, you need only '\input{${output}}' in your latex document.
+
+# We expect two args, the names of the input and output files.
+test $# -eq 2 || exit 1
+
+# Can we find fig2dev?
+type fig2dev > /dev/null || exit 1
+
+input=$1
+output=$2
+
+# Strip the extension from ${output}
+outbase=`echo ${output} | sed 's/[.][^.]*$//'`
+
+# Generate the EPS file
+outeps=${outbase}.eps
+fig2dev -Lpstex ${input} ${outeps}
+
+# Generate the PSTEX_T file
+fig2dev -Lpstex_t -p${outbase} ${input} ${output}
+
+# The end