Filewatcher File Search
FTP Search
  
Directory 
  
Content Search 
   
pkg://html2sgml-0.3-1.src.rpm:20701/html2sgml-0.3.tar.gz  info  downloads

html2sgml-0.3/ 40775    765    765           0  6400542235  11705 5ustar  peterpeterhtml2sgml-0.3/doc/ 40775    765    765           0  6400545146  12456 5ustar  peterpeterhtml2sgml-0.3/doc/html2sgml-1.html100664      0      0        4300  6400545073  15050 0ustar  rootroot<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Draft//EN">
<HTML>
<HEAD>
<TITLE>html2sgml documentation: README</TITLE>
</HEAD>
<BODY>
Previous
<A HREF="html2sgml-2.html">Next</A>
<A HREF="html2sgml.html#toc1">Contents</A>
<HR>
<H2><A NAME="s1">1. README</A></H2>

<P>html2sgml is a program wich converts html to sgml accroding to linuxdoc.sgml.
With a file in linuxdoc.dtd format you can create nice typset books, well
structured html-documents and so forth. linuxdoc.dtd is the format used in Linux
HOWTOS, for example.
<P>html2sgml i tuned to work well with Applix HTML, and will convert any
footnotes apearent in the applix word-file that was used to produce the
html.
<P>To use html2sgml you need Perl. To use the image converting routines you also
need: giftopnm, ppmtopgm and pnmtops
<P>To do something usefull with the resulting file you also need linuxdoc-sgml or
the follow up sgml-tools 
<A HREF="http://www.xs4all.nl/~cg/sgmltools/">http://www.xs4all.nl/~cg/sgmltools/</A>.
<P>
<H2><A NAME="ss1.1">1.1 Getting html2sgml</A>
</H2>

<P>The homepage of html2sgml is 
<A HREF="http://www.abc.se/~m9339/prog/html2sgml.html">http://www.abc.se/~m9339/prog/html2sgml.html</A>
It is possible to ftp it from 
<A HREF="ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/">ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/</A>.
It has also been upploded to 
<A HREF="ftp://ftp.redhat.com">ftp://ftp.redhat.com</A> and 
<A HREF="ftp://sunsite.unc.edu/pub/linux/">ftp://sunsite.unc.edu/pub/linux/</A>.
<H2><A NAME="ss1.2">1.2 Installation</A>
</H2>

<P>To install html2sgml unpack the tarfile and cd into the disrtibution. Type
<PRE>
make install
</PRE>

It will install the programs html2sgml and mkbook, som files in the specified
documentdirectory, including <EM>extras</EM> a couple of script that shows some
examples of how you can merg severall html-files into one to use with html2sgml. A
manual page will be installed too.
<P>Edit the makefile to change where to install and where Perl is on your system.
The default is /usr/bin/perl and prefix = /usr/local
<P>
<H2><A NAME="ss1.3">1.3 Usage</A>
</H2>

<P>See the manual page
<P>
<HR>
Previous
<A HREF="html2sgml-2.html">Next</A>
<A HREF="html2sgml.html#toc1">Contents</A>
</BODY>
</HTML>
html2sgml-0.3/doc/html2sgml-2.html100664      0      0        7745  6400545074  15072 0ustar  rootroot<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Draft//EN">
<HTML>
<HEAD>
<TITLE>html2sgml documentation: Manual page</TITLE>
</HEAD>
<BODY>
<A HREF="html2sgml-1.html">Previous</A>
Next
<A HREF="html2sgml.html#toc2">Contents</A>
<HR>
<H2><A NAME="s2">2. Manual page</A></H2>

<P>
<H2><A NAME="ss2.1">2.1 NAME</A>
</H2>

<P>html2sgml &mdash; convert html to sgml according to linuxdoc.dtd
<P>
<H2><A NAME="ss2.2">2.2 SYNOPSIS</A>
</H2>

<P>html2sgml <EM>file.html</EM>
<P>
<H2><A NAME="ss2.3">2.3 DESCRIPTION</A>
</H2>

<P><EM>html2sgml</EM> is a fileconverter that converts html-files to sgml-files 
according to linuxdoc.dtd. It will ouput a file with the same name
as the specified file but with the ending html changed to sgml.
<P>It will not work on every html-file because of the
free format of html. It is tuned to work well with html produced from 
<EM>Applix HTML-editor</EM>. If it finds a applix word file in the same directory
and with the same name as the specified file, it will include any
<EM>footnotes</EM>
from the aw-file in the produced sgml-file.
<P><EM>html2sgml</EM> will also try to convert all included images of type gif to
postscript.
<P>By default html2sgml produces a ducument of type <EM>article</EM>. To change
to <EM>book</EM> you can use the script <EM>mkbook</EM>. It also fills
in a dummy name. If there is a title tag in the html-file it will use that
as a title for the sgml-file. To change this you have to hand edit the
sgml-file. 
<P>If there are more than one <EM>H1</EM> tag these are used as the toplevel section.
Everything marked H1 will become a <EM>sect</EM> in sgml, and <EM>H2</EM>
will become sect1 and so forth. If there is only one ore no H1, H2 will 
be used instead. If there is no H* tags, then the document i broken by 
design :-)
<P>The resulting sgml-file can then be used by <EM>sgml-tools (was linuxdoc-sgml)</EM> to produce
various new fileformats, eg latex, info, rtf.
<P>
<H2><A NAME="ss2.4">2.4 TIPS</A>
</H2>

<P><EM>html2sgml</EM> should work fine with straight html, that is, when no special
layout formating has been done. For example: it can handle html table tags, but it can
not handle them well if they are used to produce layout.
<P>The best working thing is to use it with <EM>Applix html</EM>. You can both
write directly in Applix Word or import document to applix word. Try to use 
predefined styles for your document. You can create heading1, heading2, pre,
quote and so forth. Open Applix HTML and use <EM>File->Import words document</EM>. You will then get the chance to tell Applix wich html-tags your defined
styles should match, eg heading1 -> html_h1. Then use <EM>Format -> HTML document
setting</EM> where you can fill in the title; here you can also fill in the
alternative to export Applix images as gif files. This is good to do because
html2sgml can convert the gif files to ps-files wich can be used when/if
converting to latex.
<P>
<H2><A NAME="ss2.5">2.5 BUGS AND FEATURES</A>
</H2>

<P><EM>html2sgml</EM> is still under development and will most probably contain
bugs. It also contain som features. All possible HTML and sgml tags are not
implemented. Unimplemented HTML tags will show up in the sgml file where you
have to hand edit them away. Some tags in sgml are also unsupported. More specific:
no math tags is implemented. You can check the resulting sgml file with the command 
<EM>sgmlcheck</EM> to discover any leftover tags.
<P>I have concentrated on making it work in english and in swedish. This means that
there are a lot of characters that probably not will work OK, specialy when
converting Applix footnotes. Look in the source and try to put in the missing
characters if you have any problems. And pleas send the new improved
version to mee.
<P>
<H2><A NAME="ss2.6">2.6 AUTHOR</A>
</H2>

<P>Peter Antman (peter.antman@abc.se)
<P>
<H2><A NAME="ss2.7">2.7 SEE ALSO</A>
</H2>

<P>sgml2latex(1), sgml2html(1), sgml2txt(1), sgml2info(1), sgml2rtf, sgml2lyx(1)
<HR>
<A HREF="html2sgml-1.html">Previous</A>
Next
<A HREF="html2sgml.html#toc2">Contents</A>
</BODY>
</HTML>
html2sgml-0.3/doc/html2sgml.html100664    765    765        2061  6400545074  15351 0ustar  peterpeter<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Draft//EN">
<HTML>
<HEAD>
<TITLE>html2sgml documentation</TITLE>
</HEAD>
<BODY>
Previous
<A HREF="html2sgml-1.html">Next</A>
Contents
<HR>
<H1>html2sgml documentation</H1>

<H2>Peter Antman</H2>Tue Aug 26 12:26:46 MET DST 1997
<P>
<H2><A NAME="toc1">1.</A> <A HREF="html2sgml-1.html">README</A></H2>

<UL>
<LI><A HREF="html2sgml-1.html#ss1.1">1.1 Getting html2sgml</A>
<LI><A HREF="html2sgml-1.html#ss1.2">1.2 Installation</A>
<LI><A HREF="html2sgml-1.html#ss1.3">1.3 Usage</A>
</UL>
<P>
<H2><A NAME="toc2">2.</A> <A HREF="html2sgml-2.html">Manual page</A></H2>

<UL>
<LI><A HREF="html2sgml-2.html#ss2.1">2.1 NAME</A>
<LI><A HREF="html2sgml-2.html#ss2.2">2.2 SYNOPSIS</A>
<LI><A HREF="html2sgml-2.html#ss2.3">2.3 DESCRIPTION</A>
<LI><A HREF="html2sgml-2.html#ss2.4">2.4 TIPS</A>
<LI><A HREF="html2sgml-2.html#ss2.5">2.5 BUGS AND FEATURES</A>
<LI><A HREF="html2sgml-2.html#ss2.6">2.6 AUTHOR</A>
<LI><A HREF="html2sgml-2.html#ss2.7">2.7 SEE ALSO</A>
</UL>
<HR>
Previous
<A HREF="html2sgml-1.html">Next</A>
Contents
</BODY>
</HTML>
html2sgml-0.3/doc/html2sgml.sgml100664    765    765       12553  6400545057  15377 0ustar  peterpeter<!doctype linuxdoc system>
<article>
<title>html2sgml documentation
<author>Peter Antman
<date>Tue Aug 26 12:26:46 MET DST 1997
<sect>README
<p>
html2sgml is a program wich converts html to sgml accroding to linuxdoc.sgml.
With a file in linuxdoc.dtd format you can create nice typset books, well
structured html-documents and so forth. linuxdoc.dtd is the format used in Linux
HOWTOS, for example.

html2sgml i tuned to work well with Applix HTML, and will convert any
footnotes apearent in the applix word-file that was used to produce the
html.

To use html2sgml you need Perl. To use the image converting routines you also
need: giftopnm, ppmtopgm and pnmtops

To do something usefull with the resulting file you also need linuxdoc-sgml or
the follow up sgml-tools <htmlurl url="http://www.xs4all.nl/~cg/sgmltools/"
name="http://www.xs4all.nl/~cg/sgmltools/">.

<sect1> Getting html2sgml
<p>
The homepage of html2sgml is <htmlurl
url="http://www.abc.se/~m9339/prog/html2sgml.html"
name="http://www.abc.se/~m9339/prog/html2sgml.html">
It is possible to ftp it from <htmlurl
url="ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/"
name="ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/">.
It has also been upploded to <htmlurl url="ftp://ftp.redhat.com"
name="ftp://ftp.redhat.com"> and <htmlurl url="ftp://sunsite.unc.edu/pub/linux/"
name="ftp://sunsite.unc.edu/pub/linux/">.
<sect1> Installation
<p>
To install html2sgml unpack the tarfile and cd into the disrtibution. Type
<verb>
make install
</verb>
It will install the programs html2sgml and mkbook, som files in the specified
documentdirectory, including <em>extras</em> a couple of script that shows some
examples of how you can merg severall html-files into one to use with html2sgml. A
manual page will be installed too.

Edit the makefile to change where to install and where Perl is on your system.
The default is /usr/bin/perl and prefix = /usr/local

<sect1> Usage
<p>
See the manual page

<sect> Manual page
<p>
<sect1> NAME
<p>
html2sgml &mdash convert html to sgml according to linuxdoc.dtd

<sect1> SYNOPSIS
<p>
html2sgml <em>file.html</em>

<sect1> DESCRIPTION
<p>
<em>html2sgml</em> is a fileconverter that converts html-files to sgml-files 
according to linuxdoc.dtd. It will ouput a file with the same name
as the specified file but with the ending html changed to sgml.
<p>
It will not work on every html-file because of the
free format of html. It is tuned to work well with html produced from 
<em>Applix HTML-editor</em>. If it finds a applix word file in the same directory
and with the same name as the specified file, it will include any
<em>footnotes</em>
from the aw-file in the produced sgml-file.
<p>
<em>html2sgml</em> will also try to convert all included images of type gif to
postscript.
<p>
By default html2sgml produces a ducument of type <em>article</em>. To change
to <em>book</em> you can use the script <em>mkbook</em>. It also fills
in a dummy name. If there is a title tag in the html-file it will use that
as a title for the sgml-file. To change this you have to hand edit the
sgml-file. 
<p>
If there are more than one <em>H1</em> tag these are used as the toplevel section.
Everything marked H1 will become a <em>sect</em> in sgml, and <em>H2</em>
will become sect1 and so forth. If there is only one ore no H1, H2 will 
be used instead. If there is no H* tags, then the document i broken by 
design :-)
<p>
The resulting sgml-file can then be used by <em>sgml-tools (was linuxdoc-sgml)</em> to produce
various new fileformats, eg latex, info, rtf.

<sect1> TIPS
<p>
<em>html2sgml</em> should work fine with straight html, that is, when no special
layout formating has been done. For example: it can handle html table tags, but it can
not handle them well if they are used to produce layout.
<p>
The best working thing is to use it with <em>Applix html</em>. You can both
write directly in Applix Word or import document to applix word. Try to use 
predefined styles for your document. You can create heading1, heading2, pre,
quote and so forth. Open Applix HTML and use <em>File->Import words document
</em>. You will then get the chance to tell Applix wich html-tags your defined
styles should match, eg heading1 -> html_h1. Then use <em>Format -> HTML document
setting</em> where you can fill in the title; here you can also fill in the
alternative to export Applix images as gif files. This is good to do because
html2sgml can convert the gif files to ps-files wich can be used when/if
converting to latex.

<sect1> BUGS AND FEATURES
<p>
<em>html2sgml</em> is still under development and will most probably contain
bugs. It also contain som features. All possible HTML and sgml tags are not
implemented. Unimplemented HTML tags will show up in the sgml file where you
have to hand edit them away. Some tags in sgml are also unsupported. More specific:
no math tags is implemented. You can check the resulting sgml file with the command 
<em>sgmlcheck</em> to discover any leftover tags.
<p>
I have concentrated on making it work in english and in swedish. This means that
there are a lot of characters that probably not will work OK, specialy when
converting Applix footnotes. Look in the source and try to put in the missing
characters if you have any problems. And pleas send the new improved
version to mee.

<sect1> AUTHOR
<p>
Peter Antman (peter.antman@abc.se)

<sect1> SEE ALSO
<p>
sgml2latex(1), sgml2html(1), sgml2txt(1), sgml2info(1), sgml2rtf, sgml2lyx(1)
</article> 
html2sgml-0.3/doc/html2sgml.txt100664    765    765       13144  6400545103  15241 0ustar  peterpeter  html2sgml documentation
  Peter Antman
  Tue Aug 26 12:26:46 MET DST 1997

  11..  RREEAADDMMEE

  html2sgml is a program wich converts html to sgml accroding to
  linuxdoc.sgml.  With a file in linuxdoc.dtd format you can create nice
  typset books, well structured html-documents and so forth.
  linuxdoc.dtd is the format used in Linux HOWTOS, for example.

  html2sgml i tuned to work well with Applix HTML, and will convert any
  footnotes apearent in the applix word-file that was used to produce
  the html.

  To use html2sgml you need Perl. To use the image converting routines
  you also need: giftopnm, ppmtopgm and pnmtops

  To do something usefull with the resulting file you also need
  linuxdoc-sgml or the follow up sgml-tools
  http://www.xs4all.nl/~cg/sgmltools/.

  11..11..  GGeettttiinngg hhttmmll22ssggmmll

  The homepage of html2sgml is
  http://www.abc.se/~m9339/prog/html2sgml.html It is possible to ftp it
  from ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/.  It has also
  been upploded to ftp://ftp.redhat.com and
  ftp://sunsite.unc.edu/pub/linux/.

  11..22..  IInnssttaallllaattiioonn

  To install html2sgml unpack the tarfile and cd into the disrtibution.
  Type

  make install

  It will install the programs html2sgml and mkbook, som files in the
  specified documentdirectory, including _e_x_t_r_a_s a couple of script that
  shows some examples of how you can merg severall html-files into one
  to use with html2sgml. A manual page will be installed too.

  Edit the makefile to change where to install and where Perl is on your
  system.  The default is /usr/bin/perl and prefix = /usr/local

  11..33..  UUssaaggee

  See the manual page

  22..  MMaannuuaall ppaaggee

  22..11..  NNAAMMEE

  html2sgml -- convert html to sgml according to linuxdoc.dtd

  22..22..  SSYYNNOOPPSSIISS

  html2sgml _f_i_l_e_._h_t_m_l

  22..33..  DDEESSCCRRIIPPTTIIOONN

  _h_t_m_l_2_s_g_m_l is a fileconverter that converts html-files to sgml-files
  according to linuxdoc.dtd. It will ouput a file with the same name as
  the specified file but with the ending html changed to sgml.

  It will not work on every html-file because of the free format of
  html. It is tuned to work well with html produced from _A_p_p_l_i_x _H_T_M_L_-
  _e_d_i_t_o_r. If it finds a applix word file in the same directory and with
  the same name as the specified file, it will include any _f_o_o_t_n_o_t_e_s
  from the aw-file in the produced sgml-file.

  _h_t_m_l_2_s_g_m_l will also try to convert all included images of type gif to
  postscript.

  By default html2sgml produces a ducument of type _a_r_t_i_c_l_e. To change to
  _b_o_o_k you can use the script _m_k_b_o_o_k. It also fills in a dummy name. If
  there is a title tag in the html-file it will use that as a title for
  the sgml-file. To change this you have to hand edit the sgml-file.

  If there are more than one _H_1 tag these are used as the toplevel
  section.  Everything marked H1 will become a _s_e_c_t in sgml, and _H_2 will
  become sect1 and so forth. If there is only one ore no H1, H2 will be
  used instead. If there is no H* tags, then the document i broken by
  design :-)

  The resulting sgml-file can then be used by _s_g_m_l_-_t_o_o_l_s _(_w_a_s _l_i_n_u_x_d_o_c_-
  _s_g_m_l_) to produce various new fileformats, eg latex, info, rtf.

  22..44..  TTIIPPSS

  _h_t_m_l_2_s_g_m_l should work fine with straight html, that is, when no
  special layout formating has been done. For example: it can handle
  html table tags, but it can not handle them well if they are used to
  produce layout.

  The best working thing is to use it with _A_p_p_l_i_x _h_t_m_l. You can both
  write directly in Applix Word or import document to applix word. Try
  to use predefined styles for your document. You can create heading1,
  heading2, pre, quote and so forth. Open Applix HTML and use
  _F_i_l_e_-_>_I_m_p_o_r_t _w_o_r_d_s _d_o_c_u_m_e_n_t. You will then get the chance to tell
  Applix wich html-tags your defined styles should match, eg heading1 ->
  html_h1. Then use _F_o_r_m_a_t _-_> _H_T_M_L _d_o_c_u_m_e_n_t _s_e_t_t_i_n_g where you can fill
  in the title; here you can also fill in the alternative to export
  Applix images as gif files. This is good to do because html2sgml can
  convert the gif files to ps-files wich can be used when/if converting
  to latex.

  22..55..  BBUUGGSS AANNDD FFEEAATTUURREESS

  _h_t_m_l_2_s_g_m_l is still under development and will most probably contain
  bugs. It also contain som features. All possible HTML and sgml tags
  are not implemented. Unimplemented HTML tags will show up in the sgml
  file where you have to hand edit them away. Some tags in sgml are also
  unsupported. More specific: no math tags is implemented. You can check
  the resulting sgml file with the command _s_g_m_l_c_h_e_c_k to discover any
  leftover tags.

  I have concentrated on making it work in english and in swedish. This
  means that there are a lot of characters that probably not will work
  OK, specialy when converting Applix footnotes. Look in the source and
  try to put in the missing characters if you have any problems. And
  pleas send the new improved version to mee.

  22..66..  AAUUTTHHOORR

  Peter Antman (peter.antman@abc.se)

  22..77..  SSEEEE AALLSSOO

  sgml2latex(1), sgml2html(1), sgml2txt(1), sgml2info(1), sgml2rtf,
  sgml2lyx(1)

html2sgml-0.3/doc/README.sgml100664    765    765        3657  6400545146  14407 0ustar  peterpeter<!doctype linuxdoc system>
<article>
<title>html2sgml documentation
<author>Peter Antman
<date>Tue Aug 26 12:26:46 MET DST 1997
<sect>README
<p>
html2sgml is a program wich converts html to sgml accroding to linuxdoc.sgml.
With a file in linuxdoc.dtd format you can create nice typset books, well
structured html-documents and so forth. linuxdoc.dtd is the format used in Linux
HOWTOS, for example.

html2sgml i tuned to work well with Applix HTML, and will convert any
footnotes apearent in the applix word-file that was used to produce the
html.

To use html2sgml you need Perl. To use the image converting routines you also
need: giftopnm, ppmtopgm and pnmtops

To do something usefull with the resulting file you also need linuxdoc-sgml or
the follow up sgml-tools <htmlurl url="http://www.xs4all.nl/~cg/sgmltools/"
name="http://www.xs4all.nl/~cg/sgmltools/">.

<sect1> Getting html2sgml
<p>
The homepage of html2sgml is <htmlurl
url="http://www.abc.se/~m9339/prog/html2sgml.html"
name="http://www.abc.se/~m9339/prog/html2sgml.html">
It is possible to ftp it from <htmlurl
url="ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/"
name="ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/">.
It has also been upploded to <htmlurl url="ftp://ftp.redhat.com"
name="ftp://ftp.redhat.com"> and <htmlurl url="ftp://sunsite.unc.edu/pub/linux/"
name="ftp://sunsite.unc.edu/pub/linux/">.
<sect1> Installation
<p>
To install html2sgml unpack the tarfile and cd into the disrtibution. Type
<verb>
make install
</verb>
It will install the programs html2sgml and mkbook, som files in the specified
documentdirectory, including <em>extras</em> a couple of script that shows some
examples of how you can merg severall html-files into one to use with html2sgml.
A
manual page will be installed too.

Edit the makefile to change where to install and where Perl is on your system.
The default is /usr/bin/perl and prefix = /usr/local

<sect1> Usage
<p>
See the manual page
</article>
html2sgml-0.3/doc/README.txt100664      0      0        3325  6400545162  13616 0ustar  rootroot  html2sgml documentation
  Peter Antman
  Tue Aug 26 12:26:46 MET DST 1997

  11..  RREEAADDMMEE

  html2sgml is a program wich converts html to sgml accroding to
  linuxdoc.sgml.  With a file in linuxdoc.dtd format you can create nice
  typset books, well structured html-documents and so forth.
  linuxdoc.dtd is the format used in Linux HOWTOS, for example.

  html2sgml i tuned to work well with Applix HTML, and will convert any
  footnotes apearent in the applix word-file that was used to produce
  the html.

  To use html2sgml you need Perl. To use the image converting routines
  you also need: giftopnm, ppmtopgm and pnmtops

  To do something usefull with the resulting file you also need
  linuxdoc-sgml or the follow up sgml-tools
  http://www.xs4all.nl/~cg/sgmltools/.

  11..11..  GGeettttiinngg hhttmmll22ssggmmll

  The homepage of html2sgml is
  http://www.abc.se/~m9339/prog/html2sgml.html It is possible to ftp it
  from ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/.  It has also
  been upploded to ftp://ftp.redhat.com and
  ftp://sunsite.unc.edu/pub/linux/.

  11..22..  IInnssttaallllaattiioonn

  To install html2sgml unpack the tarfile and cd into the disrtibution.
  Type

  make install

  It will install the programs html2sgml and mkbook, som files in the
  specified documentdirectory, including _e_x_t_r_a_s a couple of script that
  shows some examples of how you can merg severall html-files into one
  to use with html2sgml.  A manual page will be installed too.

  Edit the makefile to change where to install and where Perl is on your
  system.  The default is /usr/bin/perl and prefix = /usr/local

  11..33..  UUssaaggee

  See the manual page

html2sgml-0.3/html2sgml100755    765    765       27353  6400542712  13671 0ustar  peterpeter#!/usr/bin/perl
# html2sgml - converts html-filese to
# v 0.3
# Rude script to convert a html-file to a sgml-file in a format
# suitabel for linuxdoc-sgml. See html2sgml.1 for ducumentation.
# (c) Peter Antman, 1997.
# send bug reports to:
# peter.antman@abc.se
#
#
# 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.
#



$THISPROG = "html2sgml 0.3";


$usage = "usage: html2sgml fil.html";

die $usage if @ARGV < 1;
$htmlfile = shift (@ARGV);

$htmlfile =~ /([\S]*?)\.html/ or die "Could not figure out postfix for filename: $!\n";
$filename = $1;
$sgmlfile = "$filename.sgml";

open (html, $htmlfile);
open (sgml, ">$sgmlfile");


# Make sgml-header
print sgml <<'End_off';
<!--Converted to sgml with html2sgml-->
<!doctype linuxdoc system>
<article>
End_off

# If we can find an applix-world file in the same directory with
# the same name: try to get footnotes

if (-e "$filename.aw") {
    open (aw, "$filename.aw");
    
    $nrfootnotes = 0;
    $start_note = nej;
    $inT = nej;
    while (<aw>) {
    
    	# Find all fotnotes and their number and sequensnumber
	
	if (/^<S_F.*?footnote\s\"(\d*)\">$/) {
		$number = $1;    
		$nrfootnotes++;
	    	$tmpftn{$number} = "$nrfootnotes";
	
	}
	
	# What footnote are we taking the content from
	if (/^<start_footnote\s\"(\d*)\">$/) {
	    $whichnote = $1;
	    $start_note = ja;
	}
	
	# En open footnote
	if (/^<end_footnote>$/) {
	    $start_note = nej;
	}
	
	# Grab the content
	if ($start_note eq ja) {
	    if (!((/footnote_body/) or (/<T.*?position/) or (/<Symbol/))) {
	    	
		# citations in footnotes are tricky in converted docs
		s/\\\"/''/g;
		
	    	# special rutin to handle long footnotes
	    	# this is done only when foonote was not ended in first round
	    	if ($inT eq ja) {

	    		if (/(^[\s]+.*?\\)|(^[\s]+.*?>)/) {
	    			s/\\//g;
	    			s/^\s//g;
	    			s/\n//g;
	    			
	    			
	    			if (/.*?>/) {
	    			
	    				$tmpharb = "$tmpharb" . "$_";
	    				if ($tmpharb =~ /italic/) {
	    					$tmpharb =~ s/\"\s.*?>//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "<it>$tmpharb</it>";
	    				} elsif ($tmpharb =~ /bold/) {
	    					$tmpharb =~ s/\"\s.*?>//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "<bf>$tmpharb</bf>";
	    				} else {
	    					$tmpharb =~ s/\".*?>$//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "$tmpharb";
	    				}
	    				
	    				$inT = nej;
	    			} else {
	    				$tmpharb = "$tmpharb" . "$_";
	    			}
	    		}
	    	}
	    	
	    	# The real footnotecontent
	    
		if (/(<T\s\"(.*)\"(.*)$)|(<T\s\"(.*)[^\"]\\)/) {
			# Footnotes have three formats
			# 1) <T "CONTENT">
			# 2) <T "CONTENT" TAG>
			# 3) <T "CONTENT\
			# Hm, and
			# 4) <T "CONTENT"\ TAG>
			if (/<T\s\"([^\"]+)\"(.*)>$/) {
				$cont = $1;
				$cont =~ s/\\//g;
		
				$it = $2;
				
				if (/italic/) {
		    		$cont = "<it>$cont</it>";
				}
		
				if (/bold/) {
				$cont = "<bf>$cont</bf>";
				}
		

		
				$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "$cont";
			}
			if (/<T\s\"(.*?)\\$/) {
			# Ok we are in a long footnote, wich is difficult
			# It may not even be the hole footnote, just a
			# special formated piece of it.
				$cont = $1;
				$cont =~ s/\\//g;
			# Have to harbour it temporary
				$tmpharb = ();
				$tmpharb = $cont;	
				$inT = ja;
				
			}
		

	    	}
	}
	}
	}
	
}
close aw;

# Sorry we have to do this, but othervise we might get norty chars
# in footnotes; I have only converted chars of interest to mee. 
# Others have to fill in with other 8-bit chars
for ($i = 1; $i <= $nrfootnotes; $i++) {
		$tmp = "$footnotes{$i}";
		$tmp =~ s/\&/&amp;/g;
	    	$tmp =~ s/\^[\s]*of/&aring;/g;
		$tmp =~ s/\^[\s]*pg/&ouml;/g;
		$tmp =~ s/\^[\s]*oe/&auml;/g;
		
		$tmp =~ s/\^[\s]*mf/&Aring;/g;
		$tmp =~ s/\^[\s]*me/&Auml;/g;
		$tmp =~ s/\^[\s]*ng/&Ouml;/g;
		$tmp =~ s/\^[\s]*mj/&Eacute;/g;
		$tmp =~ s/\^[\s]*mi/&Egrave;/g;
		$tmp =~ s/\^[\s]*oj/&eacute;/g;
		$tmp =~ s/\^[\s]*oi/&egrave;/g;
		$tmp =~ s/\^[\s]*ni/&Oslash;/g;
		$tmp =~ s/\^[\s]*pi/&oslash;/g;
		$tmp =~ s/\^[\s]*nm/&Uuml;/g;
		$tmp =~ s/\^[\s]*pm/&uuml;/g;
		$tmp =~ s/\^[\s]*kh/§/g;
		$tmp =~ s/\[/&lsqb;/g;
		$tmp =~ s/\]/&rsqb;/g;
		$tmp =~ s/\^//g;

		$footnotes{$i} = $tmp;
		
}


# Now we must check a couple of things first. The title and where to start
# section levels, and tables, Therefore we poure througe the whole file until we
# find something usefull.

$hone = 0;
$htwo = 0;

$intable = nej;
$nrtable = 0;
$nrrow = 0;

LOOP:
while (<html>) {
	if ($_ =~/\<TITLE\>([^\<]*)/i) {
		print sgml "<title>$1\n";
	}
	if ($_ =~/\<H1.*?\>/i) {
		$hone++;
	
	    }
    
	# We have to count tables and the amount of coloumns in them
	if ($_=~/<TABLE.*?>/i) {
	    $intable = ja;
	    $nrtable++;
	}
	if ($intable eq ja) {
	    if ($_=~/<TR.*?>/) {
		$nrrow++;
	    }
	    if ($nrrow == 1) {
		if (/<\/TD.*?>/) {
		    $table{$nrtable} = "$table{$nrtable}" . "l";
		}
	    }
	}
	
	if ($_=~/<\/TABLE.*?>/) {
	    $intable = nej;
	    $nrrow = 0;
	}
    }
if ($hone > 1 ) {
	$sect = H1;
} else {
	$sect = H2;
}
    
close html;

$nrtable = 0;
$intable = nej;

# Lets first write I couple of thing we probably cant figure out
# Would be good if we could figure out the name of the writer
# Perhaps ask for one?
print sgml <<'End_off_sub';
<author>You name
<date>
<abstract>
</abstract>
<toc>
End_off_sub

# Now we can start the real substitution, the order of the substitution is
# in some cases realy important
open (html, $htmlfile);

$inquote = nej;
$inverb = nej;
$nrfootnotes = 0;
while (<html>) {
	
	# must be first for sake of footnotes	
    
    	s/<FONT.*?>|<\/FONT>//gi;
    
    	# footnotes, as they are converted in Applix aw->html
	if (/<SUP>|<\/SUP>/) {
		# grab all footnotes on the current line
		while (/<SUP>[0-9]+/) {
			$nrfootnotes++;
			$putin = $footnotes{$nrfootnotes};
			s/<SUP>[0-9]+/<footnote>$putin<\/footnote>/;
		}
		# if foonotenumber noot on the same line as <SUP>
		while (/[0-9]+<\/SUP>/) {
			$nrfootnotes++;
			$putin = $footnotes{$nrfootnotes};
			s/[0-9]+<\/SUP>/<footnote>$putin<\/footnote>/;
		}
	}
	
	
	# Things to remowe
	s/<SUP>|<\/SUP>//gi;
	s/<HTML>|<\/HTML>//gi;
	s/<HEAD>|<\/HEAD>//gi;
	s/<TITLE>((.*<\/TITLE>)|(.*$))//gi;
	s/<\/TITLE>//gi;
	s/<HR>//gi;
	s/<U>|<\/U>//gi;
	s/<BODY.*?>|\<\/BODY>//gi;
	s/[0-9]*<\/SUP>//gi;
	s/<TT>|<\/TT>//gi;
	s/<SAMP>|<\/SAMP>//gi;
	
	s/<CENTER>|<\/CENTER>//gi;
	s/<ADDRESS>|<\/ADDRESS>//gi;
	s/<P\s.*?>//gi;
	
	
	#things to substitute
	
	# fist sectionlevel
	# first ones that has no meaning, remove them
	 s/<H1><\/H1>//gi;
	 s/<H2><\/H2>//gi;
	 s/<H3><\/H3>//gi;
	 s/<H4><\/H4>//gi;
	 s/<H5><\/H5>//gi;
	if ($sect eq H1) {
	    s/<H1.*?>/<sect>/gi;
	    s/<\/H1>/\n<p>/gi;
	    s/<H2.*?>/<sect1>/gi;
	    s/<\/H2>/\n<p>/gi;
	    s/<H3.*?>/<sect2>/gi;
	    s/<\/H3>/\n<p>/gi;
	    s/<H4.*?>/<sect3>/gi;
	    s/<\/H4>/\n<p>/gi;
	    s/<H5.*?>/<sect4>/gi;
	    s/<\/H5>/\n<p>/gi;
	} else {
	    s/<H2.*?>/<sect>/gi;
	    s/<\/H2>/\n<p>/gi;
	    s/<H3.*?>/<sect1>/gi;
	    s/<\/H3>/\n<p>/gi;
	    s/<H4.*?>/<sect2>/gi;
	    s/<\/H4>/\n<p>/gi;
	    s/<H5.*?>/<sect3>/gi;
	    s/<\/H5>/\n<p>/gi;
	    }
	
	# lets take al one to one things
	s/<BR>//gi;
	s/<UL>/<itemize>/gi;
	s/<\/UL>/<\/itemize>/gi;
	s/<OL>/<enum>/gi;
	s/<\/OL>/<\/enum>/gi;
	s/<DIR>/<itemize>/gi;
	s/<\/DIR>/<\/itemize>/gi;

	# Does not generate good results
	s/<DL.*?>/<descrip>/gi;
	s/<\/DL>/<\/descrip>/gi;
	s/<DT>/<tag>/gi;
	s/<DD>/<\/tag>/gi;
	
	s/<LI>/<item>/gi;
	s/<\/LI>/<\/item>/gi;
	s/<LQ>/<lq>/gi;
	s/<\/LQ>/<\/lq>/gi;
	s/<EM>/<em>/g;
	s/<\/EM>/<\/em>/g;
	s/<CITE>/<em>/gi;
	s/<\/CITE>/<\/em>/gi;
	s/<B>/<bf>/gi;
	s/<\/B>/<\/bf>/gi;
	s/<STRONG>/<bf>/gi;
	s/<\/STRONG>/<\/bf>/gi;
	s/<I>/<it>/gi;
	s/<\/I>/<\/it>/gi;
	s/<SF>/<sf>/g;
	s/<\/SF>/<\/sf>/g;
	s/<CODE>/<tt>/gi;
	s/<\/CODE>/<\/tt>\n/gi;
	s/<PRE>/<tscreen><verb>/gi;
	
	# \n taken away from ending if tscreen
	s/<\/PRE>/<\/verb><\/tscreen>/gi;
	s/<MC>/<mc>/gi;
	s/<\/MC>/<\/mc>/gi;
	s/&quot;/''/gi;
	s/<DFN>/<tt>/gi;
	s/<\/DFN>/<\/tt>/gi;
	
	# To prevent norty things to happend i latex
	s/``/''/g;
	
	s/&#60;/&lt;/g;
	s/&#62;/&gt;/g;
	s/&#38;/&amp;/gi;
	
	
	# we have to do special things inside verb and quote
	if (/\<tscreen\>\<verb>/) {
	    $inverb = ja;
	}
	
	if (/\<\/verb\>\<\/tscreen\>/) {
	    $inverb = nej;
	}
	
	# quote does not like empty rows
	if (/\<BLOCKQUOTE\>/i) {
	    $inquote = ja;
	    s/<BLOCKQUOTE>/<quote>/gi;
	}
	if (/\<\/BLOCKQUOTE\>/i) {
	    $inquote = nej;
	    s/<\/BLOCKQUOTE>/<\/quote>/gi;
	}
	

	
	#table - hm...probably only works for applix,
	# to work with sgml2html, change tabular to table in mapping
	if ($_=~/<TABLE.*?>/i) {
	    $nrtable++;
	    s/<TABLE.*>?/<tabular ca=\"$table{$nrtable}\">/gi;
	}
	s/<TR.*?>//gi;
	s/<\/TD><\/TR>/<rowsep>/gi;
	s/<TD.*?>//gi;
	s/<\/TD>/<colsep>/gi;
	if ($_=~/<\/TABLE.*?>/i) {
	    s/<\/TABLE>/<\/tabular>/gi;
	}


	#urls - pure url does not produce god looking formats - use htmlurl for all
	s/<A\sNAME=\"(.*)\">?(.*)<\/A>/\2<label id=\"\1\">/gi;
	s/<A\sNAME=(.*?)>(.*?)<\/A>/\2<label id=\"\1\">/gi;
	s/<A\sHREF=\"#([^\"]*)\">?(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;;
	s/<A\sHREF=\"([^\"]*)\">?(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;
	s/<A\sHREF=\"([^\"]*)\">?(.*?)$/<htmlurl url=\"\1\" name=\"\2\">/gi;
	
	# pure formaters dont use quotes
	s/<A\sHREF=#([^\"]*?)>(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;;
	s/<A\sHREF=([^\"]*?)>(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;
	s/<A\sHREF=([^\"]*?)>(.*?)$/<htmlurl url=\"\1\" name=\"\2\">/gi;
	# img - makes a eps-img, will only convert gifs
	if ($_=~/\<IMG.*?SRC=([^>]*?)\.([^>]*?)>/i) {
				      
		$img = $1;
		$img =~ s/\"//g;
		$ext = $2;
		$ext =~ s/\"//g;
		s/<IMG.*?SRC=[^>]*?>/<figure>\n<eps file=\"$img\">\n<\/figure>/gi;
		 # save the pics
		push(@pics, "$img.$ext");
				   
	}
	
				  
	# remove stale things
	s/<\/A>//gi;	
			   
	# Fix smlish away from verb-env, should be more...
	if ($inverb eq ja) {

	    if (!/<quote>|<tscreen><verb>|<footnote>|<\/footnote>/) {
		s/<.*?>|<\/.*?>//gi;
		s/&gt;/>/gi;
		s/&lt;/</gi;
		s/&lsqb;/\[/g;
		s/&rsqb;/\]/g;
		s/&amp;/&ero;/gi;
		
		# iso-char have to be iso-char in verb
		# not all implemented
		s/&Auml;/Ä/g;
		s/&Aring;/Å/g;
		s/&Egrave;/È/g;
		s/&Eacute;/É/g;
		s/&Ouml;/Ö/g;
		s/&auml;/ä/g;
		s/&aring;/å/g;
		s/&egrave;/è/g;
		s/&eacute;/é/g;
		s/&ouml;/ö/g;    
	    }
	    
				      
# Dont know if this should realy be here, taken away for jargon
	    s/(\n)\n/\1/g;
	}

	# special macro-conversion
	if ($inverb eq nej) {
		s/\$/&dollar;/gi;
		s/([^&])#/\1&num;/gi;
		s/%/&percnt;/gi;
		s/~/&tilde;/gi;
		s/\\/&bsol;/gi;
		s/\[/&lsqb;/g;
		s/\]/&rsqb;/g;
		s/\^/&circ;/g;
		s/_/&lowbar;/g;
	
			       }
			       
	if ($inquote eq ja) {
		s/^\n//gi;
	    }		       
	
	s/<P>|^<\/P>$//g;
	
	if ($inquote eq nej) {
	
		s/<\/P>/\n/gi;
	} else {
		s/<\/P>//gi;
	}
	
	
	if ($inquote eq ja) {
		if (/^\s*$/) {
			# Dont do anything, just remove empty lines from quotes
		} else {
	    		print sgml;
	    	}
	} else {	  
		print sgml;
	}
			      
}
print sgml "</article>";
close sgml;

# convert any gifs (needs programs: giftopnm, ppptopgm and pnmtops) to ps
while (<@pics>) {
	if (-e "$_"){
		($name, $ex) = split(/\./, $_);
		`giftopnm $_ | ppmtopgm | pnmtops -noturn > $name.ps`;
	}
}

exit





html2sgml-0.3/Makefile100664    765    765        2143  6400542155  13443 0ustar  peterpeter# Makefile for installation of html2sgml, require perl
# Peter Antman, 1997.
SHELL = /bin/sh

VERSION = html2sgml-0.3

srcdir = .
prefix = /usr/local
exec_prefix = ${prefix}

bindir = ${exec_prefix}/bin
docdir = ${prefix}/doc/${VERSION}
mandir = ${prefix}/man
extrasdir = ${docdir}/extras


INSTALL = /usr/bin/install  
INSTALL_PROGRAM = ${INSTALL} -c
INSTALL_DATA = ${INSTALL} -c -m0644
INSTALL_DIR = ${INSTALL} -d

PERL = /usr/bin/perl

BIN = html2sgml mkbook
DOC = html2sgml.sgml html2sgml.txt html2sgml.html html2sgml-1.html html2sgml-2.html
EXTRAS = merg jargonmerg htmlmerg


install:
	@for i in $(BIN) ;\
	do \
	(	echo "installing $$i"; \
		echo "#!$(PERL)" > $(srcdir)/$$i; \
		cat $(srcdir)/$$i.in >> $(srcdir)/$$i; \
		$(INSTALL_PROGRAM) $$i $(bindir)); \
	done;
	$(INSTALL_DIR) $(docdir)
	@for i in $(DOC) ; \
	do \
	(	echo "installing $$i"; \
		$(INSTALL_DATA) $(srcdir)/doc/$$i $(docdir)); \
	done;
	$(INSTALL_DIR) $(extrasdir)
	@for i in $(EXTRAS) ;\
	do \
	( 	echo "installing $$i"; \
		$(INSTALL_PROGRAM) $(srcdir)/extras/$$i $(extrasdir)); \
	done;
	$(INSTALL_DATA) $(srcdir)/html2sgml.1 $(mandir)/man1
		
html2sgml-0.3/mkbook100755    765    765        2576  6400525671  13227 0ustar  peterpeter#!/usr/bin/perl
# Rude script to convert a html-file to a sgml-file in a format
# suitabel for linuxdoc-sgml
# (c) Peter Antman, 1997.
#
# 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.
#

$THISPROG = "mkbook 0.1";


$usage = "usage: mkbook fil.sgml";

#print "hej";

die $usage if @ARGV < 1;
$sgmlfile = shift (@ARGV);

$sgmlfile =~ /([\S]*?)\.sgml/;
$filename = $1;
$bookfile = "$filename-book.sgml";
print "$bookfile";
open (sgml, $sgmlfile);
open (book, ">$bookfile");

while (<sgml>) {
	s/<article>/<book>/gi;
	s/<\/article>/<\/book>/gi;
	
	s/<sect>/<chapt>/gi;
	s/<sect1>/<sect>/gi;
	s/<sect2>/<sect1>/gi;
	s/<sect3>/<sect2>/gi;
	s/<sect4>/<sect3>/gi;
	s/<sect5>/<sect4>/gi;

#	s/<abstract>|<\/abstract>//gi;
#	print;
	print book;
}

close book;
html2sgml-0.3/html2sgml.1100664    765    765        7223  6400511154  13775 0ustar  peterpeter.if n .ds Q \&"
.if t .ds Q ``
.if n .ds U \&"
.if t .ds U ''
.TH "html2sgml" 1 
.tr \&
.nr bi 0
.nr ll 0
.nr el 0
.de DS
..
.de DE
..
.de Pp
.ie \\n(ll>0 \{\
.ie \\n(bi=1 \{\
.nr bi 0
.if \\n(t\\n(ll=0 \{.IP \\(bu\}
.if \\n(t\\n(ll=1 \{.IP \\n+(e\\n(el.\}
.\}
.el .sp 
.\}
.el \{\
.ie \\nh=1 \{\
.LP
.nr h 0
.\}
.el .PP 
.\}
..
.SH NAME
html2sgml -- convert html to sgml according to linuxdoc.dtd

.SH SYNOPSIS
html2sgml \fIfile.html\fP

.SH DESCRIPTION

.Pp
\fIhtml2sgml\fP is a fileconverter that converts html-files to sgml-files 
according to linuxdoc.dtd. It will ouput a file with the same name
as the specified file but with the ending html changed to sgml.
.Pp
It will not work on every html-file because of the
free format of html. It is tuned to work well with html produced from 
\fIApplix HTML-editor\fP. If it finds a applix word file in the same directory
and with the same name as the specified file, it will include any
\fIfootnotes\fP
from the aw-file in the produced sgml-file.
.Pp
\fIhtml2sgml\fP will also try to convert all included images of type gif to
postscript.
.Pp
By default html2sgml produces a ducument of type \fIarticle\fP. To change
to \fIbook\fP you can use the script \fImkbook\fP. It also fills
in a dummy name. If there is a title tag in the html-file it will use that
as a title for the sgml-file. To change this you have to hand edit the
sgml-file. 
.Pp
If there are more than one \fIH1\fP tag these are used as the toplevel section.
Everything marked H1 will become a \fIsect\fP in sgml, and \fIH2\fP
will become sect1 and so forth. If there is only one ore no H1, H2 will 
be used instead. If there is no H* tags, then the document i broken by 
design :-)
.Pp
The resulting sgml-file can then be used by \fIsgml-tools (was linuxdoc-sgml)\fP to produce
various new fileformats, eg latex, info, rtf.
.Pp
.SH TIPS

.Pp
\fIhtml2sgml\fP should work fine with straight html, that is, when no special
layout formating has been done. For example: it can handle html table tags, but it can
not handle them well if they are used to produce layout.
.Pp
The best working thing is to use it with \fIApplix html\fP. You can both
write directly in Applix Word or import document to applix word. Try to use 
predefined styles for your document. You can create heading1, heading2, pre,
quote and so forth. Open Applix HTML and use \fIFile->Import words document\fP. You will then get the chance to tell Applix wich html-tags your defined
styles should match, eg heading1 -> html_h1. Then use \fIFormat -> HTML document
setting\fP where you can fill in the title; here you can also fill in the
alternative to export Applix images as gif files. This is good to do because
html2sgml can convert the gif files to ps-files wich can be used when/if
converting to latex.
.Pp
.SH BUGS AND FEATURES

.Pp
\fIhtml2sgml\fP is still under development and will most probably contain
bugs. It also contain som features. All possible HTML and sgml tags are not
implemented. Unimplemented HTML tags will show up in the sgml file where you
have to hand edit them away. Some tags in sgml are also unsupported. More specific:
no math tags is implemented. You can check the resulting sgml file with the command 
\fIsgmlcheck\fP to discover any leftover tags.
.Pp
I have concentrated on making it work in english and in swedish. This means that
there are a lot of characters that probably not will work OK, specialy when
converting Applix footnotes. Look in the source and try to put in the missing
characters if you have any problems. And pleas send the new improved
version to mee.
.Pp
.SH AUTHOR
Peter Antman (peter.antman@abc.se)

.SH SEE ALSO
sgml2latex(1), sgml2html(1), sgml2txt(1), sgml2info(1), sgml2rtf, sgml2lyx(1)

html2sgml-0.3/html2sgml.bak100755    765    765       27340  6400523013  14412 0ustar  peterpeter#!oj
# html2sgml - converts html-filese to
# v 0.3
# Rude script to convert a html-file to a sgml-file in a format
# suitabel for linuxdoc-sgml. See html2sgml.1 for ducumentation.
# (c) Peter Antman, 1997.
# send bug reports to:
# peter.antman@abc.se
#
#
# 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.
#



$THISPROG = "html2sgml 0.3";


$usage = "usage: html2sgml fil.html";

die $usage if @ARGV < 1;
$htmlfile = shift (@ARGV);

$htmlfile =~ /([\S]*?)\.html/ or die "Could not figure out postfix for filename: $!\n";
$filename = $1;
$sgmlfile = "$filename.sgml";

open (html, $htmlfile);
open (sgml, ">$sgmlfile");


# Make sgml-header
print sgml <<'End_off';
<!--Converted to sgml with html2sgml-->
<!doctype linuxdoc system>
<article>
End_off

# If we can find an applix-world file in the same directory with
# the same name: try to get footnotes

if (-e "$filename.aw") {
    open (aw, "$filename.aw");
    
    $nrfootnotes = 0;
    $start_note = nej;
    $inT = nej;
    while (<aw>) {
    
    	# Find all fotnotes and their number and sequensnumber
	
	if (/^<S_F.*?footnote\s\"(\d*)\">$/) {
		$number = $1;    
		$nrfootnotes++;
	    	$tmpftn{$number} = "$nrfootnotes";
	
	}
	
	# What footnote are we taking the content from
	if (/^<start_footnote\s\"(\d*)\">$/) {
	    $whichnote = $1;
	    $start_note = ja;
	}
	
	# En open footnote
	if (/^<end_footnote>$/) {
	    $start_note = nej;
	}
	
	# Grab the content
	if ($start_note eq ja) {
	    if (!((/footnote_body/) or (/<T.*?position/) or (/<Symbol/))) {
	    	
		# citations in footnotes are tricky in converted docs
		s/\\\"/''/g;
		
	    	# special rutin to handle long footnotes
	    	# this is done only when foonote was not ended in first round
	    	if ($inT eq ja) {

	    		if (/(^[\s]+.*?\\)|(^[\s]+.*?>)/) {
	    			s/\\//g;
	    			s/^\s//g;
	    			s/\n//g;
	    			
	    			
	    			if (/.*?>/) {
	    			
	    				$tmpharb = "$tmpharb" . "$_";
	    				if ($tmpharb =~ /italic/) {
	    					$tmpharb =~ s/\"\s.*?>//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "<it>$tmpharb</it>";
	    				} elsif ($tmpharb =~ /bold/) {
	    					$tmpharb =~ s/\"\s.*?>//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "<bf>$tmpharb</bf>";
	    				} else {
	    					$tmpharb =~ s/\".*?>$//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "$tmpharb";
	    				}
	    				
	    				$inT = nej;
	    			} else {
	    				$tmpharb = "$tmpharb" . "$_";
	    			}
	    		}
	    	}
	    	
	    	# The real footnotecontent
	    
		if (/(<T\s\"(.*)\"(.*)$)|(<T\s\"(.*)[^\"]\\)/) {
			# Footnotes have three formats
			# 1) <T "CONTENT">
			# 2) <T "CONTENT" TAG>
			# 3) <T "CONTENT\
			# Hm, and
			# 4) <T "CONTENT"\ TAG>
			if (/<T\s\"([^\"]+)\"(.*)>$/) {
				$cont = $1;
				$cont =~ s/\\//g;
		
				$it = $2;
				
				if (/italic/) {
		    		$cont = "<it>$cont</it>";
				}
		
				if (/bold/) {
				$cont = "<bf>$cont</bf>";
				}
		

		
				$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "$cont";
			}
			if (/<T\s\"(.*?)\\$/) {
			# Ok we are in a long footnote, wich is difficult
			# It may not even be the hole footnote, just a
			# special formated piece of it.
				$cont = $1;
				$cont =~ s/\\//g;
			# Have to harbour it temporary
				$tmpharb = ();
				$tmpharb = $cont;	
				$inT = ja;
				
			}
		

	    	}
	}
	}
	}
	
}
close aw;

# Sorry we have to do this, but othervise we might get norty chars
# in footnotes; I have only converted chars of interest to mee. 
# Others have to fill in with other 8-bit chars
for ($i = 1; $i <= $nrfootnotes; $i++) {
		$tmp = "$footnotes{$i}";
		$tmp =~ s/\&/&amp;/g;
	    	$tmp =~ s/\^[\s]*of/&aring;/g;
		$tmp =~ s/\^[\s]*pg/&ouml;/g;
		$tmp =~ s/\^[\s]*oe/&auml;/g;
		
		$tmp =~ s/\^[\s]*mf/&Aring;/g;
		$tmp =~ s/\^[\s]*me/&Auml;/g;
		$tmp =~ s/\^[\s]*ng/&Ouml;/g;
		$tmp =~ s/\^[\s]*mj/&Eacute;/g;
		$tmp =~ s/\^[\s]*mi/&Egrave;/g;
		$tmp =~ s/\^[\s]*oj/&eacute;/g;
		$tmp =~ s/\^[\s]*oi/&egrave;/g;
		$tmp =~ s/\^[\s]*ni/&Oslash;/g;
		$tmp =~ s/\^[\s]*pi/&oslash;/g;
		$tmp =~ s/\^[\s]*nm/&Uuml;/g;
		$tmp =~ s/\^[\s]*pm/&uuml;/g;
		$tmp =~ s/\^[\s]*kh/§/g;
		$tmp =~ s/\[/&lsqb;/g;
		$tmp =~ s/\]/&rsqb;/g;
		$tmp =~ s/\^//g;

		$footnotes{$i} = $tmp;
		
}


# Now we must check a couple of things first. The title and where to start
# section levels, and tables, Therefore we poure througe the whole file until we
# find something usefull.

$hone = 0;
$htwo = 0;

$intable = nej;
$nrtable = 0;
$nrrow = 0;

LOOP:
while (<html>) {
	if ($_ =~/\<TITLE\>([^\<]*)/i) {
		print sgml "<title>$1\n";
	}
	if ($_ =~/\<H1.*?\>/i) {
		$hone++;
	
	    }
    
	# We have to count tables and the amount of coloumns in them
	if ($_=~/<TABLE.*?>/i) {
	    $intable = ja;
	    $nrtable++;
	}
	if ($intable eq ja) {
	    if ($_=~/<TR.*?>/) {
		$nrrow++;
	    }
	    if ($nrrow == 1) {
		if (/<\/TD.*?>/) {
		    $table{$nrtable} = "$table{$nrtable}" . "l";
		}
	    }
	}
	
	if ($_=~/<\/TABLE.*?>/) {
	    $intable = nej;
	    $nrrow = 0;
	}
    }
if ($hone > 1 ) {
	$sect = H1;
} else {
	$sect = H2;
}
    
close html;

$nrtable = 0;
$intable = nej;

# Lets first write I couple of thing we probably cant figure out
# Would be good if we could figure out the name of the writer
# Perhaps ask for one?
print sgml <<'End_off_sub';
<author>You name
<date>
<abstract>
</abstract>
<toc>
End_off_sub

# Now we can start the real substitution, the order of the substitution is
# in some cases realy important
open (html, $htmlfile);

$inquote = nej;
$inverb = nej;
$nrfootnotes = 0;
while (<html>) {
	
	# must be first for sake of footnotes	
    
    	s/<FONT.*?>|<\/FONT>//gi;
    
    	# footnotes, as they are converted in Applix aw->html
	if (/<SUP>|<\/SUP>/) {
		# grab all footnotes on the current line
		while (/<SUP>[0-9]+/) {
			$nrfootnotes++;
			$putin = $footnotes{$nrfootnotes};
			s/<SUP>[0-9]+/<footnote>$putin<\/footnote>/;
		}
		# if foonotenumber noot on the same line as <SUP>
		while (/[0-9]+<\/SUP>/) {
			$nrfootnotes++;
			$putin = $footnotes{$nrfootnotes};
			s/[0-9]+<\/SUP>/<footnote>$putin<\/footnote>/;
		}
	}
	
	
	# Things to remowe
	s/<SUP>|<\/SUP>//gi;
	s/<HTML>|<\/HTML>//gi;
	s/<HEAD>|<\/HEAD>//gi;
	s/<TITLE>((.*<\/TITLE>)|(.*$))//gi;
	s/<\/TITLE>//gi;
	s/<HR>//gi;
	s/<U>|<\/U>//gi;
	s/<BODY.*?>|\<\/BODY>//gi;
	s/[0-9]*<\/SUP>//gi;
	s/<TT>|<\/TT>//gi;
	s/<SAMP>|<\/SAMP>//gi;
	
	s/<CENTER>|<\/CENTER>//gi;
	s/<ADDRESS>|<\/ADDRESS>//gi;
	s/<P\s.*?>//gi;
	
	
	#things to substitute
	
	# fist sectionlevel
	# first ones that has no meaning, remove them
	 s/<H1><\/H1>//gi;
	 s/<H2><\/H2>//gi;
	 s/<H3><\/H3>//gi;
	 s/<H4><\/H4>//gi;
	 s/<H5><\/H5>//gi;
	if ($sect eq H1) {
	    s/<H1.*?>/<sect>/gi;
	    s/<\/H1>/\n<p>/gi;
	    s/<H2.*?>/<sect1>/gi;
	    s/<\/H2>/\n<p>/gi;
	    s/<H3.*?>/<sect2>/gi;
	    s/<\/H3>/\n<p>/gi;
	    s/<H4.*?>/<sect3>/gi;
	    s/<\/H4>/\n<p>/gi;
	    s/<H5.*?>/<sect4>/gi;
	    s/<\/H5>/\n<p>/gi;
	} else {
	    s/<H2.*?>/<sect>/gi;
	    s/<\/H2>/\n<p>/gi;
	    s/<H3.*?>/<sect1>/gi;
	    s/<\/H3>/\n<p>/gi;
	    s/<H4.*?>/<sect2>/gi;
	    s/<\/H4>/\n<p>/gi;
	    s/<H5.*?>/<sect3>/gi;
	    s/<\/H5>/\n<p>/gi;
	    }
	
	# lets take al one to one things
	s/<BR>//gi;
	s/<UL>/<itemize>/gi;
	s/<\/UL>/<\/itemize>/gi;
	s/<OL>/<enum>/gi;
	s/<\/OL>/<\/enum>/gi;
	s/<DIR>/<itemize>/gi;
	s/<\/DIR>/<\/itemize>/gi;

	# Does not generate good results
	s/<DL.*?>/<descrip>/gi;
	s/<\/DL>/<\/descrip>/gi;
	s/<DT>/<tag>/gi;
	s/<DD>/<\/tag>/gi;
	
	s/<LI>/<item>/gi;
	s/<\/LI>/<\/item>/gi;
	s/<LQ>/<lq>/gi;
	s/<\/LQ>/<\/lq>/gi;
	s/<EM>/<em>/g;
	s/<\/EM>/<\/em>/g;
	s/<CITE>/<em>/gi;
	s/<\/CITE>/<\/em>/gi;
	s/<B>/<bf>/gi;
	s/<\/B>/<\/bf>/gi;
	s/<STRONG>/<bf>/gi;
	s/<\/STRONG>/<\/bf>/gi;
	s/<I>/<it>/gi;
	s/<\/I>/<\/it>/gi;
	s/<SF>/<sf>/g;
	s/<\/SF>/<\/sf>/g;
	s/<CODE>/<tt>/gi;
	s/<\/CODE>/<\/tt>\n/gi;
	s/<PRE>/<tscreen><verb>/gi;
	
	# \n taken away from ending if tscreen
	s/<\/PRE>/<\/verb><\/tscreen>/gi;
	s/<MC>/<mc>/gi;
	s/<\/MC>/<\/mc>/gi;
	s/&quot;/''/gi;
	s/<DFN>/<tt>/gi;
	s/<\/DFN>/<\/tt>/gi;
	
	# To prevent norty things to happend i latex
	s/``/''/g;
	
	s/&#60;/&lt;/g;
	s/&#62;/&gt;/g;
	s/&#38;/&amp;/gi;
	
	
	# we have to do special things inside verb and quote
	if (/\<tscreen\>\<verb>/) {
	    $inverb = ja;
	}
	
	if (/\<\/verb\>\<\/tscreen\>/) {
	    $inverb = nej;
	}
	
	# quote does not like empty rows
	if (/\<BLOCKQUOTE\>/i) {
	    $inquote = ja;
	    s/<BLOCKQUOTE>/<quote>/gi;
	}
	if (/\<\/BLOCKQUOTE\>/i) {
	    $inquote = nej;
	    s/<\/BLOCKQUOTE>/<\/quote>/gi;
	}
	

	
	#table - hm...probably only works for applix,
	# to work with sgml2html, change tabular to table in mapping
	if ($_=~/<TABLE.*?>/i) {
	    $nrtable++;
	    s/<TABLE.*>?/<tabular ca=\"$table{$nrtable}\">/gi;
	}
	s/<TR.*?>//gi;
	s/<\/TD><\/TR>/<rowsep>/gi;
	s/<TD.*?>//gi;
	s/<\/TD>/<colsep>/gi;
	if ($_=~/<\/TABLE.*?>/i) {
	    s/<\/TABLE>/<\/tabular>/gi;
	}


	#urls - pure url does not produce god looking formats - use htmlurl for all
	s/<A\sNAME=\"(.*)\">?(.*)<\/A>/\2<label id=\"\1\">/gi;
	s/<A\sNAME=(.*?)>(.*?)<\/A>/\2<label id=\"\1\">/gi;
	s/<A\sHREF=\"#([^\"]*)\">?(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;;
	s/<A\sHREF=\"([^\"]*)\">?(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;
	s/<A\sHREF=\"([^\"]*)\">?(.*?)$/<htmlurl url=\"\1\" name=\"\2\">/gi;
	
	# pure formaters dont use quotes
	s/<A\sHREF=#([^\"]*?)>(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;;
	s/<A\sHREF=([^\"]*?)>(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;
	s/<A\sHREF=([^\"]*?)>(.*?)$/<htmlurl url=\"\1\" name=\"\2\">/gi;
	# img - makes a eps-img, will only convert gifs
	if ($_=~/\<IMG.*?SRC=([^>]*?)\.([^>]*?)>/i) {
				      
		$img = $1;
		$img =~ s/\"//g;
		$ext = $2;
		$ext =~ s/\"//g;
		s/<IMG.*?SRC=[^>]*?>/<figure>\n<eps file=\"$img\">\n<\/figure>/gi;
		 # save the pics
		push(@pics, "$img.$ext");
				   
	}
	
				  
	# remove stale things
	s/<\/A>//gi;	
			   
	# Fix smlish away from verb-env, should be more...
	if ($inverb eq ja) {

	    if (!/<quote>|<tscreen><verb>|<footnote>|<\/footnote>/) {
		s/<.*?>|<\/.*?>//gi;
		s/&gt;/>/gi;
		s/&lt;/</gi;
		s/&lsqb;/\[/g;
		s/&rsqb;/\]/g;
		s/&amp;/&ero;/gi;
		
		# iso-char have to be iso-char in verb
		# not all implemented
		s/&Auml;/Ä/g;
		s/&Aring;/Å/g;
		s/&Egrave;/È/g;
		s/&Eacute;/É/g;
		s/&Ouml;/Ö/g;
		s/&auml;/ä/g;
		s/&aring;/å/g;
		s/&egrave;/è/g;
		s/&eacute;/é/g;
		s/&ouml;/ö/g;    
	    }
	    
				      
# Dont know if this should realy be here, taken away for jargon
	    s/(\n)\n/\1/g;
	}

	# special macro-conversion
	if ($inverb eq nej) {
		s/\$/&dollar;/gi;
		s/([^&])#/\1&num;/gi;
		s/%/&percnt;/gi;
		s/~/&tilde;/gi;
		s/\\/&bsol;/gi;
		s/\[/&lsqb;/g;
		s/\]/&rsqb;/g;
		s/\^/&circ;/g;
		s/_/&lowbar;/g;
	
			       }
			       
	if ($inquote eq ja) {
		s/^\n//gi;
	    }		       
	
	s/<P>|^<\/P>$//g;
	
	if ($inquote eq nej) {
	
		s/<\/P>/\n/gi;
	} else {
		s/<\/P>//gi;
	}
	
	
	if ($inquote eq ja) {
		if (/^\s*$/) {
			# Dont do anything, just remove empty lines from quotes
		} else {
	    		print sgml;
	    	}
	} else {	  
		print sgml;
	}
			      
}
print sgml "</article>";
close sgml;

# convert any gifs (needs programs: giftopnm, ppptopgm and pnmtops) to ps
while (<@pics>) {
	if (-e "$_"){
		($name, $ex) = split(/\./, $_);
		`giftopnm $_ | ppmtopgm | pnmtops -noturn > $name.ps`;
	}
}

exit





html2sgml-0.3/html2sgml.in100755    765    765       27333  6400543065  14276 0ustar  peterpeter# html2sgml - converts html-filese to
# v 0.3
# Rude script to convert a html-file to a sgml-file in a format
# suitabel for linuxdoc-sgml. See html2sgml.1 for ducumentation.
# (c) Peter Antman, 1997.
# send bug reports to:
# peter.antman@abc.se
#
#
# 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.
#



$THISPROG = "html2sgml 0.3";


$usage = "usage: html2sgml fil.html";

die $usage if @ARGV < 1;
$htmlfile = shift (@ARGV);

$htmlfile =~ /([\S]*?)\.html/ or die "Could not figure out postfix for filename: $!\n";
$filename = $1;
$sgmlfile = "$filename.sgml";

open (html, $htmlfile);
open (sgml, ">$sgmlfile");


# Make sgml-header
print sgml <<'End_off';
<!--Converted to sgml with html2sgml-->
<!doctype linuxdoc system>
<article>
End_off

# If we can find an applix-world file in the same directory with
# the same name: try to get footnotes

if (-e "$filename.aw") {
    open (aw, "$filename.aw");
    
    $nrfootnotes = 0;
    $start_note = nej;
    $inT = nej;
    while (<aw>) {
    
    	# Find all fotnotes and their number and sequensnumber
	
	if (/^<S_F.*?footnote\s\"(\d*)\">$/) {
		$number = $1;    
		$nrfootnotes++;
	    	$tmpftn{$number} = "$nrfootnotes";
	
	}
	
	# What footnote are we taking the content from
	if (/^<start_footnote\s\"(\d*)\">$/) {
	    $whichnote = $1;
	    $start_note = ja;
	}
	
	# En open footnote
	if (/^<end_footnote>$/) {
	    $start_note = nej;
	}
	
	# Grab the content
	if ($start_note eq ja) {
	    if (!((/footnote_body/) or (/<T.*?position/) or (/<Symbol/))) {
	    	
		# citations in footnotes are tricky in converted docs
		s/\\\"/''/g;
		
	    	# special rutin to handle long footnotes
	    	# this is done only when foonote was not ended in first round
	    	if ($inT eq ja) {

	    		if (/(^[\s]+.*?\\)|(^[\s]+.*?>)/) {
	    			s/\\//g;
	    			s/^\s//g;
	    			s/\n//g;
	    			
	    			
	    			if (/.*?>/) {
	    			
	    				$tmpharb = "$tmpharb" . "$_";
	    				if ($tmpharb =~ /italic/) {
	    					$tmpharb =~ s/\"\s.*?>//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "<it>$tmpharb</it>";
	    				} elsif ($tmpharb =~ /bold/) {
	    					$tmpharb =~ s/\"\s.*?>//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "<bf>$tmpharb</bf>";
	    				} else {
	    					$tmpharb =~ s/\".*?>$//;
	    					$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "$tmpharb";
	    				}
	    				
	    				$inT = nej;
	    			} else {
	    				$tmpharb = "$tmpharb" . "$_";
	    			}
	    		}
	    	}
	    	
	    	# The real footnotecontent
	    
		if (/(<T\s\"(.*)\"(.*)$)|(<T\s\"(.*)[^\"]\\)/) {
			# Footnotes have three formats
			# 1) <T "CONTENT">
			# 2) <T "CONTENT" TAG>
			# 3) <T "CONTENT\
			# Hm, and
			# 4) <T "CONTENT"\ TAG>
			if (/<T\s\"([^\"]+)\"(.*)>$/) {
				$cont = $1;
				$cont =~ s/\\//g;
		
				$it = $2;
				
				if (/italic/) {
		    		$cont = "<it>$cont</it>";
				}
		
				if (/bold/) {
				$cont = "<bf>$cont</bf>";
				}
		

		
				$footnotes{$tmpftn{$whichnote}} = "$footnotes{$tmpftn{$whichnote}}" . "$cont";
			}
			if (/<T\s\"(.*?)\\$/) {
			# Ok we are in a long footnote, wich is difficult
			# It may not even be the hole footnote, just a
			# special formated piece of it.
				$cont = $1;
				$cont =~ s/\\//g;
			# Have to harbour it temporary
				$tmpharb = ();
				$tmpharb = $cont;	
				$inT = ja;
				
			}
		

	    	}
	}
	}
	}
	
}
close aw;

# Sorry we have to do this, but othervise we might get norty chars
# in footnotes; I have only converted chars of interest to mee. 
# Others have to fill in with other 8-bit chars
for ($i = 1; $i <= $nrfootnotes; $i++) {
		$tmp = "$footnotes{$i}";
		$tmp =~ s/\&/&amp;/g;
	    	$tmp =~ s/\^[\s]*of/&aring;/g;
		$tmp =~ s/\^[\s]*pg/&ouml;/g;
		$tmp =~ s/\^[\s]*oe/&auml;/g;
		
		$tmp =~ s/\^[\s]*mf/&Aring;/g;
		$tmp =~ s/\^[\s]*me/&Auml;/g;
		$tmp =~ s/\^[\s]*ng/&Ouml;/g;
		$tmp =~ s/\^[\s]*mj/&Eacute;/g;
		$tmp =~ s/\^[\s]*mi/&Egrave;/g;
		$tmp =~ s/\^[\s]*oj/&eacute;/g;
		$tmp =~ s/\^[\s]*oi/&egrave;/g;
		$tmp =~ s/\^[\s]*ni/&Oslash;/g;
		$tmp =~ s/\^[\s]*pi/&oslash;/g;
		$tmp =~ s/\^[\s]*nm/&Uuml;/g;
		$tmp =~ s/\^[\s]*pm/&uuml;/g;
		$tmp =~ s/\^[\s]*kh/§/g;
		$tmp =~ s/\[/&lsqb;/g;
		$tmp =~ s/\]/&rsqb;/g;
		$tmp =~ s/\^//g;

		$footnotes{$i} = $tmp;
		
}


# Now we must check a couple of things first. The title and where to start
# section levels, and tables, Therefore we poure througe the whole file until we
# find something usefull.

$hone = 0;
$htwo = 0;

$intable = nej;
$nrtable = 0;
$nrrow = 0;

LOOP:
while (<html>) {
	if ($_ =~/\<TITLE\>([^\<]*)/i) {
		print sgml "<title>$1\n";
	}
	if ($_ =~/\<H1.*?\>/i) {
		$hone++;
	
	    }
    
	# We have to count tables and the amount of coloumns in them
	if ($_=~/<TABLE.*?>/i) {
	    $intable = ja;
	    $nrtable++;
	}
	if ($intable eq ja) {
	    if ($_=~/<TR.*?>/) {
		$nrrow++;
	    }
	    if ($nrrow == 1) {
		if (/<\/TD.*?>/) {
		    $table{$nrtable} = "$table{$nrtable}" . "l";
		}
	    }
	}
	
	if ($_=~/<\/TABLE.*?>/) {
	    $intable = nej;
	    $nrrow = 0;
	}
    }
if ($hone > 1 ) {
	$sect = H1;
} else {
	$sect = H2;
}
    
close html;

$nrtable = 0;
$intable = nej;

# Lets first write I couple of thing we probably cant figure out
# Would be good if we could figure out the name of the writer
# Perhaps ask for one?
print sgml <<'End_off_sub';
<author>You name
<date>
<abstract>
</abstract>
<toc>
End_off_sub

# Now we can start the real substitution, the order of the substitution is
# in some cases realy important
open (html, $htmlfile);

$inquote = nej;
$inverb = nej;
$nrfootnotes = 0;
while (<html>) {
	
	# must be first for sake of footnotes	
    
    	s/<FONT.*?>|<\/FONT>//gi;
    
    	# footnotes, as they are converted in Applix aw->html
	if (/<SUP>|<\/SUP>/) {
		# grab all footnotes on the current line
		while (/<SUP>[0-9]+/) {
			$nrfootnotes++;
			$putin = $footnotes{$nrfootnotes};
			s/<SUP>[0-9]+/<footnote>$putin<\/footnote>/;
		}
		# if foonotenumber noot on the same line as <SUP>
		while (/[0-9]+<\/SUP>/) {
			$nrfootnotes++;
			$putin = $footnotes{$nrfootnotes};
			s/[0-9]+<\/SUP>/<footnote>$putin<\/footnote>/;
		}
	}
	
	
	# Things to remowe
	s/<SUP>|<\/SUP>//gi;
	s/<HTML>|<\/HTML>//gi;
	s/<HEAD>|<\/HEAD>//gi;
	s/<TITLE>((.*<\/TITLE>)|(.*$))//gi;
	s/<\/TITLE>//gi;
	s/<HR>//gi;
	s/<U>|<\/U>//gi;
	s/<BODY.*?>|\<\/BODY>//gi;
	s/[0-9]*<\/SUP>//gi;
	s/<TT>|<\/TT>//gi;
	s/<SAMP>|<\/SAMP>//gi;
	
	s/<CENTER>|<\/CENTER>//gi;
	s/<ADDRESS>|<\/ADDRESS>//gi;
	s/<P\s.*?>//gi;
	
	
	#things to substitute
	
	# fist sectionlevel
	# first ones that has no meaning, remove them
	 s/<H1><\/H1>//gi;
	 s/<H2><\/H2>//gi;
	 s/<H3><\/H3>//gi;
	 s/<H4><\/H4>//gi;
	 s/<H5><\/H5>//gi;
	if ($sect eq H1) {
	    s/<H1.*?>/<sect>/gi;
	    s/<\/H1>/\n<p>/gi;
	    s/<H2.*?>/<sect1>/gi;
	    s/<\/H2>/\n<p>/gi;
	    s/<H3.*?>/<sect2>/gi;
	    s/<\/H3>/\n<p>/gi;
	    s/<H4.*?>/<sect3>/gi;
	    s/<\/H4>/\n<p>/gi;
	    s/<H5.*?>/<sect4>/gi;
	    s/<\/H5>/\n<p>/gi;
	} else {
	    s/<H2.*?>/<sect>/gi;
	    s/<\/H2>/\n<p>/gi;
	    s/<H3.*?>/<sect1>/gi;
	    s/<\/H3>/\n<p>/gi;
	    s/<H4.*?>/<sect2>/gi;
	    s/<\/H4>/\n<p>/gi;
	    s/<H5.*?>/<sect3>/gi;
	    s/<\/H5>/\n<p>/gi;
	    }
	
	# lets take al one to one things
	s/<BR>//gi;
	s/<UL>/<itemize>/gi;
	s/<\/UL>/<\/itemize>/gi;
	s/<OL>/<enum>/gi;
	s/<\/OL>/<\/enum>/gi;
	s/<DIR>/<itemize>/gi;
	s/<\/DIR>/<\/itemize>/gi;

	# Does not generate good results
	s/<DL.*?>/<descrip>/gi;
	s/<\/DL>/<\/descrip>/gi;
	s/<DT>/<tag>/gi;
	s/<DD>/<\/tag>/gi;
	
	s/<LI>/<item>/gi;
	s/<\/LI>/<\/item>/gi;
	s/<LQ>/<lq>/gi;
	s/<\/LQ>/<\/lq>/gi;
	s/<EM>/<em>/g;
	s/<\/EM>/<\/em>/g;
	s/<CITE>/<em>/gi;
	s/<\/CITE>/<\/em>/gi;
	s/<B>/<bf>/gi;
	s/<\/B>/<\/bf>/gi;
	s/<STRONG>/<bf>/gi;
	s/<\/STRONG>/<\/bf>/gi;
	s/<I>/<it>/gi;
	s/<\/I>/<\/it>/gi;
	s/<SF>/<sf>/g;
	s/<\/SF>/<\/sf>/g;
	s/<CODE>/<tt>/gi;
	s/<\/CODE>/<\/tt>\n/gi;
	s/<PRE>/<tscreen><verb>/gi;
	
	# \n taken away from ending if tscreen
	s/<\/PRE>/<\/verb><\/tscreen>/gi;
	s/<MC>/<mc>/gi;
	s/<\/MC>/<\/mc>/gi;
	s/&quot;/''/gi;
	s/<DFN>/<tt>/gi;
	s/<\/DFN>/<\/tt>/gi;
	
	# To prevent norty things to happend i latex
	s/``/''/g;
	
	s/&#60;/&lt;/g;
	s/&#62;/&gt;/g;
	s/&#38;/&amp;/gi;
	
	
	# we have to do special things inside verb and quote
	if (/\<tscreen\>\<verb>/) {
	    $inverb = ja;
	}
	
	if (/\<\/verb\>\<\/tscreen\>/) {
	    $inverb = nej;
	}
	
	# quote does not like empty rows
	if (/\<BLOCKQUOTE\>/i) {
	    $inquote = ja;
	    s/<BLOCKQUOTE>/<quote>/gi;
	}
	if (/\<\/BLOCKQUOTE\>/i) {
	    $inquote = nej;
	    s/<\/BLOCKQUOTE>/<\/quote>/gi;
	}
	

	
	#table - hm...probably only works for applix,
	# to work with sgml2html, change tabular to table in mapping
	if ($_=~/<TABLE.*?>/i) {
	    $nrtable++;
	    s/<TABLE.*>?/<tabular ca=\"$table{$nrtable}\">/gi;
	}
	s/<TR.*?>//gi;
	s/<\/TD><\/TR>/<rowsep>/gi;
	s/<TD.*?>//gi;
	s/<\/TD>/<colsep>/gi;
	if ($_=~/<\/TABLE.*?>/i) {
	    s/<\/TABLE>/<\/tabular>/gi;
	}


	#urls - pure url does not produce god looking formats - use htmlurl for all
	s/<A\sNAME=\"(.*)\">?(.*)<\/A>/\2<label id=\"\1\">/gi;
	s/<A\sNAME=(.*?)>(.*?)<\/A>/\2<label id=\"\1\">/gi;
	s/<A\sHREF=\"#([^\"]*)\">?(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;;
	s/<A\sHREF=\"([^\"]*)\">?(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;
	s/<A\sHREF=\"([^\"]*)\">?(.*?)$/<htmlurl url=\"\1\" name=\"\2\">/gi;
	
	# pure formaters dont use quotes
	s/<A\sHREF=#([^\"]*?)>(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;;
	s/<A\sHREF=([^\"]*?)>(.*?)<\/A>/<htmlurl url=\"\1\" name=\"\2\">/gi;
	s/<A\sHREF=([^\"]*?)>(.*?)$/<htmlurl url=\"\1\" name=\"\2\">/gi;
	# img - makes a eps-img, will only convert gifs
	if ($_=~/\<IMG.*?SRC=([^>]*?)\.([^>]*?)>/i) {
				      
		$img = $1;
		$img =~ s/\"//g;
		$ext = $2;
		$ext =~ s/\"//g;
		s/<IMG.*?SRC=[^>]*?>/<figure>\n<eps file=\"$img\">\n<\/figure>/gi;
		 # save the pics
		push(@pics, "$img.$ext");
				   
	}
	
				  
	# remove stale things
	s/<\/A>//gi;	
			   
	# Fix smlish away from verb-env, should be more...
	if ($inverb eq ja) {

	    if (!/<quote>|<tscreen><verb>|<footnote>|<\/footnote>/) {
		s/<.*?>|<\/.*?>//gi;
		s/&gt;/>/gi;
		s/&lt;/</gi;
		s/&lsqb;/\[/g;
		s/&rsqb;/\]/g;
		s/&amp;/&ero;/gi;
		
		# iso-char have to be iso-char in verb
		# not all implemented
		s/&Auml;/Ä/g;
		s/&Aring;/Å/g;
		s/&Egrave;/È/g;
		s/&Eacute;/É/g;
		s/&Ouml;/Ö/g;
		s/&auml;/ä/g;
		s/&aring;/å/g;
		s/&egrave;/è/g;
		s/&eacute;/é/g;
		s/&ouml;/ö/g;    
	    }
	    
				      
# Dont know if this should realy be here, taken away for jargon
	    s/(\n)\n/\1/g;
	}

	# special macro-conversion
	if ($inverb eq nej) {
		s/\$/&dollar;/gi;
		s/([^&])#/\1&num;/gi;
		s/%/&percnt;/gi;
		s/~/&tilde;/gi;
		s/\\/&bsol;/gi;
		s/\[/&lsqb;/g;
		s/\]/&rsqb;/g;
		s/\^/&circ;/g;
		s/_/&lowbar;/g;
	
			       }
			       
	if ($inquote eq ja) {
		s/^\n//gi;
	    }		       
	
	s/<P>|^<\/P>$//g;
	
	if ($inquote eq nej) {
	
		s/<\/P>/\n/gi;
	} else {
		s/<\/P>//gi;
	}
	
	
	if ($inquote eq ja) {
		if (/^\s*$/) {
			# Dont do anything, just remove empty lines from quotes
		} else {
	    		print sgml;
	    	}
	} else {	  
		print sgml;
	}
			      
}
print sgml "</article>";
close sgml;

# convert any gifs (needs programs: giftopnm, ppptopgm and pnmtops) to ps
while (<@pics>) {
	if (-e "$_"){
		($name, $ex) = split(/\./, $_);
		`giftopnm $_ | ppmtopgm | pnmtops -noturn > $name.ps`;
	}
}

exit





html2sgml-0.3/extras/ 40775    765    765           0  6400307535  13215 5ustar  peterpeterhtml2sgml-0.3/extras/merg100755    765    765        2332  6400307406  14165 0ustar  peterpeter#!/usr/bin/perl
# merg htlm-pages into one. Given as arg-list
$utfil = "htmlmerg.html";

if (-e "$utfil") {
	die "filen htmlmerg.html existerar redan";
    } else {
    	
    	    open (ut, ">>$utfil");
#print ut <<'End_off';
print ut "<HTML>\n";
print ut "<HEAD>\n";
print ut "<TITLE></TITLE>\n";
print ut "</HEAD>\n";
print ut "<BODY>\n";
#End_off
    }
    
    
$inhead = nej;
$infoot = nej;
$intable = nej;
while (<>) {
	if (/<HTML>/i) {
		$inhead = ja;
	}
	if (/<BODY.*?>/i) {
		s/.*?<BODY.*?>//gi;
		$inhead = nej;	
	}
	if (/<\/BODY>/i) {
		$infoot = ja;
		if (/<\/HTML>/i) {
			$infoot = nej;
			s/.*<\/HTML>//gi;
		}
		s/<\/BODY>.*//gi;
		print ut;
		
	}
	if (/<\/HTML>/i) {
		s/.*<\/HTML>.*$//ig;
		$infoot = nej;
	}
	
	
	if (($inhead eq ja) or ($infoot eq ja)){
	
	} else {
		s/^.*?>previous<.*$//i;
		s/^.*?>next<.*$//i;
		s/^.*?>\ssection.<.*$//i;
		s/\t*//g;
		s/<!.*$//gi;
		s/^.*-->//gi;
		
		s/å/&aring;/g;
		s/ä/&ouml;/g;
		s/ö/&auml;/g;
		
		s/Å/&Aring;/g;
		s/Ä/&Auml;/g;
		s/Ö/&Ouml;/g;
		
		s/(<H\d*>).*\">(.*?)<\/A>/\1\2/gi;
		if (!/<H\d*>/) {
			s/^>(.*<\/H\d*>)/\1/gi;
		}
		s/^(.+)<A\s/\1\n<A /gi;
		s/(HREF=\").*?(#[a-zA-A0-9]*\")/\1\2/gi;
		
		print ut;
		}
}
print ut "</BODY>\n";
print ut "</HTML>\n";
close ut;
html2sgml-0.3/extras/jargonmerg100755    765    765        2434  6400307412  15366 0ustar  peterpeter#!/usr/bin/perl
# merg htlm-pages into one. Given as arg-list
$utfil = "htmlmerg.html";

if (-e "$utfil") {
	die "filen htmlmerg.html existerar redan";
    } else {
    	
    	    open (ut, ">>$utfil");
#print ut <<'End_off';
print ut "<HTML>\n";
print ut "<HEAD>\n";
print ut "<TITLE></TITLE>\n";
print ut "</HEAD>\n";
print ut "<BODY>\n";
#End_off
    }
    
    
$inhead = nej;
$infoot = nej;
$intable = nej;
while (<>) {
	if (/<HTML>/i) {
		$inhead = ja;
	}
	if (/<BODY.*?>/i) {
		s/.*?<BODY.*?>//gi;
		$inhead = nej;	
	}
	if (/<\/BODY>/i) {
		$infoot = ja;
		s/<\/BODY>.*//gi;
		print ut;
		
	}
	if (/<\/HTML>/i) {
		s/.*<\/HTML>.*$//ig;
		$infoot = nej;
	}
	
	if (/<TABLE.*?>/i) {
		$intable = ja;
	}
	if (/<\/TABLE.*?>/i) {
		$intable = nej;
		s/.*?<\/TABLE.*?>//gi;
	}
	if (($inhead eq ja) or ($infoot eq ja) or ($intable eq ja)){
	
	} else {
		s/^.*?>previous<.*$//i;
		s/^.*?>next<.*$//i;
		s/^.*?>\ssection.<.*$//i;
		s/\t*//g;
		s/<!.*$//gi;
		s/^.*-->//gi;
		
		s/å/&aring;/g;
		s/ä/&ouml;/g;
		s/ö/&auml;/g;
		
		s/Å/&Aring;/g;
		s/Ä/&Auml;/g;
		s/Ö/&Ouml;/g;
		
		s/(<H\d*>).*\">(.*?)<\/A>/\1\2/gi;
		if (!/<H\d*>/) {
			s/^>(.*<\/H\d*>)/\1/gi;
		}
		s/^(.+)<A\s/\1\n<A /gi;
		s/(HREF=\").*?(#[a-zA-A0-9]*\")/\1\2/gi;
		
		print ut;
		}
}
print ut "</BODY>\n";
print ut "</HTML>\n";
close ut;
html2sgml-0.3/extras/htmlmerg100755    765    765        1621  6400307402  15046 0ustar  peterpeter#!/usr/bin/perl
# merg htlm-pages into one. Given as arg-list
$utfil = "htmlmerg.html";

if (-e "$utfil") {
	die "filen htmlmerg.html existerar redan";
    } else {
    	
    	    open (ut, ">>$utfil");
#print ut <<'End_off';
print ut "<HTML>\n";
print ut "<HEAD>\n";
print ut "<TITLE></TITLE>\n";
print ut "</HEAD>\n";
print ut "<BODY>\n";
#End_off
    }
$inhead = nej;
$infoot = nej;
$intable = nej;
while (<>) {
	if (/<HTML>/i) {
		$inhead = ja;
	}
	if (/<BODY.*?>/i) {
		s/.*?<BODY.*?>//gi;
		$inhead = nej;	
	}
	if (/<\/BODY>/i) {
		$infoot = ja;
		s/<\/BODY>.*//gi;
		print ut;
		
	}
	if (/<\/HTML>/i) {
		s/.*<\/HTML>.*$//ig;
		$infoot = nej;
	}
	
	if (/<TABLE.*?>/i) {
		$intable = ja;
	}
	if (/<\/TABLE.*?>/i) {
		$intable = nej;
		s/.*?<\/TABLE.*?>//gi;
	}
	if (($inhead eq ja) or ($infoot eq ja) or ($intable eq ja)){
	
	} else {
		print ut;
		}
}
print ut "</BODY>\n";
print ut "</HTML>\n";
close ut;
html2sgml-0.3/mkbook.in100755    765    765        2556  6400524415  13625 0ustar  peterpeter# Rude script to convert a html-file to a sgml-file in a format
# suitabel for linuxdoc-sgml
# (c) Peter Antman, 1997.
#
# 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.
#

$THISPROG = "mkbook 0.1";


$usage = "usage: mkbook fil.sgml";

#print "hej";

die $usage if @ARGV < 1;
$sgmlfile = shift (@ARGV);

$sgmlfile =~ /([\S]*?)\.sgml/;
$filename = $1;
$bookfile = "$filename-book.sgml";
print "$bookfile";
open (sgml, $sgmlfile);
open (book, ">$bookfile");

while (<sgml>) {
	s/<article>/<book>/gi;
	s/<\/article>/<\/book>/gi;
	
	s/<sect>/<chapt>/gi;
	s/<sect1>/<sect>/gi;
	s/<sect2>/<sect1>/gi;
	s/<sect3>/<sect2>/gi;
	s/<sect4>/<sect3>/gi;
	s/<sect5>/<sect4>/gi;

#	s/<abstract>|<\/abstract>//gi;
#	print;
	print book;
}

close book;
html2sgml-0.3/README100664      0      0        3325  6400545171  12233 0ustar  rootroot  html2sgml documentation
  Peter Antman
  Tue Aug 26 12:26:46 MET DST 1997

  11..  RREEAADDMMEE

  html2sgml is a program wich converts html to sgml accroding to
  linuxdoc.sgml.  With a file in linuxdoc.dtd format you can create nice
  typset books, well structured html-documents and so forth.
  linuxdoc.dtd is the format used in Linux HOWTOS, for example.

  html2sgml i tuned to work well with Applix HTML, and will convert any
  footnotes apearent in the applix word-file that was used to produce
  the html.

  To use html2sgml you need Perl. To use the image converting routines
  you also need: giftopnm, ppmtopgm and pnmtops

  To do something usefull with the resulting file you also need
  linuxdoc-sgml or the follow up sgml-tools
  http://www.xs4all.nl/~cg/sgmltools/.

  11..11..  GGeettttiinngg hhttmmll22ssggmmll

  The homepage of html2sgml is
  http://www.abc.se/~m9339/prog/html2sgml.html It is possible to ftp it
  from ftp://ftp.mc.hik.se/pub/users/mia95anp/html2sgml/.  It has also
  been upploded to ftp://ftp.redhat.com and
  ftp://sunsite.unc.edu/pub/linux/.

  11..22..  IInnssttaallllaattiioonn

  To install html2sgml unpack the tarfile and cd into the disrtibution.
  Type

  make install

  It will install the programs html2sgml and mkbook, som files in the
  specified documentdirectory, including _e_x_t_r_a_s a couple of script that
  shows some examples of how you can merg severall html-files into one
  to use with html2sgml.  A manual page will be installed too.

  Edit the makefile to change where to install and where Perl is on your
  system.  The default is /usr/bin/perl and prefix = /usr/local

  11..33..  UUssaaggee

  See the manual page

html2sgml-0.3/COPYING100644      0      0       43114  6400542235  12422 0ustar  rootroot		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    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.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19yy name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2009 MARUHN Internet Solutions