summaryrefslogtreecommitdiff
path: root/gnu/dist/sgmltools-lite/python/backends
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/dist/sgmltools-lite/python/backends')
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Dvi.py87
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Html.py88
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/JadeTeX.py46
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Ld2db.py71
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Lynx.py59
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/OneHtml.py46
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Pdf.py87
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Ps.py58
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/Rtf.py45
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/W3m.py71
-rw-r--r--gnu/dist/sgmltools-lite/python/backends/iSilo.py79
11 files changed, 737 insertions, 0 deletions
diff --git a/gnu/dist/sgmltools-lite/python/backends/Dvi.py b/gnu/dist/sgmltools-lite/python/backends/Dvi.py
new file mode 100644
index 00000000..dc2692d6
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Dvi.py
@@ -0,0 +1,87 @@
+#
+# backends/Dvi.py
+#
+# $Id: Dvi.py,v 1.2 2000/08/03 12:38:57 cdegroot Exp $
+#
+# SGMLtools DVI backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+from utils import registerTemp
+import os
+
+class Dvi(Backend):
+
+ def postJade(self, outfile, stdoutfile):
+
+ #
+ # Looks like that from 1.1.8, jadetex writes output in cwd
+ # instead of TMPDIR. No matter what jadetex chooses to do,
+ # this will make sure it lands in TMPDIR. We set TEXINPUTS
+ # so that included graphics are found.
+ #
+ savdir = os.getcwd()
+ envname = 'TEXINPUTS'
+ if os.environ.has_key(envname):
+ os.environ[envname] = '.:%s:%s' % (savdir, os.environ[envname])
+ else:
+ os.environ[envname] = '.:%s:' % (savdir)
+ (tmpdir, junk) = os.path.split(outfile)
+ self._tracer.chdir(tmpdir)
+
+ #
+ # Run JadeTeX on the generated file, thrice.
+ #
+ (dvibase, junk) = os.path.splitext(outfile)
+ destfile = dvibase + '.dvi'
+ cmdline = 'jadetex ' + outfile
+ for run in range(3):
+ try:
+ os.unlink(destfile)
+ except:
+ pass
+ self._tracer.system(cmdline)
+ if not os.path.isfile(destfile):
+ raise IOError, 'JadeTeX run failed'
+
+ #
+ # Write generated DVI file to destination if we're the final
+ # backend. If we're nested, leave the file hanging around.
+ #
+ self._tracer.chdir(savdir)
+ if self._globs.getName() == 'dvi':
+ finalfile = os.path.join (self._fileparts[1],
+ self._fileparts[0] + '.dvi')
+ self._tracer.mv(destfile, finalfile)
+
+ #
+ # Make sure that the temporary files are unlinked, later on.
+ #
+ registerTemp(os.path.join(tmpdir, dvibase + '.log'))
+ registerTemp(os.path.join(tmpdir, dvibase + '.aux'))
+
+
+
+class DviGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'dvi'
+
+ def getJadeSettings(self):
+ return ('sgmltools-dvi', 'tex')
diff --git a/gnu/dist/sgmltools-lite/python/backends/Html.py b/gnu/dist/sgmltools-lite/python/backends/Html.py
new file mode 100644
index 00000000..bf57ab17
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Html.py
@@ -0,0 +1,88 @@
+#
+# backends/Html.py
+#
+# $Id: Html.py,v 1.5 2000/10/26 06:20:23 cdegroot Exp $
+#
+# SGMLtools HTML backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import utils, os, string, stat
+
+class Html(Backend):
+
+ def preJade(self, fh):
+ #
+ # Make a temporary directory, and change in there. Correct the
+ # filename if it wasn't absolute by prepending the old working
+ # directory.
+ #
+ self._savdir = os.getcwd();
+ self._tempdir, junk = os.path.splitext(utils.makeTemp())
+ self._tracer.mkdir(self._tempdir, 0700)
+ self._tracer.chdir(self._tempdir)
+
+ return fh
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # If we land here, everything worked out fine. Below the
+ # original working directory, create a subdirectory, and copy
+ # the results from the temporary directory over there.
+ #
+ # We clean the destination directory first so that old parts
+ # don't hang around, and we make a symlink named "index.html"
+ # pointing to the logical starting point of the resulting html
+ # set.
+ #
+ self._tracer.chdir(self._savdir) # so relative names work ok.
+ (srcdir, junk) = os.path.split(outfile)
+ destdir = os.path.join(self._fileparts[1], self._fileparts[0])
+
+ if os.path.exists(destdir):
+ self._tracer.system('rm -rf ' + destdir + '/*')
+ else:
+ self._tracer.mkdir(destdir)
+
+ self._tracer.mv(self._tempdir + '/*', destdir)
+ self._tracer.rmdir(self._tempdir)
+
+ #
+ # The first file in the manifest is what we'll see as index.html
+ #
+ self._tracer.chdir(destdir)
+ try:
+ fh = open('HTML.manifest', 'r')
+ indexfile = string.strip(fh.readline())
+ fh.close()
+ self._tracer.symlink(indexfile, 'index.html')
+ except:
+ pass
+
+
+ self._tracer.chdir(self._savdir)
+
+
+class HtmlGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'html'
+
+ def getJadeSettings(self):
+ return ('sgmltools-html', 'sgml')
diff --git a/gnu/dist/sgmltools-lite/python/backends/JadeTeX.py b/gnu/dist/sgmltools-lite/python/backends/JadeTeX.py
new file mode 100644
index 00000000..87c50555
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/JadeTeX.py
@@ -0,0 +1,46 @@
+#
+# backends/JadeTeX.py
+#
+# $Id: JadeTeX.py,v 1.3 2000/08/03 12:38:57 cdegroot Exp $
+#
+# SGMLtools JadeTeX backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+from utils import registerTemp
+import os
+
+class JadeTeX(Backend):
+
+ def postJade(self, outfile, stdoutfile):
+
+ savdir = os.getcwd()
+ (tmpdir, junk) = os.path.split(outfile)
+ self._tracer.chdir(savdir)
+ finalfile = os.path.join(self._fileparts[1],
+ self._fileparts[0] + '.tex')
+ self._tracer.mv(outfile, finalfile)
+
+class JadeTeXGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'jadetex'
+
+ def getJadeSettings(self):
+ return ('sgmltools-tex', 'tex')
diff --git a/gnu/dist/sgmltools-lite/python/backends/Ld2db.py b/gnu/dist/sgmltools-lite/python/backends/Ld2db.py
new file mode 100644
index 00000000..7787fc87
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Ld2db.py
@@ -0,0 +1,71 @@
+#
+# backends/Ld2db.py
+#
+# $Id: Ld2db.py,v 1.2 2000/08/03 12:38:57 cdegroot Exp $
+#
+# SGMLtools LinuxDoc conversion backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import os, string
+
+class Ld2db(Backend):
+
+ def preJade(self, fh):
+ #
+ # We need to patch up the SGML_CATALOG_FILES so that
+ # just the elements we need are in there. Otherwise, we
+ # have trouble with finding the wrong SGML declaration.
+ #
+ pathelems = string.split(os.environ["SGML_CATALOG_FILES"], ':')
+ newcatfiles = []
+ for i in pathelems:
+ if string.find(i, 'dtd/sgmltools') != -1:
+ newcatfiles.append(i)
+ elif string.find(i, 'stylesheets/sgmltools') != -1:
+ newcatfiles.append(i)
+ elif string.find(i, 'dtd/jade') != -1:
+ newcatfiles.append(i)
+ elif string.find(i, 'entities/iso-entities-8879.1986') != -1:
+ newcatfiles.append(i)
+
+ os.environ["SGML_CATALOG_FILES"] = string.join(newcatfiles, ':')
+ self._tracer.trace('SGML_CATALOG_FILES=' +
+ os.environ["SGML_CATALOG_FILES"])
+
+ return fh
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # Write generated DVI file to destination if we're the final
+ # backend. Note that Jade spits stuff to stdoutfile in this
+ # case.
+ #
+ destfile = os.path.join(self._fileparts[1],
+ self._fileparts[0] + '.db-sgml')
+ self._tracer.mv(stdoutfile, destfile)
+
+
+class Ld2dbGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'ld2db'
+
+ def getJadeSettings(self):
+ return ('sgmltools-db', 'sgml')
diff --git a/gnu/dist/sgmltools-lite/python/backends/Lynx.py b/gnu/dist/sgmltools-lite/python/backends/Lynx.py
new file mode 100644
index 00000000..3436af78
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Lynx.py
@@ -0,0 +1,59 @@
+#
+# backends/Lynx.py
+#
+# $Id: Lynx.py,v 1.2 2000/10/25 06:00:05 cdegroot Exp $
+#
+# SGMLtools Lynx-based text backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import os
+
+class Lynx(Backend):
+
+ def preJade(self, fh):
+ #
+ # Check whether Lynx is there, if not: die
+ #
+ if self._autoconf['progs']['lynx'] == 'N/A':
+ raise Exception, 'Lynx not configured, cannot produce output'
+ else:
+ return fh
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # Jade wrote HTML, run it through lynx.
+ #
+ destfile = os.path.join(self._fileparts[1], self._fileparts[0] + '.txt')
+ self._tracer.system ("lynx -dump -nolist -force_html %s >%s" \
+ % (stdoutfile, destfile))
+
+
+class LynxGlobals(BackendGlobals):
+
+ def getName(self):
+ #
+ # Now that there is more than one txt backend, we pose as 'lynx', not
+ # as 'txt'
+ #
+ return 'lynx'
+
+ def getJadeSettings(self):
+ return ('sgmltools-lynx', 'sgml')
+
diff --git a/gnu/dist/sgmltools-lite/python/backends/OneHtml.py b/gnu/dist/sgmltools-lite/python/backends/OneHtml.py
new file mode 100644
index 00000000..c3a30d0c
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/OneHtml.py
@@ -0,0 +1,46 @@
+#
+# backends/OneHtml.py
+#
+# $Id: OneHtml.py,v 1.2 2000/08/03 12:38:57 cdegroot Exp $
+#
+# SGMLtools DVI backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+from utils import registerTemp
+import os, string
+
+class OneHtml(Backend):
+
+ def postJade(self, outfile, stdoutfile):
+
+ #
+ # Write generated HTML file to destination.
+ #
+ destfile = os.path.join(self._fileparts[1],
+ self._fileparts[0] + '.html')
+ self._tracer.mv(stdoutfile, destfile)
+
+class OneHtmlGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'onehtml'
+
+ def getJadeSettings(self):
+ return ('sgmltools-onehtml', 'sgml')
diff --git a/gnu/dist/sgmltools-lite/python/backends/Pdf.py b/gnu/dist/sgmltools-lite/python/backends/Pdf.py
new file mode 100644
index 00000000..256c607c
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Pdf.py
@@ -0,0 +1,87 @@
+#
+# backends/Pdf.py
+#
+# $Id: Pdf.py,v 1.2 2000/08/03 12:38:57 cdegroot Exp $
+#
+# SGMLtools DVI backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+from utils import registerTemp
+import os
+
+class Pdf(Backend):
+
+ def postJade(self, outfile, stdoutfile):
+
+ #
+ # Looks like that from 1.1.8, jadetex writes output in cwd
+ # instead of TMPDIR. No matter what jadetex chooses to do,
+ # this will make sure it lands in TMPDIR. We set TEXINPUTS
+ # so that included graphics are found.
+ #
+ savdir = os.getcwd()
+ envname = 'TEXINPUTS'
+ if os.environ.has_key(envname):
+ os.environ[envname] = '.:%s:%s' % (savdir, os.environ[envname])
+ else:
+ os.environ[envname] = '.:%s:' % (savdir)
+ (tmpdir, junk) = os.path.split(outfile)
+ self._tracer.chdir(tmpdir)
+
+ #
+ # Run JadeTeX on the generated file, thrice.
+ #
+ (pdfbase, junk) = os.path.splitext(outfile)
+ destfile = pdfbase + '.pdf'
+ cmdline = 'pdfjadetex ' + outfile
+ for run in range(3):
+ try:
+ os.unlink(destfile)
+ except:
+ pass
+ self._tracer.system(cmdline)
+ if not os.path.isfile(destfile):
+ raise IOError, 'JadeTeX run failed'
+
+ #
+ # Write generated PDF file to destination if we're the final
+ # backend. If we're nested, leave the file hanging around.
+ #
+ self._tracer.chdir(savdir)
+ if self._globs.getName() == 'pdf':
+ finalfile = os.path.join (self._fileparts[1],
+ self._fileparts[0] + '.pdf')
+ self._tracer.mv(destfile, finalfile)
+
+ #
+ # Make sure that the temporary files are unlinked, later on.
+ #
+ registerTemp(os.path.join(tmpdir, pdfbase + '.log'))
+ registerTemp(os.path.join(tmpdir, pdfbase + '.aux'))
+
+
+
+class PdfGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'pdf'
+
+ def getJadeSettings(self):
+ return ('sgmltools-pdf', 'tex')
diff --git a/gnu/dist/sgmltools-lite/python/backends/Ps.py b/gnu/dist/sgmltools-lite/python/backends/Ps.py
new file mode 100644
index 00000000..b63aee15
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Ps.py
@@ -0,0 +1,58 @@
+#
+# backends/Ps.py
+#
+# $Id: Ps.py,v 1.1 2000/03/24 09:16:45 cdegroot Exp $
+#
+# SGMLtools PostScript backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import os
+from Dvi import Dvi
+
+class Ps(Dvi):
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # Call the DVI postJade routine, this leaves a DVI file we
+ # can postprocess.
+ #
+ Dvi.postJade(self, outfile, stdoutfile)
+
+ (tmpdir, junk) = os.path.split(outfile)
+ (dvibase, junk) = os.path.splitext(outfile)
+ dvifile = os.path.join(tmpdir, dvibase + '.dvi')
+
+ destfile = os.path.join(self._fileparts[1],
+ self._fileparts[0] + '.ps')
+
+ #
+ # Call dvips on the DVI file.
+ #
+ cmdline = 'dvips -o %s %s' % (destfile, dvifile)
+ self._tracer.system(cmdline)
+
+
+class PsGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'ps'
+
+ def getJadeSettings(self):
+ return ('sgmltools-ps', 'tex')
diff --git a/gnu/dist/sgmltools-lite/python/backends/Rtf.py b/gnu/dist/sgmltools-lite/python/backends/Rtf.py
new file mode 100644
index 00000000..ca8042e5
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/Rtf.py
@@ -0,0 +1,45 @@
+#
+# backends/Rtf.py
+#
+# $Id: Rtf.py,v 1.2 2000/08/03 12:38:57 cdegroot Exp $
+#
+# SGMLtools RTF backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import os
+
+class Rtf(Backend):
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # Jade wrote RTF, send it to its final destination
+ #
+ destfile = os.path.join(self._fileparts[1], self._fileparts[0] + '.rtf')
+ self._tracer.mv(outfile, destfile)
+
+
+class RtfGlobals(BackendGlobals):
+
+ def getName(self):
+ return 'rtf'
+
+ def getJadeSettings(self):
+ return ('sgmltools-rtf', 'rtf')
+
diff --git a/gnu/dist/sgmltools-lite/python/backends/W3m.py b/gnu/dist/sgmltools-lite/python/backends/W3m.py
new file mode 100644
index 00000000..f327ae72
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/W3m.py
@@ -0,0 +1,71 @@
+#
+# backends/W3m.py
+#
+# $Id: W3m.py,v 1.2 2000/11/27 20:11:57 dnedrow Exp $
+#
+# SGMLtools W3m-based text backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import os
+
+class W3m(Backend):
+
+ def preJade(self, fh):
+ #
+ # Check whether W3m is there, if not: die
+ #
+ if self._autoconf['progs']['w3m'] == 'N/A':
+ raise Exception, 'w3m not configured, cannot produce output'
+ else:
+ return fh
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # Jade wrote HTML, run it through w3m.
+ #
+ destfile = os.path.join(self._fileparts[1], self._fileparts[0] + '.txt')
+ self._tracer.system ("w3m -T text/html -dump %s >%s" \
+ % (stdoutfile, destfile))
+
+
+class W3mGlobals(BackendGlobals):
+
+ def getName(self):
+ #
+ # As long as we're the only txt backend, we pose as 'txt', not
+ # as 'w3m'
+ #
+ return 'w3m'
+
+ def getJadeSettings(self):
+ return ('sgmltools-w3m', 'sgml')
+
+ def printHelp(self, fh):
+ """Not much help for w3m."""
+ print '\n\n'
+ print 'w3m (http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/eng) is a'
+ print 'text-based pager that can be used to browse websites from a'
+ print 'console. It can also be used to generate text versions of'
+ print 'websites, generally with better output than the Lynx dump'
+ print 'facility. If w3m is found when sgmltools-lite is installed'
+ print 'it becomes the default parser for the txt backend.'
+
+ pass
+
diff --git a/gnu/dist/sgmltools-lite/python/backends/iSilo.py b/gnu/dist/sgmltools-lite/python/backends/iSilo.py
new file mode 100644
index 00000000..c3efa8b6
--- /dev/null
+++ b/gnu/dist/sgmltools-lite/python/backends/iSilo.py
@@ -0,0 +1,79 @@
+#
+# backends/iSilo.py
+#
+# $Id: iSilo.py,v 1.2 2000/11/27 20:11:57 dnedrow Exp $
+#
+# SGMLtools iSilo-based text backend driver.
+#
+# SGMLtools - an SGML toolkit.
+# Copyright (C) 1998 Cees A. de Groot
+#
+# 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; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from Backend import Backend, BackendGlobals
+import os
+
+class iSilo(Backend):
+
+ def preJade(self, fh):
+ #
+ # Check whether iSilo is there, if not: die
+ #
+ if self._autoconf['progs']['iSilo'] == 'N/A':
+ raise Exception, 'iSilo not configured, cannot produce output'
+ else:
+ return fh
+
+ def postJade(self, outfile, stdoutfile):
+ #
+ # Jade wrote HTML, run it through iSilo.
+ #
+ destfile = os.path.join(self._fileparts[1], self._fileparts[0] + '.pdb')
+ self._tracer.system ("%s -y -I %s %s" \
+ % (self._autoconf['progs']['iSilo'],
+ stdoutfile, destfile))
+
+
+class iSiloGlobals(BackendGlobals):
+
+ def getName(self):
+ #
+ # As long as we're the only txt backend, we pose as 'pdb', not
+ # as 'iSilo'
+ #
+ return 'pdb'
+
+ def getJadeSettings(self):
+ return ('sgmltools-pdb', 'sgml')
+
+ def printHelp(self, fh):
+ """Not much help for iSilo."""
+ print '\n\n'
+ print 'iSilo (http://www.isilo.com) is an application that converts'
+ print 'HTML and ASCII to documents which can be viewed on Palm'
+ print 'compatible devices using the free iSilo reader.'
+ print ''
+ print 'While iSilo can parse HTML directly, the sgmltools'
+ print 'implementation uses a text backend to generate the input'
+ print 'to the iSilo encoder.'
+ print ''
+ print 'A future improvement to this backend will be input options'
+ print 'that will allow the user to specify pre-processing formats.'
+ print ''
+ print 'Free linux encoders and Palm readers are available from the'
+ print 'URL above.'
+
+ pass
+