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>
* Distribution files: updates for v1.1.2

11
NEWS
View File

@ -1,10 +1,15 @@
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
bugs have been fixed:
LyX 1.1.2 is a minor upgrade to 1.1.1, only one new feature has been added:
- 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.
Moreover, a couple of semi-serious bugs have been fixed:
- a bug that caused a crash in lyxstring::find
- the annoying '-' vs. '_' bug.

View File

@ -244,6 +244,14 @@ case $LPR in
*) :;; # leave to empty values
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
MSG_CHECKING(LaTeX configuration)
# First, remove the files that we want to re-create
@ -326,6 +334,7 @@ cat >lyxrc.defaults <<EOF
\\chktex_command "$chktex_command"
\\spell_command "$SPELL"
\\fax_command "$fax_command"
\\html_command "$html_command"
\\print_spool_command "$print_spool_command"
\\print_spool_printerprefix "$print_spool_printerprefix"
\\font_encoding "$chk_fontenc"

42
lib/configure vendored
View File

@ -562,6 +562,47 @@ case $LPR in
*) :;; # leave to empty values
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
echo $ac_n "checking LaTeX configuration""... $ac_c"
# First, remove the files that we want to re-create
@ -656,6 +697,7 @@ cat >lyxrc.defaults <<EOF
\\chktex_command "$chktex_command"
\\spell_command "$SPELL"
\\fax_command "$fax_command"
\\html_command "$html_command"
\\print_spool_command "$print_spool_command"
\\print_spool_printerprefix "$print_spool_printerprefix"
\\font_encoding "$chk_fontenc"

View File

@ -119,10 +119,17 @@
# Example: use this to ignore warnings about using "\ldots" instead of "..."
#\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
# You should include options. The default is "tth -t"
# Example: use this to let math be italic
#\tth_command "tth -t -i"
# Define which program to use to translate latex to HTML.
# You should include options. The default is autodetected: the programs
# checked are tth, latex2html and hevea, and the default command lines
# 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
# here.
@ -206,12 +213,12 @@
# The screen fonts used to display the text while editing
# The defaults are:
#\screen_font_roman -*-times
#\screen_font_sans -*-helvetica
#\screen_font_typewriter -*-courier
#\screen_font_roman "-*-times"
#\screen_font_sans "-*-helvetica"
#\screen_font_typewriter "-*-courier"
# For some, this font looks better:
#\screen_font_roman -*-utopia
#\screen_font_roman "-*-utopia"
# Allow the use of scalable screen fonts? Default is true.
# 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
# <font_popup>-*-*-*-?-*-*-*-*-<font_encoding>.
# 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
# <font_menu>-*-*-*-?-*-*-*-*-<font_encoding>.
# 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.
# 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 "support/syscall.h"
#include "support/lstrings.h"
#include "support/path.h"
extern bool cursor_follows_scrollbar;
@ -706,28 +707,34 @@ string LyXFunc::Dispatch(int ac,
break;
}
// HTML
else if (extyp == "html") {
else if (extyp == "html" && lyxrc->html_command != "none") {
// First, create LaTeX file
MenuMakeLaTeX(owner->currentBuffer());
// And now, run tth
// And now, run the converter
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 tmp = lyxrc->tth_command + " < " + file
+ " > " + result ;
file = ChangeExtension(SpaceLess(file), ".tex", false);
string tmp = lyxrc->html_command;
tmp = subst(tmp, "$$FName", file);
tmp = subst(tmp, "$$OutName", result);
Systemcalls one;
int res = one.startscript(Systemcalls::System, tmp);
if (res == 0) {
setMessage(string(
_("Document exported as HTML to file: ")) + result);
setMessage(_("Document exported as HTML to file `")
+ MakeDisplayPath(result) +'\'');
} else {
setErrorMessage(string(
_("An unexpected error occured while converting document to HTML in file:")) + result);
setErrorMessage(_("Unable to convert to HTML the file `")
+ MakeDisplayPath(file)
+ '\'');
}
}
else {
setErrorMessage(string(_("Unknown export type: "))
setErrorMessage(_("Unknown export type: ")
+ extyp);
}
}

View File

@ -120,7 +120,7 @@ enum _LyXRCTags {
RC_EXIT_CONFIRMATION,
RC_DISPLAY_SHORTCUTS,
RC_RELYX_COMMAND,
RC_TTH_COMMAND,
RC_HTML_COMMAND,
RC_LAST
};
@ -151,6 +151,7 @@ static keyword_item lyxrcTags[] = {
{ "\\fax_command", RC_FAX_COMMAND },
{ "\\fax_program", RC_FAXPROGRAM },
{ "\\font_encoding", RC_FONT_ENCODING },
{ "\\html_command", RC_HTML_COMMAND },
{ "\\input", RC_INPUT },
{ "\\kbmap", RC_KBMAP },
{ "\\kbmap_primary", RC_KBMAP_PRIMARY },
@ -199,7 +200,6 @@ static keyword_item lyxrcTags[] = {
{ "\\spell_command", RC_SPELL_COMMAND },
{ "\\tempdir_path", RC_TEMPDIRPATH },
{ "\\template_path", RC_TEMPLATEPATH },
{ "\\tth_command", RC_TTH_COMMAND },
{ "\\use_alt_language", RC_USE_ALT_LANG },
{ "\\use_escape_chars", RC_USE_ESC_CHARS },
{ "\\use_input_encoding", RC_USE_INP_ENC },
@ -256,7 +256,7 @@ LyXRC::LyXRC()
default_papersize = PAPER_USLETTER;
custom_export_format = "ps";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
tth_command = "tth -t";
html_command = "tth -t";
fontenc = "default";
dpi = 75;
// 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();
break;
case RC_TTH_COMMAND:
case RC_HTML_COMMAND:
if (lexrc.next())
tth_command = lexrc.GetString();
html_command = lexrc.GetString();
break;
case RC_SCREEN_DPI:

View File

@ -98,8 +98,8 @@ public:
LYX_PAPER_SIZE default_papersize;
/// command to run chktex incl. options
string chktex_command;
/// command to run tth incl. options
string tth_command;
/// command to run an html converter incl. options
string html_command;
///
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, 42, FL_PUP_GREY);
}
if (lyxrc->html_command == "none") {
// Disable export HTML
fl_setpup_mode(SubFileExport, 44, FL_PUP_GREY);
}
// xgettext:no-c-format
fl_addtopup(FileMenu,_("|Import%m"), SubFileImport);
// xgettext:no-c-format

View File

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

View File

@ -890,9 +890,8 @@ lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
size_type n) const
{
Assert(ptr);
if (!rep->sz || !*ptr) return npos;
if (!rep->sz || !*ptr || i >= rep->sz) return npos;
Assert(i < rep->sz);
TestlyxstringInvariant(this);
// 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
{
if (!rep->sz) return npos;
if (!rep->sz || i >= rep->sz) return npos;
Assert(i < rep->sz);
TestlyxstringInvariant(this);
for (size_type t = 0; t + i < length(); ++t) {