Update to the html-export code. HTML is not yet support in custom export, so

somebody interested in this will have to do it. Read ChangeLog for a few other changes.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@274 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-11-02 16:41:28 +00:00
parent 0a6d08dc50
commit b04ba1da11
11 changed files with 137 additions and 36 deletions

View File

@ -1,3 +1,30 @@
1999-11-02 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/support/lyxstring.C (find): remove bogus assertion in the
two versions of find where this has not been done yet.
* src/support/lyxlib.h: add missing int return type to
lyx::chdir().
* src/menus.C (ShowFileMenu): disable exporting to html if no
html export command is present.
* config/lib_configure.m4: add a test for an HTML converter. The
programs checked for are, in this order: tth, latex2html and
hevea.
* lib/configure: generated from config/lib_configure.m4.
* src/lyxfunc.C (Dispatch): update and improve the execution of an
html converter. The parameters are now passed through $$FName and
$$OutName, instead of standard input/output.
* src/lyxrc.{C,h}: rename \tth_command to \html_command.
* lib/lyxrc.example: update description of \html_command.
add "quotes" around \screen_font_xxx font setting examples to help
people who use fonts with spaces in their names.
1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org> 1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* Distribution files: updates for v1.1.2 * Distribution files: updates for v1.1.2

13
NEWS
View File

@ -1,12 +1,17 @@
What's new in LyX version 1.1.2? What's new in LyX version 1.1.2?
-------------------------------- --------------------------------
LyX 1.1.2 is a minor upgrade to 1.1.1, only a couple of semi-serious LyX 1.1.2 is a minor upgrade to 1.1.1, only one new feature has been added:
bugs have been fixed:
- a bug that casued a crash in lyxstring::find - the export to html feature has been extended to use other programs.
Currently, tth, latex2html and hevea are supported. Note that the
variable \tth_command has been renamed to \html_command in lyxrc.
- the annoying '-' vs. '_' bug. Moreover, a couple of semi-serious bugs have been fixed:
- a bug that caused a crash in lyxstring::find
- the annoying '-' vs. '_' bug.
Also the cheaders files was missing from the 1.1.1 distribution, that Also the cheaders files was missing from the 1.1.1 distribution, that
has also been fixed. has also been fixed.

View File

@ -244,6 +244,14 @@ case $LPR in
*) :;; # leave to empty values *) :;; # leave to empty values
esac esac
# Search for a latex to html converter
SEARCH_PROG([for an HTML converter], TOHTML, tth latex2html hevea)
case $TOHTML in
tth) html_command="tth -t '\$\$Fname'";;
latex2html) html_command="latex2html -no_subdir -split 0 -show_section_numbers '\$\$FName'";;
hevea) html_command="hevea -s '\$\$FName'";;
esac
#### Explore the LaTeX configuration #### Explore the LaTeX configuration
MSG_CHECKING(LaTeX configuration) MSG_CHECKING(LaTeX configuration)
# First, remove the files that we want to re-create # First, remove the files that we want to re-create
@ -326,6 +334,7 @@ cat >lyxrc.defaults <<EOF
\\chktex_command "$chktex_command" \\chktex_command "$chktex_command"
\\spell_command "$SPELL" \\spell_command "$SPELL"
\\fax_command "$fax_command" \\fax_command "$fax_command"
\\html_command "$html_command"
\\print_spool_command "$print_spool_command" \\print_spool_command "$print_spool_command"
\\print_spool_printerprefix "$print_spool_printerprefix" \\print_spool_printerprefix "$print_spool_printerprefix"
\\font_encoding "$chk_fontenc" \\font_encoding "$chk_fontenc"

42
lib/configure vendored
View File

@ -562,6 +562,47 @@ case $LPR in
*) :;; # leave to empty values *) :;; # leave to empty values
esac esac
# Search for a latex to html converter
echo $ac_n "checking for an HTML converter""... $ac_c"
echo "$ac_t"""
TOHTML=
for ac_prog in tth latex2html hevea
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog ; ac_word=$2
if test -n "$ac_word"; then
echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -x $ac_dir/$ac_word; then
TOHTML="$ac_prog"
break
fi
done
IFS="$ac_save_ifs"
if test -n "$TOHTML"; then
ac_result=yes
else
ac_result=no
fi
echo "$ac_t""$ac_result"
test -n "$TOHTML" && break
fi
done
if test -z "$TOHTML" ; then
TOHTML=none
fi
case $TOHTML in
tth) html_command='tth -t $$FNname';;
latex2html) html_command='latex2html -no_subdir -split 0 -show_section_numbers $$FName';;
hevea) html_command='hevea -s $$FName -o $$OutName';;
esac
#### Explore the LaTeX configuration #### Explore the LaTeX configuration
echo $ac_n "checking LaTeX configuration""... $ac_c" echo $ac_n "checking LaTeX configuration""... $ac_c"
# First, remove the files that we want to re-create # First, remove the files that we want to re-create
@ -656,6 +697,7 @@ cat >lyxrc.defaults <<EOF
\\chktex_command "$chktex_command" \\chktex_command "$chktex_command"
\\spell_command "$SPELL" \\spell_command "$SPELL"
\\fax_command "$fax_command" \\fax_command "$fax_command"
\\html_command "$html_command"
\\print_spool_command "$print_spool_command" \\print_spool_command "$print_spool_command"
\\print_spool_printerprefix "$print_spool_printerprefix" \\print_spool_printerprefix "$print_spool_printerprefix"
\\font_encoding "$chk_fontenc" \\font_encoding "$chk_fontenc"

View File

@ -119,10 +119,17 @@
# Example: use this to ignore warnings about using "\ldots" instead of "..." # Example: use this to ignore warnings about using "\ldots" instead of "..."
#\chktex_command "chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38" #\chktex_command "chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38"
# Define which program to use to run "tth", the LaTeX to HTML converter # Define which program to use to translate latex to HTML.
# You should include options. The default is "tth -t" # You should include options. The default is autodetected: the programs
# Example: use this to let math be italic # checked are tth, latex2html and hevea, and the default command lines
#\tth_command "tth -t -i" # used are:
#\html_command "tth -t '$$Fname'"
#\html_command "latex2html -no_subdir -split 0 -show_section_numbers '$$FName'"
#\html_command "hevea -s '$$FName'"
# The variable name $$FName is replaced with the name of the .tex
# file, and $$OutName is replaced with the name of the html file.
# Example: use this to let math be italic with tth.
#\html_command "tth -t -i $$FName"
# If you want to pass extra flags to the LinuxDoc sgml scripts, insert them # If you want to pass extra flags to the LinuxDoc sgml scripts, insert them
# here. # here.
@ -206,12 +213,12 @@
# The screen fonts used to display the text while editing # The screen fonts used to display the text while editing
# The defaults are: # The defaults are:
#\screen_font_roman -*-times #\screen_font_roman "-*-times"
#\screen_font_sans -*-helvetica #\screen_font_sans "-*-helvetica"
#\screen_font_typewriter -*-courier #\screen_font_typewriter "-*-courier"
# For some, this font looks better: # For some, this font looks better:
#\screen_font_roman -*-utopia #\screen_font_roman "-*-utopia"
# Allow the use of scalable screen fonts? Default is true. # Allow the use of scalable screen fonts? Default is true.
# If you choose "false", LyX will use the closest existing size for a match. # If you choose "false", LyX will use the closest existing size for a match.
@ -227,12 +234,12 @@
# The font for popups. It is set to # The font for popups. It is set to
# <font_popup>-*-*-*-?-*-*-*-*-<font_encoding>. # <font_popup>-*-*-*-?-*-*-*-*-<font_encoding>.
# The default is: # The default is:
#\screen_font_popup -*-helvetica-medium-r #\screen_font_popup "-*-helvetica-medium-r"
# The font for menus (and groups titles in popups). It is set to # The font for menus (and groups titles in popups). It is set to
# <font_menu>-*-*-*-?-*-*-*-*-<font_encoding>. # <font_menu>-*-*-*-?-*-*-*-*-<font_encoding>.
# The default is: # The default is:
#\screen_font_menu -*-helvetica-bold-r #\screen_font_menu "-*-helvetica-bold-r"
# The font sizes used for calculating the scaling of the screen fonts. # The font sizes used for calculating the scaling of the screen fonts.
# You should only have to change these if the fonts on your screen look bad, # You should only have to change these if the fonts on your screen look bad,

View File

@ -60,6 +60,7 @@
#include "ImportNoweb.h" #include "ImportNoweb.h"
#include "support/syscall.h" #include "support/syscall.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/path.h"
extern bool cursor_follows_scrollbar; extern bool cursor_follows_scrollbar;
@ -706,28 +707,34 @@ string LyXFunc::Dispatch(int ac,
break; break;
} }
// HTML // HTML
else if (extyp == "html") { else if (extyp == "html" && lyxrc->html_command != "none") {
// First, create LaTeX file // First, create LaTeX file
MenuMakeLaTeX(owner->currentBuffer()); MenuMakeLaTeX(owner->currentBuffer());
// And now, run tth // And now, run the converter
string file = owner->currentBuffer()->getFileName(); string file = owner->currentBuffer()->getFileName();
file = ChangeExtension(file, ".tex", false); Path path(OnlyPath(file));
// the tex file name has to be correct for
// latex, but the html file name can be
// anything.
string result = ChangeExtension(file, ".html", false); string result = ChangeExtension(file, ".html", false);
string tmp = lyxrc->tth_command + " < " + file file = ChangeExtension(SpaceLess(file), ".tex", false);
+ " > " + result ; string tmp = lyxrc->html_command;
tmp = subst(tmp, "$$FName", file);
tmp = subst(tmp, "$$OutName", result);
Systemcalls one; Systemcalls one;
int res = one.startscript(Systemcalls::System, tmp); int res = one.startscript(Systemcalls::System, tmp);
if (res == 0) { if (res == 0) {
setMessage(string( setMessage(_("Document exported as HTML to file `")
_("Document exported as HTML to file: ")) + result); + MakeDisplayPath(result) +'\'');
} else { } else {
setErrorMessage(string( setErrorMessage(_("Unable to convert to HTML the file `")
_("An unexpected error occured while converting document to HTML in file:")) + result); + MakeDisplayPath(file)
+ '\'');
} }
} }
else { else {
setErrorMessage(string(_("Unknown export type: ")) setErrorMessage(_("Unknown export type: ")
+ extyp); + extyp);
} }
} }

View File

@ -120,7 +120,7 @@ enum _LyXRCTags {
RC_EXIT_CONFIRMATION, RC_EXIT_CONFIRMATION,
RC_DISPLAY_SHORTCUTS, RC_DISPLAY_SHORTCUTS,
RC_RELYX_COMMAND, RC_RELYX_COMMAND,
RC_TTH_COMMAND, RC_HTML_COMMAND,
RC_LAST RC_LAST
}; };
@ -151,6 +151,7 @@ static keyword_item lyxrcTags[] = {
{ "\\fax_command", RC_FAX_COMMAND }, { "\\fax_command", RC_FAX_COMMAND },
{ "\\fax_program", RC_FAXPROGRAM }, { "\\fax_program", RC_FAXPROGRAM },
{ "\\font_encoding", RC_FONT_ENCODING }, { "\\font_encoding", RC_FONT_ENCODING },
{ "\\html_command", RC_HTML_COMMAND },
{ "\\input", RC_INPUT }, { "\\input", RC_INPUT },
{ "\\kbmap", RC_KBMAP }, { "\\kbmap", RC_KBMAP },
{ "\\kbmap_primary", RC_KBMAP_PRIMARY }, { "\\kbmap_primary", RC_KBMAP_PRIMARY },
@ -199,7 +200,6 @@ static keyword_item lyxrcTags[] = {
{ "\\spell_command", RC_SPELL_COMMAND }, { "\\spell_command", RC_SPELL_COMMAND },
{ "\\tempdir_path", RC_TEMPDIRPATH }, { "\\tempdir_path", RC_TEMPDIRPATH },
{ "\\template_path", RC_TEMPLATEPATH }, { "\\template_path", RC_TEMPLATEPATH },
{ "\\tth_command", RC_TTH_COMMAND },
{ "\\use_alt_language", RC_USE_ALT_LANG }, { "\\use_alt_language", RC_USE_ALT_LANG },
{ "\\use_escape_chars", RC_USE_ESC_CHARS }, { "\\use_escape_chars", RC_USE_ESC_CHARS },
{ "\\use_input_encoding", RC_USE_INP_ENC }, { "\\use_input_encoding", RC_USE_INP_ENC },
@ -256,7 +256,7 @@ LyXRC::LyXRC()
default_papersize = PAPER_USLETTER; default_papersize = PAPER_USLETTER;
custom_export_format = "ps"; custom_export_format = "ps";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"; chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
tth_command = "tth -t"; html_command = "tth -t";
fontenc = "default"; fontenc = "default";
dpi = 75; dpi = 75;
// Because a screen typically is wider than a piece of paper: // Because a screen typically is wider than a piece of paper:
@ -564,9 +564,9 @@ int LyXRC::Read(string const &filename)
chktex_command = lexrc.GetString(); chktex_command = lexrc.GetString();
break; break;
case RC_TTH_COMMAND: case RC_HTML_COMMAND:
if (lexrc.next()) if (lexrc.next())
tth_command = lexrc.GetString(); html_command = lexrc.GetString();
break; break;
case RC_SCREEN_DPI: case RC_SCREEN_DPI:

View File

@ -98,8 +98,8 @@ public:
LYX_PAPER_SIZE default_papersize; LYX_PAPER_SIZE default_papersize;
/// command to run chktex incl. options /// command to run chktex incl. options
string chktex_command; string chktex_command;
/// command to run tth incl. options /// command to run an html converter incl. options
string tth_command; string html_command;
/// ///
string sgml_extra_options; string sgml_extra_options;
/// ///

View File

@ -572,6 +572,12 @@ void Menus::ShowFileMenu(FL_OBJECT *ob, long)
fl_setpup_mode(SubFileExport, 41, FL_PUP_GREY); fl_setpup_mode(SubFileExport, 41, FL_PUP_GREY);
fl_setpup_mode(SubFileExport, 42, FL_PUP_GREY); fl_setpup_mode(SubFileExport, 42, FL_PUP_GREY);
} }
if (lyxrc->html_command == "none") {
// Disable export HTML
fl_setpup_mode(SubFileExport, 44, FL_PUP_GREY);
}
// xgettext:no-c-format // xgettext:no-c-format
fl_addtopup(FileMenu,_("|Import%m"), SubFileImport); fl_addtopup(FileMenu,_("|Import%m"), SubFileImport);
// xgettext:no-c-format // xgettext:no-c-format

View File

@ -56,7 +56,7 @@ struct lyx {
return ::_getcwd2(buffer, size); return ::_getcwd2(buffer, size);
#endif #endif
}; };
static chdir(const char * name) { static int chdir(const char * name) {
#ifndef __EMX__ #ifndef __EMX__
return ::chdir(name); return ::chdir(name);
#else #else

View File

@ -890,9 +890,8 @@ lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
size_type n) const size_type n) const
{ {
Assert(ptr); Assert(ptr);
if (!rep->sz || !*ptr) return npos; if (!rep->sz || !*ptr || i >= rep->sz) return npos;
Assert(i < rep->sz);
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
// What is "n" here? is it the number of value_types to use in ptr // What is "n" here? is it the number of value_types to use in ptr
@ -932,9 +931,8 @@ lyxstring::size_type lyxstring::find(value_type const * s, size_type i) const
lyxstring::size_type lyxstring::find(value_type c, size_type i) const lyxstring::size_type lyxstring::find(value_type c, size_type i) const
{ {
if (!rep->sz) return npos; if (!rep->sz || i >= rep->sz) return npos;
Assert(i < rep->sz);
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = 0; t + i < length(); ++t) { for (size_type t = 0; t + i < length(); ++t) {