diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/autolatex/translators |
Initial commit
Diffstat (limited to 'support/autolatex/translators')
49 files changed, 2596 insertions, 0 deletions
diff --git a/support/autolatex/translators/asml2pdf.transdef b/support/autolatex/translators/asml2pdf.transdef new file mode 100644 index 0000000000..c8b1f68b5e --- /dev/null +++ b/support/autolatex/translators/asml2pdf.transdef @@ -0,0 +1,155 @@ +# autolatex - asml2pdf.transdef +# Copyright (C) 2017 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .asml + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $INITIAL_HEAP_SIZE = "64m"; + my $MAXIMUM_HEAP_SIZE = "1024m"; + my @JAVA_OPTS = ("-Xms$INITIAL_HEAP_SIZE", "-Xmx$MAXIMUM_HEAP_SIZE"); + + my @libraries = ( + 'astah-sys.jar', + ); + + # Detect the Astah installation + if ( ! $ENV{"ASTAH_SYSML_HOME"} ) { + my @tmp = ('astah-sysml'); + my $tmp = undef; + for(my $i=0; $i<@tmp && !$tmp; $i++) { + my $bin = $tmp[$i]; + $bin = which("$bin"); + if ( $bin && -x "$bin" ) { + $bin = readlink_osindep("$bin"); + $tmp = dirname("$bin"); + } + } + if ( ! $tmp ) { + @tmp = ('/usr/lib/astah_sysml', + ); + for(my $i=0; $i<@tmp && !$tmp; $i++) { + my $dir = $tmp[$i]; + if ( -d "$dir" ) { + $tmp = $dir; + } + } + if ( ! $tmp ) { + printErr("Unable to find the installation directory of Astah SysML. Please define the ASTAH_SYSML_HOME environment variable."); + } + } + $ENV{"ASTAH_SYSML_HOME"} = $tmp; + } + + # Detect the Java library of astah + my $jarfile; + for(my $i=0; $i<@libraries && !$jarfile; $i++) { + my $library = $libraries[$i]; + if ( -f File::Spec->catfile("$ENV{ASTAH_SYSML_HOME}", "$library" ) ) { + $jarfile = $library; + } + } + if ( ! $jarfile ) { + printErr("Unable to find the java library of Astah SysML. Please define the ASTAH_SYSML_HOME environment variable."); + } + + # Prepare the generation from Astah + my $outputDir = File::Spec->rel2abs(dirname("$in")); + my $shortBasename = basename("$in",@inexts); + my $astahOutputDir = File::Spec->catfile("$outputDir","$shortBasename"); + if ( -d "$astahOutputDir" ) { + remove_tree("$astahOutputDir") or printErr("$astahOutputDir: $!"); + } + + # Generation of the SVG from Astah + runCommandOrFail( + 'java', + @JAVA_OPTS, + '-cp', + File::Spec->catfile("$ENV{ASTAH_SYSML_HOME}","$jarfile"), + 'com.change_vision.jude.cmdline.JudeCommandRunner', + '-image', 'all', + '-f', "$in", + '-t', 'svg', + '-o', "$outputDir"); + + # Generation of the PDF/PS from the SVG + my @generatedFiles = (); + local *OUTDIR; + opendir(*OUTDIR, "$astahOutputDir") or printErr("$astahOutputDir: $!"); + while (my $fn = readdir(*OUTDIR)) { + if ($fn ne File::Spec->updir() && $fn ne File::Spec->curdir() + && $fn =~ /\.svg$/s) { + my $svgFile = File::Spec->catfile("$astahOutputDir", "$fn"); + push @generatedFiles, "$svgFile"; + + # Remove the background + my $svgcontent = readFileLines("$svgFile"); + $svgcontent =~ s/\Q<rect\E\s+.*?\/?>//s; + writeFileLines("$svgFile", "$svgcontent"); + } + } + closedir(*OUTDIR); + + my $transresult = 0; + + # Move the generated files + if (@generatedFiles>1) { + my $template = File::Spec->catfile( + dirname($out), + basename($out,$outext)).'_'; + my $transresult = 0; + foreach my $file (@generatedFiles) { + my $bn = basename($file,'.svg'); + $bn =~ s/\s+/_/sg; + $bn = "$template$bn$outext"; + my $result = runTranslator( 'svg2pdf', "$file", "$bn", 0); + if ($result) { + $transresult = 1; + } + } + if (!$transresult) { + printErr("No file generated."); + } else { + touch("$out"); + } + } + elsif (@generatedFiles) { + my $file = shift @generatedFiles; + runTranslator('svg2pdf', "$file", "$out"); + } + else { + printErr("No file generated."); + } + + if ( -d "$astahOutputDir" ) { + remove_tree("$astahOutputDir") or printErr("$astahOutputDir: $!"); + } + + 1; +} +EOL + +FILES_TO_CLEAN = $out_*.pdf $out_*.eps $out + diff --git a/support/autolatex/translators/astah2pdf.transdef b/support/autolatex/translators/astah2pdf.transdef new file mode 100644 index 0000000000..991879002c --- /dev/null +++ b/support/autolatex/translators/astah2pdf.transdef @@ -0,0 +1,160 @@ +# autolatex - astah2pdf.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .asta .jude .juth + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $INITIAL_HEAP_SIZE = "64m"; + my $MAXIMUM_HEAP_SIZE = "1024m"; + my @JAVA_OPTS = ("-Xms$INITIAL_HEAP_SIZE", "-Xmx$MAXIMUM_HEAP_SIZE"); + + my @libraries = ( + 'astah-pro.jar', + 'astah-professional.jar', + 'astah-uml.jar', + ); + + # Detect the Astah installation + if ( ! $ENV{"ASTAH_HOME"} ) { + my @tmp = ('astah-pro','astah-uml','astah-com'); + my $tmp = undef; + for(my $i=0; $i<@tmp && !$tmp; $i++) { + my $bin = $tmp[$i]; + $bin = which("$bin"); + if ( $bin && -x "$bin" ) { + $bin = readlink_osindep("$bin"); + $tmp = dirname("$bin"); + } + } + if ( ! $tmp ) { + @tmp = ('/usr/lib/astah_pro', + '/usr/lib/astah_professional', + '/usr/lib/astah_uml', + '/usr/lib/astah_com', + '/usr/lib/astah_community'); + for(my $i=0; $i<@tmp && !$tmp; $i++) { + my $dir = $tmp[$i]; + if ( -d "$dir" ) { + $tmp = $dir; + } + } + if ( ! $tmp ) { + printErr("Unable to find the installation directory of Astah Professional or Astah UML. Please define the ASTAH_HOME environment variable."); + } + } + $ENV{"ASTAH_HOME"} = $tmp; + } + + # Detect the Java library of astah + my $jarfile; + for(my $i=0; $i<@libraries && !$jarfile; $i++) { + my $library = $libraries[$i]; + if ( -f File::Spec->catfile("$ENV{ASTAH_HOME}", "$library" ) ) { + $jarfile = $library; + } + } + if ( ! $jarfile ) { + printErr("Unable to find the java library of Astah. Please define the ASTAH_HOME environment variable."); + } + + # Prepare the generation from Astah + my $outputDir = File::Spec->rel2abs(dirname("$in")); + my $shortBasename = basename("$in",@inexts); + my $astahOutputDir = File::Spec->catfile("$outputDir","$shortBasename"); + if ( -d "$astahOutputDir" ) { + remove_tree("$astahOutputDir") or printErr("$astahOutputDir: $!"); + } + + # Generation of the SVG from Astah + runCommandOrFail( + 'java', + @JAVA_OPTS, + '-cp', + File::Spec->catfile("$ENV{ASTAH_HOME}","$jarfile"), + 'com.change_vision.jude.cmdline.JudeCommandRunner', + '-image', 'all', + '-f', "$in", + '-t', 'svg', + '-o', "$outputDir"); + + # Generation of the PDF/PS from the SVG + my @generatedFiles = (); + local *OUTDIR; + opendir(*OUTDIR, "$astahOutputDir") or printErr("$astahOutputDir: $!"); + while (my $fn = readdir(*OUTDIR)) { + if ($fn ne File::Spec->updir() && $fn ne File::Spec->curdir() + && $fn =~ /\.svg$/s) { + my $svgFile = File::Spec->catfile("$astahOutputDir", "$fn"); + push @generatedFiles, "$svgFile"; + + # Remove the background + my $svgcontent = readFileLines("$svgFile"); + $svgcontent =~ s/\Q<rect\E\s+.*?\/?>//s; + writeFileLines("$svgFile", "$svgcontent"); + } + } + closedir(*OUTDIR); + + my $transresult = 0; + + # Move the generated files + if (@generatedFiles>1) { + my $template = File::Spec->catfile( + dirname($out), + basename($out,$outext)).'_'; + my $transresult = 0; + foreach my $file (@generatedFiles) { + my $bn = basename($file,'.svg'); + $bn =~ s/\s+/_/sg; + $bn = "$template$bn$outext"; + my $result = runTranslator( 'svg2pdf', "$file", "$bn", 0); + if ($result) { + $transresult = 1; + } + } + if (!$transresult) { + printErr("No file generated."); + } else { + touch("$out"); + } + } + elsif (@generatedFiles) { + my $file = shift @generatedFiles; + runTranslator('svg2pdf', "$file", "$out"); + } + else { + printErr("No file generated."); + } + + if ( -d "$astahOutputDir" ) { + remove_tree("$astahOutputDir") or printErr("$astahOutputDir: $!"); + } + + 1; +} +EOL + +FILES_TO_CLEAN = $out_*.pdf $out_*.eps $out + diff --git a/support/autolatex/translators/astah2png.transdef b/support/autolatex/translators/astah2png.transdef new file mode 100644 index 0000000000..57633e653e --- /dev/null +++ b/support/autolatex/translators/astah2png.transdef @@ -0,0 +1,149 @@ +# autolatex - astah2png.transdef +# Copyright (C) 2012-13 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .asta .jude .juth + +OUTPUT_EXTENSIONS = .png + +TRANSLATOR_FUNCTION =<<EOL { + + my $INITIAL_HEAP_SIZE = "64m"; + my $MAXIMUM_HEAP_SIZE = "1024m"; + my @JAVA_OPTS = ("-Xms$INITIAL_HEAP_SIZE", "-Xmx$MAXIMUM_HEAP_SIZE"); + + my @libraries = ( + 'astah-pro.jar', + 'astah-professional.jar', + 'astah-uml.jar', + 'astah-com.jar', + 'astah-community.jar', + ); + + # Detect the Astah installation + if ( ! $ENV{"ASTAH_HOME"} ) { + my @tmp = ('astah-pro','astah-uml','astah-com'); + my $tmp = undef; + for(my $i=0; $i<@tmp && !$tmp; $i++) { + my $bin = $tmp[$i]; + $bin = which("$bin"); + if ( $bin && -x "$bin" ) { + $bin = readlink_osindep("$bin"); + $tmp = dirname("$bin"); + } + } + if ( ! $tmp ) { + @tmp = ('/usr/lib/astah_pro', + '/usr/lib/astah_professional', + '/usr/lib/astah_uml', + '/usr/lib/astah_com', + '/usr/lib/astah_community'); + for(my $i=0; $i<@tmp && !$tmp; $i++) { + my $dir = $tmp[$i]; + if ( -d "$dir" ) { + $tmp = $dir; + } + } + if ( ! $tmp ) { + printErr("Unable to find the installation directory of Astah. Please define the ASTAH_HOME environment variable."); + } + } + $ENV{"ASTAH_HOME"} = $tmp; + } + + # Detect the Java library of astah + my $jarfile; + for(my $i=0; $i<@libraries && !$jarfile; $i++) { + my $library = $libraries[$i]; + if ( -f File::Spec->catfile("$ENV{ASTAH_HOME}", "$library" ) ) { + $jarfile = $library; + } + } + if ( ! $jarfile ) { + printErr("Unable to find the java library of Astah. Please define the ASTAH_HOME environment variable."); + } + + # Prepare the generation from Astah + my $outputDir = File::Spec->rel2abs(dirname("$in")); + my $shortBasename = basename("$in",@inexts); + my $astahOutputDir = File::Spec->catfile("$outputDir","$shortBasename"); + + if ( -d "$astahOutputDir" ) { + remove_tree("$astahOutputDir") or printErr("$astahOutputDir: $!"); + } + + # Generation of the SVG from Astah + runCommandOrFail( + 'java', + @JAVA_OPTS, + '-cp', + File::Spec->catfile("$ENV{ASTAH_HOME}","$jarfile"), + 'com.change_vision.jude.cmdline.JudeCommandRunner', + '-image', 'all', + '-f', "$in", + '-t', 'png', + '-o', "$outputDir"); + + # Move the files + my @generatedFiles = (); + local *OUTDIR; + opendir(*OUTDIR, "$astahOutputDir") or printErr("$astahOutputDir: $!"); + while (my $fn = readdir(*OUTDIR)) { + if ($fn ne File::Spec->updir() && $fn ne File::Spec->curdir() + && $fn =~ /$outext$/s) { + my $sourceFile = File::Spec->catfile("$astahOutputDir", "$fn"); + push @generatedFiles, "$sourceFile"; + } + } + closedir(*OUTDIR); + + # Move the generated files + if (@generatedFiles>1) { + my $template = File::Spec->catfile( + dirname($out), + basename($out,$outext)).'_'; + foreach my $file (@generatedFiles) { + my $bn = basename($file,$outext); + $bn =~ s/\s+/_/sg; + move("$file", "$template$bn$outext") or printErr("$file -> $template$bn$outext: $!"); + } + if (@generatedFiles) { + touch("$out"); + } + } + elsif (@generatedFiles) { + my $file = shift @generatedFiles; + move("$file", "$out"); + } + else { + printErr("No file generated."); + } + + if ( -d "$astahOutputDir" ) { + remove_tree("$astahOutputDir") or printErr("$astahOutputDir: $!"); + } + + 1; +} +EOL + +FILES_TO_CLEAN = $out_*.png $out + diff --git a/support/autolatex/translators/asy2pdf.transdef b/support/autolatex/translators/asy2pdf.transdef new file mode 100644 index 0000000000..0e0d8ab3b7 --- /dev/null +++ b/support/autolatex/translators/asy2pdf.transdef @@ -0,0 +1,43 @@ +# autolatex - asy2pdf.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .asy + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $epsFile = File::Spec->catfile( + dirname("$in"), + basename("$in",@inexts).'.eps'); + runCommandOrFail( 'asy', '-o', "$epsFile", "$in" ); + if ($ispdfmode) { + my $transresult = runTranslator( 'eps2pdf', "$epsFile", "$out"); + unlink("$epsFile"); + $transresult; + } + else { + 1; + } +} +EOL + diff --git a/support/autolatex/translators/cpp2tex_texify.transdef b/support/autolatex/translators/cpp2tex_texify.transdef new file mode 100644 index 0000000000..26fbe09b7c --- /dev/null +++ b/support/autolatex/translators/cpp2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - cpp2tex_texify.transdef +# Copyright (C) 2010-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .cpp .c .hpp .h .C .H .c++ .h++ + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifyc++ -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/dia2pdf+tex.transdef b/support/autolatex/translators/dia2pdf+tex.transdef new file mode 100644 index 0000000000..e312033fab --- /dev/null +++ b/support/autolatex/translators/dia2pdf+tex.transdef @@ -0,0 +1,40 @@ +# autolatex - dia2pdf+tex.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .dia_tex .diat .dia+tex .diatex .tex.dia +tex.dia + +OUTPUT_EXTENSIONS for pdf = .pdf .pdftex_t +OUTPUT_EXTENSIONS for eps = .eps .pstex_t + +TRANSLATOR_FUNCTION =<<EOL { + my $figFile = File::Spec->catfile( + dirname("$in"), + basename("$in",@inexts).'.fig'); + runCommandOrFail( 'dia', '--nosplash', '-t', 'fig', "--export=$figFile", "$in" ); + my $transresult = runTranslator( 'fig2pdf+tex', "$figFile", "$out"); + unlink("$figFile"); + $transresult; +} +EOL + +FILES_TO_CLEAN = $out.pdftex_t $out.pstex_t + diff --git a/support/autolatex/translators/dia2pdf.transdef b/support/autolatex/translators/dia2pdf.transdef new file mode 100644 index 0000000000..953920c3d6 --- /dev/null +++ b/support/autolatex/translators/dia2pdf.transdef @@ -0,0 +1,38 @@ +# autolatex - dia2pdf.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .dia + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $epsFile = File::Spec->catfile( + dirname("$in"), + basename("$in",@inexts).'.eps'); + runCommandOrFail( 'dia', '--nosplash', '-t', 'eps', "--export=$epsFile", "$in" ); + my $transresult = runTranslator( 'eps2pdf', "$epsFile", "$out"); + unlink("$epsFile") unless ($isepsmode); + $transresult; +} +EOL + diff --git a/support/autolatex/translators/dot2pdf.transdef b/support/autolatex/translators/dot2pdf.transdef new file mode 100644 index 0000000000..525b9efd5b --- /dev/null +++ b/support/autolatex/translators/dot2pdf.transdef @@ -0,0 +1,44 @@ +# autolatex - dot2pdf.transdef +# Copyright (C) 2009-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .dot + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONs for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + if ($ispdfmode) { + runCommandOrFail('dot', '-Tpdf', "$in", '-o', "$out"); + 1; + } + else { + my $svgFile = File::Spec->catfile( + dirname($out), + basename($out,@outexts).'.svg'); + runCommandOrFail('dot', '-Tsvg', "$in", '-o', "$svgFile"); + $transresult = runTranslator('svg2pdf', "$svgFile", "$out"); + unlink("$svgFile"); + $transresult; + } +} +EOL + diff --git a/support/autolatex/translators/dot2png.transdef b/support/autolatex/translators/dot2png.transdef new file mode 100644 index 0000000000..007d8ad1eb --- /dev/null +++ b/support/autolatex/translators/dot2png.transdef @@ -0,0 +1,28 @@ +# autolatex - dot2png.transdef +# Copyright (C) 2009-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .dot + +OUTPUT_EXTENSIONS = .png + +COMMAND_LINE = dot -Tpng "$in" -o "$out" + diff --git a/support/autolatex/translators/dot2tex.transdef b/support/autolatex/translators/dot2tex.transdef new file mode 100644 index 0000000000..c32cd4981e --- /dev/null +++ b/support/autolatex/translators/dot2tex.transdef @@ -0,0 +1,32 @@ +# autolatex - dot2tex.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .dot + +OUTPUT_EXTENSIONS = .tex + +TRANSLATOR_FUNCTION =<<EOL { + runCommandOrFailRedirectTo( "$out", 'dot2tex', "$in" ); + 1; +} +EOL + diff --git a/support/autolatex/translators/eps2pdf_epstopdf.transdef b/support/autolatex/translators/eps2pdf_epstopdf.transdef new file mode 100644 index 0000000000..5471d6e895 --- /dev/null +++ b/support/autolatex/translators/eps2pdf_epstopdf.transdef @@ -0,0 +1,38 @@ +# autolatex - eps2pdf_epstopdf.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .eps + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + if ($ispdfmode) { + runCommandOrFail('epstopdf', "--outfile=$out", "$in"); + } + elsif ("$out" ne "$in") { + copy("$in", "$out") or printErr(locGet("{} -> {}: {}", $in, $out, $!)); + } + 1; +} +EOL + diff --git a/support/autolatex/translators/eps2pdf_ps2pdf.transdef b/support/autolatex/translators/eps2pdf_ps2pdf.transdef new file mode 100644 index 0000000000..85231a27ab --- /dev/null +++ b/support/autolatex/translators/eps2pdf_ps2pdf.transdef @@ -0,0 +1,38 @@ +# autolatex - eps2pdf_ps2pdf.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .eps + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + if ($ispdfmode) { + runCommandOrFail('ps2pdf', "$in", "$out"); + } + elsif ("$out" ne "$in") { + copy("$in", "$out") or printErr(locGet("{} -> {}: {}", $in, $out, $!)); + } + 1; +} +EOL + diff --git a/support/autolatex/translators/fig2pdf+tex.transdef b/support/autolatex/translators/fig2pdf+tex.transdef new file mode 100644 index 0000000000..e43e735ff7 --- /dev/null +++ b/support/autolatex/translators/fig2pdf+tex.transdef @@ -0,0 +1,57 @@ +# autolatex - fig2pdf+tex.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .figt .fig_tex .figtex .fig+tex .tex.fig +tex.fig + +OUTPUT_EXTENSIONS for pdf = .pdf .pdftex_t +OUTPUT_EXTENSIONS for eps = .eps .pstex_t + +TRANSLATOR_PERL_DEPENDENCIES = Cwd + +TRANSLATOR_FUNCTION =<<EOL { + my $currentdir = getcwd(); + my $dirname = dirname("$out"); + my $basename = basename("$out"); + my $ext; + my $ttexmode1; + my $ttexmode2; + if ($ispdfmode) { + $ext = '.pdftex_t'; + $ttexmode1 = 'pdftex'; + $ttexmode2 = 'pdftex_t'; + } + else { + $ext = '.pstex_t'; + $ttexmode1 = 'pstex'; + $ttexmode2 = 'pstex_t'; + } + my $ttexFile = basename("$out",$outext).$ext; + chdir("$dirname") or printErr("$dirname: $!"); + runCommandOrFail( 'fig2dev', '-L', $ttexmode1, "$in", "$basename" ); + runCommandOrFail( 'fig2dev', '-L', $ttexmode2, '-p', "$out", "$in", "$ttexFile" ); + chdir("$currentdir") or printErr("$currentdir: $!"); + 1; +} +EOL + +FILES_TO_CLEAN = $out.pdftex_t $out.pstex_t + diff --git a/support/autolatex/translators/fig2pdf.transdef b/support/autolatex/translators/fig2pdf.transdef new file mode 100644 index 0000000000..81571f0db4 --- /dev/null +++ b/support/autolatex/translators/fig2pdf.transdef @@ -0,0 +1,40 @@ +# autolatex - fig2pdf.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .fig + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONs for eps = .eps + +TRANSLATOR_PERL_DEPENDENCIES = Cwd + +TRANSLATOR_FUNCTION =<<EOL { + my $currentdir = getcwd(); + my $dirname = dirname("$out"); + my $basename = basename("$out"); + chdir("$dirname") or printErr("$dirname: $!"); + runCommandOrFail('fig2dev', '-L', ($ispdfmode ? 'pdf' : 'eps'), "$in", "$basename"); + chdir("$currentdir") or printErr("$currentdir: $!"); + 1; +} +EOL + diff --git a/support/autolatex/translators/ggb2pdf.transdef b/support/autolatex/translators/ggb2pdf.transdef new file mode 100644 index 0000000000..ff57cb0116 --- /dev/null +++ b/support/autolatex/translators/ggb2pdf.transdef @@ -0,0 +1,30 @@ +# autolatex - ggb2pdf.transdef +# Copyright (C) 2014 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .ggb + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +COMMAND_LINE for pdf = geogebra "--export=$out" --dvi=600 "$in" +COMMAND_LINE for eps = geogebra "--export=$out" --dvi=600 "$in" + diff --git a/support/autolatex/translators/gle2pdf.transdef b/support/autolatex/translators/gle2pdf.transdef new file mode 100644 index 0000000000..d725177268 --- /dev/null +++ b/support/autolatex/translators/gle2pdf.transdef @@ -0,0 +1,31 @@ +# autolatex - gle2pdf.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .gle + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +COMMAND_LINE for pdf = gle -d pdf -output $out $in + +COMMAND_LINE for eps = gle -d eps -output $out $in + diff --git a/support/autolatex/translators/gle2png.transdef b/support/autolatex/translators/gle2png.transdef new file mode 100644 index 0000000000..f90648d03a --- /dev/null +++ b/support/autolatex/translators/gle2png.transdef @@ -0,0 +1,28 @@ +# autolatex - gle2png.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .gle + +OUTPUT_EXTENSIONS = .png + +COMMAND_LINE = gle -d png -output $out $in + diff --git a/support/autolatex/translators/gxl2pdf.transdef b/support/autolatex/translators/gxl2pdf.transdef new file mode 100644 index 0000000000..fa9bd34642 --- /dev/null +++ b/support/autolatex/translators/gxl2pdf.transdef @@ -0,0 +1,38 @@ +# autolatex - gxl2pdf.transdef +# Copyright (C) 2009-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .gxl + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $dotFile = File::Spec->catfile( + dirname("$in"), + basename("$in",@inexts).'.dot'); + runCommandOrFail( 'gxl2dot', '-d', '-o', "$dotFile", "$in" ); + my $transresult = runTranslator('dot2pdf', "$dotFile", "$out"); + unlink("$dotFile"); + $transresult; +} +EOL + diff --git a/support/autolatex/translators/gxl2png.transdef b/support/autolatex/translators/gxl2png.transdef new file mode 100644 index 0000000000..1839637df9 --- /dev/null +++ b/support/autolatex/translators/gxl2png.transdef @@ -0,0 +1,37 @@ +# autolatex - gxl2png.transdef +# Copyright (C) 2009-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .gxl + +OUTPUT_EXTENSIONS = .png + +TRANSLATOR_FUNCTION =<<EOL { + my $dotFile = File::Spec->catfile( + dirname("$in"), + basename("$in",@inexts).'.dot'); + runCommandOrFail( 'gxl2dot', '-d', '-o', "$dotFile", "$in" ); + my $transresult = runTranslator('dot2png', "$dotFile", "$out"); + unlink("$dotFile"); + $transresult; +} +EOL + diff --git a/support/autolatex/translators/imggz2img.transdef b/support/autolatex/translators/imggz2img.transdef new file mode 100644 index 0000000000..20c5cf027d --- /dev/null +++ b/support/autolatex/translators/imggz2img.transdef @@ -0,0 +1,32 @@ +# autolatex - imggz2img.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .gz + +OUTPUT_EXTENSIONS = + +TRANSLATOR_FUNCTION =<<EOL { + runCommandOrFailRedirectTo( "$out", 'zcat', "$in" ); + 1; +} +EOL + diff --git a/support/autolatex/translators/java2tex_texify.transdef b/support/autolatex/translators/java2tex_texify.transdef new file mode 100644 index 0000000000..469995db01 --- /dev/null +++ b/support/autolatex/translators/java2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - java2tex_texify.transdef +# Copyright (C) 2010-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .java .j + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifyjava -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/lisp2tex_texify.transdef b/support/autolatex/translators/lisp2tex_texify.transdef new file mode 100644 index 0000000000..fae8741a0c --- /dev/null +++ b/support/autolatex/translators/lisp2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - lisp2tex_texify.transdef +# Copyright (C) 2010-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .lisp + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifylisp -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/matlab2tex_texify.transdef b/support/autolatex/translators/matlab2tex_texify.transdef new file mode 100644 index 0000000000..aa92c46088 --- /dev/null +++ b/support/autolatex/translators/matlab2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - matlab2tex_texify.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .m + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifymatlab -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/ml2tex_texify.transdef b/support/autolatex/translators/ml2tex_texify.transdef new file mode 100644 index 0000000000..e1b786dfd8 --- /dev/null +++ b/support/autolatex/translators/ml2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - ml2tex_texify.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .ml + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifyml -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/oct2pdf.transdef b/support/autolatex/translators/oct2pdf.transdef new file mode 100644 index 0000000000..ee54cab19f --- /dev/null +++ b/support/autolatex/translators/oct2pdf.transdef @@ -0,0 +1,47 @@ +# autolatex - oct2pdf.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .oct + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $type; + if ($ispdfmode) { + $type = 'pdf'; + } + else { + $type = 'eps'; + } + my $tmpFile = File::Spec->catfile(dirname($in), basename($in,@inexts)."_tmp_xxxxx.oct"); + copy($in, $tmpFile) or printErr("$in -> $tmpFile: $!"); + local *FILE; + open(*FILE, ">> $tmpFile") or printErr("$tmpFile: $!"); + print FILE "\n\nprint -d$type -tight -color \"$out\"\n"; + close(*FILE); + runCommandOrFail('octave', '--no-history', "$tmpFile"); + unlink($tmpFile); + 1; +} +EOL + diff --git a/support/autolatex/translators/oct2png.transdef b/support/autolatex/translators/oct2png.transdef new file mode 100644 index 0000000000..a2e35a9478 --- /dev/null +++ b/support/autolatex/translators/oct2png.transdef @@ -0,0 +1,39 @@ +# autolatex - oct2png.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .oct + +OUTPUT_EXTENSIONS = .png + +TRANSLATOR_FUNCTION =<<EOL { + my $tmpFile = File::Spec->catfile(dirname($in), basename($in,@inexts)."_tmp_xxxxx.oct"); + copy($in, $tmpFile) or printErr("$in -> $tmpFile: $!"); + local *FILE; + open(*FILE, ">> $tmpFile") or printErr("$tmpFile: $!"); + print FILE "\n\nprint -dpng -tight -color \"$out\"\n"; + close(*FILE); + runCommandOrFail('octave', '--no-history', "$tmpFile"); + unlink($tmpFile); + 1; +} +EOL + diff --git a/support/autolatex/translators/odg2pdf.transdef b/support/autolatex/translators/odg2pdf.transdef new file mode 100644 index 0000000000..6b52ae4cce --- /dev/null +++ b/support/autolatex/translators/odg2pdf.transdef @@ -0,0 +1,62 @@ +# autolatex - odg2pdf.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .odg .sxd .fodg + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my @binaries = ('libreoffice', 'loffice', 'openoffice', 'ooffice'); + my $bin; + for(my $i=0; $i<@binaries && !$bin; $i++) { + $bin = which($binaries[$i]); + } + if (!$bin) { + printErr("Unable to retreive the binary file of Libre Office or Open Office."); + } + + my $ext; + my $mode; + if ($ispdfmode) { + $ext = '.pdf'; + $mode = 'pdf'; + } + else { + $ext = '.eps'; + $mode = 'eps'; + } + + my $outdir = File::Spec->rel2abs(dirname($out)); + my $basename = basename($in,@inexts); + my $defaultOutput = File::Spec->catfile("$outdir", "$basename$ext"); + + runCommandOrFail( "$bin", '--headless', '--nologo', '--convert-to', "$mode", '--outdir', "$outdir", "$in"); + + if ($defaultOutput ne $out) { + move("$defaultOutput", "$out") or printErr("$defaultOutput -> $out: $!"); + } + + 1; +} +EOL + diff --git a/support/autolatex/translators/perl2tex_texify.transdef b/support/autolatex/translators/perl2tex_texify.transdef new file mode 100644 index 0000000000..51ff76e89e --- /dev/null +++ b/support/autolatex/translators/perl2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - perl2tex_texify.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .perl .pl + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifyperl -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/plot2pdf+tex.transdef b/support/autolatex/translators/plot2pdf+tex.transdef new file mode 100644 index 0000000000..8b464e57b8 --- /dev/null +++ b/support/autolatex/translators/plot2pdf+tex.transdef @@ -0,0 +1,119 @@ +# autolatex - plot2pdf+tex.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .plott .plot_tex .plottex .plot+tex .tex.plot +tex.plot .gnut .gnu_tex .gnutex .gnu+tex .tex.gnu +tex.gnu + +OUTPUT_EXTENSIONS for pdf = .pdf .pdftex_t +OUTPUT_EXTENSIONS for eps = .eps .pstex_t + +TRANSLATOR_PERL_DEPENDENCIES = Cwd AutoLaTeX::TeX::TeXParser + +TRANSLATOR_FUNCTION =<<EOL { + my $curdir = getcwd(); + my $plotdir = dirname("$in"); + + # Filenames + my $plotFile = File::Spec->catfile("$plotdir", basename("$in", @inexts).'__xxxx_autolatex.plot'); + my $texFile = File::Spec->catfile(dirname("$out"), basename("$out", @outexts).'.tex'); + my $psFile = File::Spec->catfile(dirname("$out"), basename("$out", @outexts).'.ps'); + my $ptextFile = File::Spec->catfile(dirname("$out"), basename("$out", @outexts). + ($ispdfmode ? '.pdftex_t' : '.pstex_t')); + + # Generate the PLOT file that is able to generate the (PS/PDF)TEX + local *IN; + local *OUT; + open(*IN, "<$in") or printErr("$in: $!"); + open(*OUT, ">$plotFile") or printErr("$plotFile: $!"); + print OUT "set terminal pstex color auxfile;\n"; + print OUT "set output \"".addSlashes($texFile)."\";\n\n"; + while (my $line = <IN>) { + $line =~ s/set\s+term(?:inal)?.*?[\n;]//gs; + print OUT $line; + } + print OUT "unset output;\n"; + print OUT "quit;\n"; + close(*OUT); + close(*IN); + + # Invoke Gnuplot + chdir($plotdir) or printErr("$plotdir: $!"); + runCommandOrFail('gnuplot', "$plotFile"); + chdir($curdir) or printErr("$curdir: $!"); + unlink($plotFile); + + if ($ispdfmode) { + # Clean the PDFTEX_T file by removing the special macros, and + # adding the graphic inclusion at the right place + my $content = readFileLines("$texFile"); + my $listener = { + 'content' => '', + 'expandMacro' => sub { + my $listener = shift; + my $parser = shift; + my $macro = shift; + if ($macro eq '\\special' ) { + if ($_[0] && $_[0]->{'text'} && $_[0]->{'text'} =~ /\Qpsfile=\E/s) { + return "\\put(0,0){\\includegraphics{$out}}"; + } + # The first character after \special is consumed, reinject it if it is a brace. + if ($_[0] && $_[0]->{'text'} && $_[0]->{'text'} eq '}') { + return "$macro}"; + } + return ''; + } + return undef; + }, + 'outputString' => sub { + my $listener = shift; + my $parser = shift; + my $str = shift; + $listener->{'content'} .= $str; + }, + }; + + my $parser = AutoLaTeX::TeX::TeXParser->new("$texFile", $listener); + $parser->addTextModeMacro('special','!{}'); + $parser->addMathModeMacro('special','!{}'); + $parser->parse( $content ); + open(*OUT, ">$ptextFile") or printErr("$ptextFile: $!"); + print OUT $listener->{'content'}; + close(*OUT); + unlink("$texFile"); + } + else { + move("$texFile", "$ptextFile") or printErr("$texFile -> $ptextFile: $!"); + } + + # Generate the proper figure + if ($isepsmode) { + move("$psFile", "$out") or printErr("$psFile -> $out: $!"); + } + else { + my $transresult = runTranslator('eps2pdf', "$psFile", "$out"); + unlink($psFile); + $transresult; + } +} +EOL + +FILES_TO_CLEAN = $out.pdftex_t $out.pstex_t *__xxxx_autolatex.plot $out/ + diff --git a/support/autolatex/translators/plot2pdf.transdef b/support/autolatex/translators/plot2pdf.transdef new file mode 100644 index 0000000000..6ca26b31da --- /dev/null +++ b/support/autolatex/translators/plot2pdf.transdef @@ -0,0 +1,60 @@ +# autolatex - plot2pdf.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .plot .gnu + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_PERL_DEPENDENCIES = Cwd + +TRANSLATOR_FUNCTION =<<EOL { + my $curdir = getcwd(); + my $workingDir = File::Spec->rel2abs(dirname("$in")); + my $extPlotFile = File::Spec->catfile( + "$workingDir", + basename("$in",@inexts).'.autolatex.plot'); + local *TMPFILE; + local *INFILE; + open(*TMPFILE, ">$extPlotFile") or printErr("$extPlotFile: $!"); + open(*INFILE, "<$in") or printErr("$in: $!"); + print TMPFILE "set terminal postscript eps color;\n"; + while (my $line = <INFILE>) { + print TMPFILE "$line"; + } + print TMPFILE "quit;\n"; + close(*INFILE); + close(*TMPFILE); + my $epsFile = File::Spec->catfile( + "$workingDir", + basename("$in",@inexts).'.eps'); + # Change directory in case the plot file contains relative references to data files + chdir("$workingDir") or printErr("$workingDir: $!"); + runCommandOrFailRedirectTo( "$epsFile", 'gnuplot', "$extPlotFile" ); + chdir("$curdir") or printErr("$curdir: $!"); + my $transresult = runTranslator( 'eps2pdf', "$epsFile", "$out" ); + unlink("$extPlotFile"); + unlink("$epsFile") unless ($isepsmode); + $transresult; +} +EOL + diff --git a/support/autolatex/translators/ppt2pdf_libreoffice.transdef b/support/autolatex/translators/ppt2pdf_libreoffice.transdef new file mode 100644 index 0000000000..2fc9077d81 --- /dev/null +++ b/support/autolatex/translators/ppt2pdf_libreoffice.transdef @@ -0,0 +1,62 @@ +# autolatex - ppt2pdf_libreoffice.transdef +# Copyright (C) 2014 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .ppt .pptx + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my @binaries = ('libreoffice', 'loffice', 'openoffice', 'ooffice'); + my $bin; + for(my $i=0; $i<@binaries && !$bin; $i++) { + $bin = which($binaries[$i]); + } + if (!$bin) { + printErr("Unable to retreive the binary file of Libre Office or Open Office."); + } + + my $ext; + my $mode; + if ($ispdfmode) { + $ext = '.pdf'; + $mode = 'pdf'; + } + else { + $ext = '.eps'; + $mode = 'eps'; + } + + my $outdir = File::Spec->rel2abs(dirname($out)); + my $basename = basename($in,@inexts); + my $defaultOutput = File::Spec->catfile("$outdir", "$basename$ext"); + + runCommandOrFail( "$bin", '--headless', '--nologo', '--convert-to', "$mode", '--outdir', "$outdir", "$in"); + + if ($defaultOutput ne $out) { + move("$defaultOutput", "$out") or printErr("$defaultOutput -> $out: $!"); + } + + 1; +} +EOL + diff --git a/support/autolatex/translators/python2tex_texify.transdef b/support/autolatex/translators/python2tex_texify.transdef new file mode 100644 index 0000000000..213f57f6e1 --- /dev/null +++ b/support/autolatex/translators/python2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - python2tex_texify.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .py + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifypython -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/ruby2tex_texify.transdef b/support/autolatex/translators/ruby2tex_texify.transdef new file mode 100644 index 0000000000..15f98f3945 --- /dev/null +++ b/support/autolatex/translators/ruby2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - ruby2tex_texify.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .rb + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifyruby -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/sql2tex_texify.transdef b/support/autolatex/translators/sql2tex_texify.transdef new file mode 100644 index 0000000000..b5bd694057 --- /dev/null +++ b/support/autolatex/translators/sql2tex_texify.transdef @@ -0,0 +1,34 @@ +# autolatex - sql2tex_texify.transdef +# Copyright (C) 2012-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .sql + +OUTPUT_EXTENSIONS = .tex + +COMMAND_LINE = texifysql -l ${CODE_WIDTH} -t ${TAB_SIZE} -i $in -o $out + +# Width of the code (in number of characters) +CODE_WIDTH = 60 + +# Tabulation size +TAB_SIZE = 2 + diff --git a/support/autolatex/translators/svg2pdf+layers+tex_inkscape.transdef b/support/autolatex/translators/svg2pdf+layers+tex_inkscape.transdef new file mode 100644 index 0000000000..3676452371 --- /dev/null +++ b/support/autolatex/translators/svg2pdf+layers+tex_inkscape.transdef @@ -0,0 +1,104 @@ +# autolatex - svg2pdf+layers+tex_inkscape.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svglt .svg_lt .svglayerstex .svgtexlayers .svg+layers+tex .svg+tex+layers .layers.tex.svg .tex.layers.svg +layers+tex.svg +tex+layers.svg .svgzlt .svgz_lt .svgzlayerstex .svgztexlayers .svgz+layers+tex .svgz+tex+layers .layers.tex.svgz .tex.layers.svgz +layers+tex.svgz +tex+layers.svgz + +OUTPUT_EXTENSIONS for pdf = .pdftex_t .pdf +OUTPUT_EXTENSIONS for eps = .pstex_t .eps + +TRANSLATOR_PERL_DEPENDENCIES = XML::Parser Scalar::Util qw(blessed) + +TRANSLATOR_FUNCTION =<<EOL { + my ($ext1, $ext2, $ext3, $opt); + if ($ispdfmode) { + $ext1 = '.pdftex_t'; + $ext2 = '.pdf'; + $ext3 = '.pdf_tex'; + $opt = '--export-pdf'; + } + else { + $ext1 = '.pstex_t'; + $ext2 = '.eps'; + $ext3 = '.ps_tex'; + $opt = '--export-eps'; + } + + # Parse the SVG + my $parser = XML::Parser->new(Style=>'Objects', Pkg=>'autolatex'); + my $tree = $parser->parsefile("$in"); + + my $imageinclusions = ''; + my $layerIndex = 1; + + foreach my $rootElement (@$tree) { + if ($rootElement->{'Kids'}) { + foreach my $kidElement (@{$rootElement->{'Kids'}}) { + my $className = blessed($kidElement); + if ($className eq 'autolatex::g' + && ($kidElement->{'style'}||'') ne "display:none") { + my $id = $kidElement->{'id'}; + my $label = $kidElement->{'inkscape:label'}; + my $overlay_spec = $layerIndex; + if ($label && $label =~ /<\s*(.+)\s*>/s) { + $overlay_spec = $1; + } + my $outputbasename = basename($out, $ext1)."_$id"; + my $figureFile = File::Spec->catfile( + dirname($out), + "$outputbasename$ext2"); + + runCommandOrFail( + 'inkscape', + '--without-gui', + '--export-area-page', + '--export-id', "$id", + '--export-id-only', + $opt, + "$figureFile", + '--export-latex', + "--file=$in"); + + my $texFile = File::Spec->catfile( + dirname($out), + "$outputbasename$ext3"); + + $imageinclusions .= "\\node<$overlay_spec> (X) {\\input{$texFile}};%\n"; + $layerIndex++; + } + } + } + } + + if (!$imageinclusions) { + printError(_T("No layer in the SVG file: {}"), $in); + } + + local *TEXOUT; + open(*TEXOUT, "> $out") or printErr("$out: $!"); + print TEXOUT "\%Overlays\n\\bgroup%\n\\begin{tikzpicture}%\n$imageinclusions\\end{tikzpicture}%\n\\egroup%"; + close(*TEXOUT); + 1; +} +EOL + +FILES_TO_CLEAN = $out_*.pdf_tex $out_*.ps_tex $out_*.pdf $out_*.eps + diff --git a/support/autolatex/translators/svg2pdf+layers_inkscape.transdef b/support/autolatex/translators/svg2pdf+layers_inkscape.transdef new file mode 100644 index 0000000000..b18d19d761 --- /dev/null +++ b/support/autolatex/translators/svg2pdf+layers_inkscape.transdef @@ -0,0 +1,108 @@ +# autolatex - svg2pdf+layers_inkscape.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svgl .svg_l .svglayers .svg+layers .layers.svg +layers.svg .svgzl .svgz_l .svgzlayers .svgz+layers .layers.svgz +layers.svgz + +OUTPUT_EXTENSIONS for pdf = .pdftex_t .pdf +OUTPUT_EXTENSIONS for eps = .pstex_t .eps + +TRANSLATOR_PERL_DEPENDENCIES = XML::Parser Scalar::Util qw(blessed) + +TRANSLATOR_FUNCTION =<<EOL { + my ($ext1, $ext2, $opt); + if ($ispdfmode) { + $ext1 = '.pdftex_t'; + $ext2 = '.pdf'; + $opt = '--export-pdf'; + } + else { + $ext1 = '.pstex_t'; + $ext2 = '.eps'; + $opt = '--export-eps'; + } + + # Parse the SVG + my $parser = XML::Parser->new(Style=>'Objects', Pkg=>'autolatex'); + my $tree = $parser->parsefile("$in"); + + my $imageinclusions = ''; + my $layerIndex = 1; + + foreach my $rootElement (@$tree) { + if ($rootElement->{'Kids'}) { + my $width = $rootElement->{'width'} || 0; + # Clamp the value to avoid LaTex failures + if ($width<=0) { + $width = 100; + } + elsif ($width>1000) { + $width = 1000; + } + foreach my $kidElement (@{$rootElement->{'Kids'}}) { + my $className = blessed($kidElement); + if ($className eq 'autolatex::g' + && ($kidElement->{'style'}||'') ne "display:none") { + my $id = $kidElement->{'id'}; + my $label = $kidElement->{'inkscape:label'}; + printDbgFor(3, formatText(_T("Found layer: id={}, label={}"), @{toUTF8($id, $label)})); + my $overlay_spec = $layerIndex; + if ($label && $label =~ /<\s*(.+)\s*>/s) { + $overlay_spec = $1; + } + my $outputbasename = basename($out, $ext1)."_$id"; + my $figureFile = File::Spec->catfile( + dirname($out), + "$outputbasename$ext2"); + printDbgFor(4, formatText(_T("Overlay spec: <{}>"), @{toUTF8($overlay_spec)})); + printDbgFor(4, formatText(_T("Output: {}"), $figureFile)); + + runCommandOrFail( + 'inkscape', + '--without-gui', + '--export-id', "$id", + '--export-id-only', + '--export-area-page', + $opt, + "$figureFile", + "--file=$in"); + + $imageinclusions .= "\\node<$overlay_spec> (X) {\\includegraphics[width=${width}em]{$outputbasename}};%\n"; + $layerIndex++; + } + } + } + } + + if (!$imageinclusions) { + printError(_T("No layer in the SVG file: {}"), $in); + } + + local *TEXOUT; + open(*TEXOUT, "> $out") or printErr("$out: $!"); + print TEXOUT "\%Overlays\n\\bgroup%\n\\begin{tikzpicture}%\n$imageinclusions\\end{tikzpicture}%\n\\egroup%"; + close(*TEXOUT); + 1; +} +EOL + +FILES_TO_CLEAN = $out_*.pdf $out_*.eps + diff --git a/support/autolatex/translators/svg2pdf+tex_inkscape.transdef b/support/autolatex/translators/svg2pdf+tex_inkscape.transdef new file mode 100644 index 0000000000..da5c2f7ab7 --- /dev/null +++ b/support/autolatex/translators/svg2pdf+tex_inkscape.transdef @@ -0,0 +1,63 @@ +# autolatex - svg2pdf+tex_inkscape.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svgt .svg_t .svgtex .svg+tex .tex.svg +tex.svg .svgzt .svgz_t .svgztex .svgz+tex .tex.svgz +tex.svgz + +OUTPUT_EXTENSIONS for pdf = .pdf .pdftex_t +OUTPUT_EXTENSIONS for eps = .eps .pstex_t + +TRANSLATOR_FUNCTION =<<EOL { + my ($ext1, $ext2, $opt); + if ($ispdfmode) { + $ext1 = '.pdf_tex'; + $ext2 = '.pdftex_t'; + $opt = '--export-pdf'; + } + else { + $ext1 = '.eps_tex'; + $ext2 = '.pstex_t'; + $opt = '--export-eps'; + } + # Compute the name of the generated PDFTEX file + my $pdftexfile = File::Spec->catfile( + dirname("$in"), + basename("$out", @outexts).$ext1); + # Compute the name of the generated PDFTEX file + my $pdftexfile2 = File::Spec->catfile( + dirname("$in"), + basename("$out", @outexts).$ext2); + # Generation of the output from SVG + runCommandOrFail( + 'inkscape', + '--without-gui', + '--export-area-page', + $opt, + "$out", + '--export-latex', + "--file=$in"); + # Remove temp file + move("$pdftexfile", "$pdftexfile2") or printErr("$pdftexfile -> $pdftexfile2: $!"); +} +EOL + +FILES_TO_CLEAN = $out.pdftex_t $out.pstex_t + diff --git a/support/autolatex/translators/svg2pdf_inkscape.transdef b/support/autolatex/translators/svg2pdf_inkscape.transdef new file mode 100644 index 0000000000..bed567e8b7 --- /dev/null +++ b/support/autolatex/translators/svg2pdf_inkscape.transdef @@ -0,0 +1,30 @@ +# autolatex - svg2pdf_inkscape.transdef +# Copyright (C) 2009-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svg .svgz + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +COMMAND_LINE for pdf = inkscape --without-gui --export-area-page --export-pdf "$out" "$in" +COMMAND_LINE for eps = inkscape --without-gui --export-area-page --export-eps "$out" "$in" + diff --git a/support/autolatex/translators/svg2pdf_rsvg.transdef b/support/autolatex/translators/svg2pdf_rsvg.transdef new file mode 100644 index 0000000000..fbf760d3a9 --- /dev/null +++ b/support/autolatex/translators/svg2pdf_rsvg.transdef @@ -0,0 +1,30 @@ +# autolatex - svg2pdf_rsvg.transdef +# Copyright (C) 2015 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svg .svgz + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +COMMAND_LINE for pdf = rsvg-convert -a -f pdf -o "$out" "$in" +COMMAND_LINE for eps = rsvg-convert -a -f eps -o "$out" "$in" + diff --git a/support/autolatex/translators/svg2png_inkscape.transdef b/support/autolatex/translators/svg2png_inkscape.transdef new file mode 100644 index 0000000000..3e9e78a337 --- /dev/null +++ b/support/autolatex/translators/svg2png_inkscape.transdef @@ -0,0 +1,28 @@ +# autolatex - svg2png_inkscape.transdef +# Copyright (C) 2009-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svg .svgz + +OUTPUT_EXTENSIONS = .png + +COMMAND_LINE = inkscape --without-gui --export-area-page --export-background-opacity=0.0 --export-dpi=160 --export-png "$out" "$in" + diff --git a/support/autolatex/translators/svg2png_rsvg.transdef b/support/autolatex/translators/svg2png_rsvg.transdef new file mode 100644 index 0000000000..f3d838df17 --- /dev/null +++ b/support/autolatex/translators/svg2png_rsvg.transdef @@ -0,0 +1,28 @@ +# autolatex - svg2png_rsvg.transdef +# Copyright (C) 2015 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .svg + +OUTPUT_EXTENSIONS = .png + +COMMAND_LINE = rsvg-convert -a -d 160 -p 160 -f png -o "$out" "$in" + diff --git a/support/autolatex/translators/template.txt b/support/autolatex/translators/template.txt new file mode 100644 index 0000000000..631f2a9e94 --- /dev/null +++ b/support/autolatex/translators/template.txt @@ -0,0 +1,99 @@ +# autolatex - <FILE>.transdef +# Copyright (C) 2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + + +############################################ +# NOTE: +# +# All the options in this file could be postfixed by the keyword +# "for pdf" or "for eps". The keywords "for pdf" indicates that the +# option must be used in PDF mode generation only; +# the keywords "for eps" indicates that the option must be used in +# EPS mode generation only; +# otherwise the option is used in both modes. +# +# The prefix must be written between the name of the option and the +# sign "=". +############################################ + + +# A list of extensions (separated by spaces) of the input files. +;INPUT_EXTENSIONS = + +# A list of extensions (separated by spaces) of the output files. +;OUTPUT_EXTENSIONS = + +# Command line to invoke to translate the files from input to output. +# $in is the environment variable for the input filename. +# $inext is the environment variable for the extension of the input filename. +# $out is the environment variable for the output filename. +# $outbasename is the basename without the extension and the dirname of the output file. +# $outwoext is the basename without the extension but with the dirname of the out file. +# You could use environment variables by prefixing them with the character +# "$", even on Window operating systems. We decide to use the Unix standard +# to obtain a single configuration file for all the operating systems. +# If the command line is empty, you must define a code function in +# the variable TRANSLATOR_FUNCTION. +# The space characters are used to split the command line into parameters. +# To put a space character in a parameter, you must enclose the string with +# quotes. +;COMMAND_LINE = + +# List of perl packages that must be included to run the TRANSLATOR_FUNCTION, +# excluding the AutoLaTeX Core libraries and the following libraries: +# AutoLaTeX::Core::Util AutoLaTeX::Core::Locale AutoLaTeX::Core::OS +# File::Spec File::Path File::Basename File::Copy +# If you want to include a particular feature as done in Perl with: +# use ThePackage::TheCass qw(feature); +# Please use the following syntax: +# ThePackage::TheCass qw(feature) +# ThePackage::TheCass qw{feature} +# ThePackage::TheCass 'feature' +;TRANSLATOR_PERL_DEPENDENCIES = + +# Code to invoke to translate the files from input to output. +# $in is the environment variable for the input filename. +# $inext is the current extension of the input filename. +# $out is the environment variable for the output filename. +# $outbasename is the basename without the extension and without the dirname of the out file. +# $outwoext is the basename without the extension but with the dirname of the out file. +# @inexts is the array of the extensions defined in variable INPUT_EXTENSIONS. +# $outext is the first extension defined in variable OUTPUT_EXTENSION. +# @outexts are the extensions defined in variable OUTPUT_EXTENSION. +# $ispdfmode indicates if the translator is used in PDF mode. +# $isepsmode indicates if the translator is used in EPS mode. +# If the command line is empty, you must define a code function in +# the variable TRANSLATOR_FUNCTION. +# +# LANGUAGE USED FOR THE CODE: +# By default, the code put in TRANSLATOR_FUNCTION is written in the Perl language. +# If you want to use another scripting language, you must specify the script +# interpreter with the keyword "with". The first line below is the definition of +# a function in Perl. The second line below is the definition of a function in +# Python. Note that, "with <language>" must be put before "for <mode>". +# Note that for other languages than Perl, the variable names explained above are +# all prefixed by the character '_', eg. '$out' must be read '_out'. +;TRANSLATOR_FUNCTION = +;TRANSLATOR_FUNCTION with python = + +# List of patterns that are representing the output files to remove when cleaning. +# The syntax of the variable is a space-separated list of shell patterns. +# $in is the basename (without the extension and without the directory) of the input file. +# $out is the basename (without the extension and without the directory) of the output file. +;FILES_TO_CLEAN = + diff --git a/support/autolatex/translators/tikz2pdf.transdef b/support/autolatex/translators/tikz2pdf.transdef new file mode 100644 index 0000000000..d1d46c8065 --- /dev/null +++ b/support/autolatex/translators/tikz2pdf.transdef @@ -0,0 +1,57 @@ +# autolatex - tikz2pdf.transdef +# Copyright (C) 2015 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .tikz + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $basename = basename("$in", @inexts); + my $text = join(" ", + "\\documentclass{standalone}", + "\\usepackage{pgfplots}", + "\\usepackage{amsmath}", + "\\usepackage{tikz}", + "\\newlength\\figurewidth", + "\\newlength\\figureheight", + "\\setlength\\figurewidth{50em}", + "\\setlength\\figureheight{50em}", + "\\begin{document}", + "\\input{$in}", + "\\end{document}"); + if ($ispdfmode) { + runCommandOrFail( + 'pdflatex', '-shell-escape', '-halt-on-error', + '-jobname', "$basename", "$text" ); + } + else { + runCommandOrFail( + 'latex', '-shell-escape', '-halt-on-error', + '-jobname', "$basename", "$text" ); + } + unlink(File::Spec->catfile(dirname($in), $basename.".aux")); + unlink(File::Spec->catfile(dirname($in), $basename.".log")); +} + +EOL + diff --git a/support/autolatex/translators/vsd2pdf.transdef b/support/autolatex/translators/vsd2pdf.transdef new file mode 100644 index 0000000000..33c34a252a --- /dev/null +++ b/support/autolatex/translators/vsd2pdf.transdef @@ -0,0 +1,51 @@ +# autolatex - vsd2pdf.transdef +# Copyright (C) 2014 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .vsd .vdx .vsdx + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_PERL_DEPENDENCIES = version + +TRANSLATOR_FUNCTION =<<EOL { + # Check for the Inkscape version + if (lc($inext) eq '.vsdx') { + my @o = runCommandOrFail("inkscape", "--version"); + my $o = join('', @o); + if ($o =~ /^Inkscape\s+([0-9a-zA-Z\._\-]+)\s+/i) { + my $mandatoryVersion = version->parse("0.49"); + my $version = version->parse("$1"); + if ($version < $mandatoryVersion) { + printErr("The convertion from $inext needs Inkscape $mandatoryVersion or higher."); + return; + } + } + } + if ($isepsmode) { + runCommandOrFail('inkscape', '--without-gui', '--export-area-page', '--export-eps', "$out", "$in"); + } + else { + runCommandOrFail('inkscape', '--without-gui', '--export-area-page', '--export-pdf', "$out", "$in"); + } +} +EOL diff --git a/support/autolatex/translators/xcf2pdf.transdef b/support/autolatex/translators/xcf2pdf.transdef new file mode 100644 index 0000000000..6d1bd29231 --- /dev/null +++ b/support/autolatex/translators/xcf2pdf.transdef @@ -0,0 +1,30 @@ +# autolatex - xcf2pdf.transdef +# Copyright (C) 2014 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .xcf + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +COMMAND_LINE for pdf = convert -antialias "$in" -flatten "$out" +COMMAND_LINE for eps = convert -antialias "$in" -flatten "$out" + diff --git a/support/autolatex/translators/xcf2png.transdef b/support/autolatex/translators/xcf2png.transdef new file mode 100644 index 0000000000..e762edef2c --- /dev/null +++ b/support/autolatex/translators/xcf2png.transdef @@ -0,0 +1,28 @@ +# autolatex - xcf2png.transdef +# Copyright (C) 2014 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .xcf + +OUTPUT_EXTENSIONS = .png + +COMMAND_LINE = convert -antialias "$in" -flatten "$out" + diff --git a/support/autolatex/translators/xmi2pdf_umbrello.transdef b/support/autolatex/translators/xmi2pdf_umbrello.transdef new file mode 100644 index 0000000000..70a7606df9 --- /dev/null +++ b/support/autolatex/translators/xmi2pdf_umbrello.transdef @@ -0,0 +1,91 @@ +# autolatex - xmi2pdf_umbrello.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .xmi + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONs for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + # Create tmp dir + my $outdir = File::Spec->catfile( + dirname("$in"), + basename("$in", @inexts)); + if (-d "$outdir") { + remove_tree("$outdir") or printErr("$outdir: $!"); + } + make_path($outdir) or printErr("$outdir: $!"); + + # Generation of the EPS from XMI + runCommandOrFail( + 'umbrello', + '--export', 'eps', + '--directory', "$outdir", + "$in"); + + # Translate the generated files + my @generatedFiles = (); + local *INDIR; + opendir(*INDIR, "$outdir") or printErr("$outdir: $!"); + while (my $fn = readdir(*INDIR)) { + if ($fn ne File::Spec->updir() && $fn ne File::Spec->curdir() + && $fn =~ /\.eps$/) { + my $ffn = File::Spec->catfile("$outdir", "$fn"); + if (-f "$ffn") { + push @generatedFiles, "$ffn"; + } + } + } + closedir(*INDIR); + + my $transresult = 0; + + if (@generatedFiles>1) { + my $template = File::Spec->catfile( + dirname($out), + basename($out,$outext)).'_'; + foreach my $file (@generatedFiles) { + my $bn = basename($file,'.eps'); + $bn =~ s/\s+/_/sg; + if (runTranslator( 'eps2pdf', "$file", "$template$bn.pdf")) { + $transresult = 1; + } + } + } + elsif (@generatedFiles) { + my $file = shift @generatedFiles; + $transresult = runTranslator( 'eps2pdf', "$file", "$out"); + } + else { + printErr("No file generated"); + } + + if (-d "$outdir") { + remove_tree("$outdir") or printErr("$outdir: $!"); + } + + $transresult; +} +EOL + +FILES_TO_CLEAN = $out_*.pdf $out_*.eps $out + diff --git a/support/autolatex/translators/xmi2pdf_uml2svg.transdef b/support/autolatex/translators/xmi2pdf_uml2svg.transdef new file mode 100644 index 0000000000..5f82d99199 --- /dev/null +++ b/support/autolatex/translators/xmi2pdf_uml2svg.transdef @@ -0,0 +1,41 @@ +# autolatex - xmi2pdf_uml2svg.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .xmi + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION =<<EOL { + my $svgFile = File::Spec->catfile( + dirname("$in"), + basename("$in", @inexts).'.svg'); + runCommandOrFail( + 'uml2svg', + '-o', "$svgFile", + "$in"); + my $transresult = runTranslator( 'svg2pdf', "$svgFile", "$out"); + unlink("$svgFile"); + $transresult; +} +EOL + diff --git a/support/autolatex/translators/xmi2pdf_xmi2svg.transdef b/support/autolatex/translators/xmi2pdf_xmi2svg.transdef new file mode 100644 index 0000000000..f92583c1c0 --- /dev/null +++ b/support/autolatex/translators/xmi2pdf_xmi2svg.transdef @@ -0,0 +1,55 @@ +# autolatex - xmi2pdf_xmi2svg.transdef +# Copyright (C) 1998-2013 Stephane Galland <galland@arakhne.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +#-------------------------------------------- +# See template.txt for details on the fields +#-------------------------------------------- + +INPUT_EXTENSIONS = .xmi + +OUTPUT_EXTENSIONS for pdf = .pdf +OUTPUT_EXTENSIONS for eps = .eps + +TRANSLATOR_FUNCTION_PDF =<<EOL { + my $svgFile = File::Spec->catfile( + dirname("$in"), + basename("$in", @inexts).'.svg'); + runCommandOrFail( + 'xmi2svg', + '-o', "$svgFile", + "$in"); + my $transresult = runTranslator( 'svg2pdf', "$svgFile", "$out"); + unlink("$svgFile"); + $transresult; +} +EOL + +TRANSLATOR_FUNCTION_PDF =<<EOL { + my $svgFile = File::Spec->catfile( + dirname("$in"), + basename("$in", @inexts).'.svg'); + runCommandOrFail( + 'xmi2svg', + '-o', "$svgFile", + "$in"); + my $transresult = runTranslator( 'svg2pdf', "$svgFile", "$out"); + unlink("$svgFile"); + $transresult; +} +EOL + |