[Pkg-ocaml-maint-commits] [hevea] 01/05: New upstream version 2.30
Ralf Treinen
treinen at moszumanska.debian.org
Wed Sep 20 19:19:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
treinen pushed a commit to branch master
in repository hevea.
commit 88f35d8713e3def5185cc4a2de9330b75fc13b31
Author: Ralf Treinen <treinen at free.fr>
Date: Wed Sep 20 21:09:17 2017 +0200
New upstream version 2.30
---
CHANGES | 9 +++
Makefile | 2 +-
README | 12 ++--
examples/sym.tex | 1 +
handle402.sh | 14 +++--
html/mathjax.hva | 36 +++++++++++
html/mathjaxauto.hva | 1 +
htmllex.mll | 1 +
install.sh | 4 +-
latexscan.mll | 168 +++++++++++++++++++++++++++++++++++++--------------
lexstate.ml | 44 +++++++-------
lexstate.mli | 5 ++
lexstyle.mll | 7 ++-
libs.def | 2 +-
location.ml | 10 +--
location.mli | 1 +
mathjax.sty | 9 +++
ocb.sh | 5 +-
saveUtils.ml | 2 +-
verb.mll | 52 ++++++++++++++--
version.ml | 4 +-
21 files changed, 289 insertions(+), 100 deletions(-)
diff --git a/CHANGES b/CHANGES
index 56f5c4c..7657d57 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,12 @@
+version 2.30
+ * Better error message when several \documentclass are present.
+version 2.29+5
+version 2.29+4
+version 2.29+3
+version 2.29+2
+ * mathjax 'automatic' support
+version 2.29+1
+ * mathjax support
version 2.29
* Correct bug around double quotes. Notice that the "plain" status
of double quotes is no expansion, by contrast with all other special
diff --git a/Makefile b/Makefile
index 6e7c8e0..dc10c2a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ SUF=
DIR=
OCAMLC=$(DIR)ocamlc$(SUF)
#OCAMLFLAGS=-w +a-4-9 -warn-error +a
-OCAMLFLAGS=-w +a-4-9-41-45
+OCAMLFLAGS=-w +a-3-4-9-41-45
OCBFLAGS=-j 4 -classic-display
#### End of configuration parameters
diff --git a/README b/README
index 29cd4f0..614a135 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-This is HEVEA, version 2.29, a fast Latex to HTML translator.
+This is HEVEA, version 2.30, a fast Latex to HTML translator.
ADVERTISEMENT
@@ -68,16 +68,16 @@ REQUIREMENTS
INSTALLATION FROM THE SOURCE DISTRIBUTION
Download the source distribution
- http://hevea.inria.fr/distri/hevea-2.23.tar.gz
+ http://hevea.inria.fr/distri/hevea-2.30.tar.gz
Unzip,
- gunzip hevea-2.23.tar.gz
+ gunzip hevea-2.30.tar.gz
Untar,
- tar xf hevea-2.23.tar
+ tar xf hevea-2.30.tar
Go to the source directory
- cd hevea-2.23
+ cd hevea-2.30
CONFIGURATION
There are a few configuration variables at the beginning of
@@ -127,5 +127,5 @@ MAKE
IN CASE OF TROUBLE.
- You do need version 3.12 (or newer) of the Objective Caml System.
- Older versions of Objective Caml cannot compile hevea 2.23.
+ Older versions of Objective Caml cannot compile hevea.
diff --git a/examples/sym.tex b/examples/sym.tex
index 412bca4..8f28ddf 100644
--- a/examples/sym.tex
+++ b/examples/sym.tex
@@ -1,5 +1,6 @@
\documentclass{article}
\@def at charset{UTF-8}
+\usepackage[auto]{mathjax}
\usepackage{latexsym}
\usepackage{textcomp}
\usepackage{amssymb}
diff --git a/handle402.sh b/handle402.sh
index ea36f85..ba52f9e 100644
--- a/handle402.sh
+++ b/handle402.sh
@@ -1,8 +1,10 @@
DIR=$(dirname $0)
-
-if [ $(ocaml $DIR/check402.ml) = ok ]; then
- rm -f $DIR/bytes.ml $DIR/bytes.mli
-else
- cp $DIR/bytes.mlp $DIR/bytes.ml
- cp $DIR/bytes.mlip $DIR/bytes.mli
+if [ ! -z "$CHECK" ]
+then
+ if [ $(ocaml $DIR/check402.ml) = ok ]; then
+ rm -f $DIR/bytes.ml $DIR/bytes.mli
+ else
+ cp $DIR/bytes.mlp $DIR/bytes.ml
+ cp $DIR/bytes.mlip $DIR/bytes.mli
+ fi
fi
diff --git a/html/mathjax.hva b/html/mathjax.hva
new file mode 100644
index 0000000..9652cff
--- /dev/null
+++ b/html/mathjax.hva
@@ -0,0 +1,36 @@
+\ProvidesPackage{mathjax}
+\let\jax at old@meta=\@meta
+\newcommand{\jax at meta}
+{\begin{rawhtml}<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"></script>
+\end{rawhtml}}
+\renewcommand{\@meta}{\jax at old@meta\jax at meta}
+%%%Standard
+\newcommand{\jax at std}
+{\@primitives{mathjax at std}%
+\let\textjax\@textjax%
+\newenvironment{displayjax}
+{\@nostyle\@print{\[}\mathjax}
+{\endmathjax\@print{\]}}}%
+%%%Auto
+\newcommand{\jax at defenv}[1]
+{\ifu\csname #1\endcsname\else
+\renewenvironment{#1}{\@nostyle\@print{\begin}\{#1\}\mathjax}{\endmathjax\@print{\end}\{#1\}}\fi}
+\newcommand{\jax at ensuremath}[1]{\ifmath#1\else\@textjax{#1}\fi}
+\newcommand{\jax at auto@redef}
+{\let\ensuremath\jax at ensuremath%
+\renewcommand{\[}{$$}%
+\jax at defenv{math}\jax at defenv{displaymath}%
+\jax at defenv{eqnarray}\jax at defenv{eqnarray*}%
+\jax at defenv{equation}\jax at defenv{equation*}%
+\jax at defenv{align}\jax at defenv{align*}%
+\jax at defenv{alignat}\jax at defenv{alignat*}%
+\jax at defenv{xalign}\jax at defenv{xxalignat}%
+\jax at defenv{gather}\jax at defenv{gather*}%
+\jax at defenv{multline}\jax at defenv{multline*}}
+
+\newcommand{\jax at auto}
+{\@primitives{mathjax at auto}\AtBeginDocument{\jax at auto@redef}}
+%%%Selection
+\DeclareOption{auto}{\def\jax at auto@selected{}\jax at auto}
+\ProcessOptions*
+\ifu\jax at auto@selected\jax at std\else\fi
diff --git a/html/mathjaxauto.hva b/html/mathjaxauto.hva
new file mode 100644
index 0000000..a66f6de
--- /dev/null
+++ b/html/mathjaxauto.hva
@@ -0,0 +1 @@
+\usepackage[auto]{mathjax}
diff --git a/htmllex.mll b/htmllex.mll
index 1e29d40..df1b1fc 100644
--- a/htmllex.mll
+++ b/htmllex.mll
@@ -308,6 +308,7 @@ and extract_classes cls = parse
extract_classes cls lexbuf }
| [^'<']+ { extract_classes cls lexbuf }
| eof { cls }
+| "" { error "Extract classes" lexbuf }
and skip_comment = parse
| "-->" { () }
diff --git a/install.sh b/install.sh
index e76df20..e87915f 100755
--- a/install.sh
+++ b/install.sh
@@ -43,11 +43,11 @@ case $1 in
esac
install . $LIBDIR imagen xxcharset.exe xxdate.exe contents_motif.gif next_motif.gif previous_motif.gif $ALLLIB
-install . $LATEXLIBDIR hevea.sty
+install . $LATEXLIBDIR hevea.sty mathjax.sty
install html $LIBDIR/html $HTMLLIB
install text $LIBDIR/text $TEXTLIB
install info $LIBDIR/info $INFOLIB
MAPPINGS=`( cd ./mappings && echo *.map )`
install mappings $LIBDIR/mappings $MAPPINGS
installbin $TARGET hevea hacha esponja bibhva
-cpv imagen $BINDIR
\ No newline at end of file
+cpv imagen $BINDIR
diff --git a/latexscan.mll b/latexscan.mll
index c26634a..71079a1 100644
--- a/latexscan.mll
+++ b/latexscan.mll
@@ -70,6 +70,10 @@ open Lexstate
open MyStack
open Subst
+let error_subst_top lxm =
+ raise
+ (Error (sprintf "macro argument '%s' at top level" lxm))
+
let sbool = function
| false -> "false"
| true -> "true"
@@ -958,7 +962,7 @@ let translate_put_unicode c next =
try OutUnicode.translate_in c next
with OutUnicode.CannotTranslate ->
raise
- (Error
+ (Misc.ScanError
(if Latexmacros.exists "\\inputencodingname" then
sprintf
"Encoding %s failed on '%c'"
@@ -987,31 +991,41 @@ let translate_put_unicode_string s =
let next = Misc.next_of_string s in
translate_next next
-let top_open_maths main dodo =
- push stack_in_math !in_math ;
- in_math := true ;
- if !display then Dest.item_display () ;
- push stack_display !display ;
- if dodo then begin
- display := true ;
- Dest.open_maths dodo;
+let top_open_maths main dodo =
+ if !jaxauto then begin
+ scan_this main "\\bgroup\\@nostyle" ;
+ Dest.put (if dodo then "\\[" else "\\(")
end else begin
- Dest.open_maths dodo;
- top_open_display () ;
- end ;
- scan_this main "\\normalfont"
-
+ push stack_in_math !in_math ;
+ in_math := true ;
+ if !display then Dest.item_display () ;
+ push stack_display !display ;
+ if dodo then begin
+ display := true ;
+ Dest.open_maths dodo;
+ end else begin
+ Dest.open_maths dodo;
+ top_open_display () ;
+ end ;
+ scan_this main "\\normalfont"
+ end
+
and top_close_maths dodo =
- in_math := pop stack_in_math ;
- if dodo then begin
- Dest.close_maths dodo
+ if !jaxauto then begin
+ Dest.put (if dodo then "\\]" else "\\)") ;
+ top_close_group ()
end else begin
- top_close_display () ;
- Dest.close_maths dodo
- end ;
- display := pop stack_display ;
- if !display then begin
- Dest.item_display ()
+ in_math := pop stack_in_math ;
+ if dodo then begin
+ Dest.close_maths dodo
+ end else begin
+ top_close_display () ;
+ Dest.close_maths dodo
+ end ;
+ display := pop stack_display ;
+ if !display then begin
+ Dest.item_display ()
+ end
end
;;
@@ -1044,12 +1058,14 @@ rule main = parse
main lexbuf}
(* Math mode *)
| "$" | "$$" as lxm
- {let dodo = lxm <> "$" in
- if effective !alltt || not (is_plain '$') then begin
- Dest.put lxm
+ {let dodo = lxm = "$$" in
+ if effective !alltt || not (is_plain '$') then begin
+ Dest.put lxm ;
+ main lexbuf
(* vicious case '$x$$y$' *)
end else if dodo && not !display && !in_math then begin
- scan_this main "${}$"
+ scan_this main "${}$" ;
+ main lexbuf
end else begin (* General case *)
let math_env = if dodo then "*display" else "*math" in
if !in_math then begin
@@ -1059,9 +1075,12 @@ rule main = parse
new_env math_env ;
top_open_maths main dodo ;
if dodo then ignore (skip_blanks lexbuf)
- end
- end ;
- main lexbuf }
+ end ;
+ if !jaxauto then begin
+ injaxauto := (if dodo then JaxDisplay else JaxInline) ;
+ inmathjax dodo lexbuf
+ end else main lexbuf
+ end }
(* Definitions of simple macros *)
(* inside tables and array *)
@@ -1075,24 +1094,31 @@ rule main = parse
Dest.put lxm
else
let i = Char.code lxm.[1] - Char.code '1' in
- scan_arg
- (if !alltt_loaded then
- (fun arg ->
- let old_alltt = !alltt in
- alltt := MyStack.pop stack_alltt ;
- scan_this_list_may_cont main lexbuf (get_subst ()) arg ;
- alltt := old_alltt ;
- MyStack.push stack_alltt old_alltt)
- else
- (fun arg -> scan_this_list_may_cont main lexbuf (get_subst ()) arg))
- i
+ begin try
+ scan_arg
+ (if !alltt_loaded then
+ (fun arg ->
+ let old_alltt = !alltt in
+ alltt := MyStack.pop stack_alltt ;
+ scan_this_list_may_cont main lexbuf (get_subst ()) arg ;
+ alltt := old_alltt ;
+ MyStack.push stack_alltt old_alltt)
+ else
+ (fun arg -> scan_this_list_may_cont main lexbuf (get_subst ()) arg))
+ i
+ with SubstTop -> error_subst_top lxm
+ end
end ;
main lexbuf}
(* Commands *)
| command_name
{let name = lexeme lexbuf in
do_expand_command main skip_blanks name lexbuf ;
- main lexbuf}
+ begin match !injaxauto with
+ | JaxOut -> main lexbuf
+ | JaxInline -> inmathjax false lexbuf
+ | JaxDisplay -> inmathjax true lexbuf
+ end }
(* Groups *)
| '{'
{do_expand_command main skip_blanks "\\@hevea at obrace" lexbuf ;
@@ -1231,7 +1257,8 @@ and image = parse
| '#' ['1'-'9']
{let lxm = lexeme lexbuf in
let i = Char.code (lxm.[1]) - Char.code '1' in
- scan_arg (scan_this_arg_list image) i ;
+ begin try scan_arg (scan_this_arg_list image) i
+ with SubstTop -> error_subst_top lxm end ;
image lexbuf}
| "\\end"
{let lxm = lexeme lexbuf in
@@ -1395,7 +1422,8 @@ and skip_false = parse
skip_false lexbuf
end}
| _ {skip_false lexbuf}
- | "" {raise (Error "End of entry while skipping TeX conditional macro")}
+ | "" {raise
+ (Misc.ScanError "End of entry while skipping TeX conditional macro")}
and comment = parse
| ['%'' ']* ("BEGIN"|"begin") ' '+ ("IMAGE"|"image")
@@ -1423,6 +1451,44 @@ and skip_to_end_latex = parse
| _
{skip_to_end_latex lexbuf}
| eof {fatal ("End of file in %BEGIN LATEX ... %END LATEX")}
+
+and inmathjax dodo = parse
+| "$$"|"\\]" as lxm
+ { if dodo then begin
+ top_close_maths true ;
+ close_env "*display";
+ injaxauto := JaxOut ;
+ main lexbuf
+ end else begin
+ Dest.put lxm ;
+ inmathjax dodo lexbuf
+ end }
+| '$'|"\\)" as lxm
+ { if not dodo then begin
+ top_close_maths false ;
+ close_env "*math" ;
+ injaxauto := JaxOut ;
+ main lexbuf
+ end else begin
+ Dest.put lxm ;
+ inmathjax dodo lexbuf
+ end }
+(* Substitution *)
+| '#' ['1'-'9']
+ {let lxm = lexeme lexbuf in
+ let i = Char.code lxm.[1] - Char.code '1' in
+ begin try
+ scan_arg
+ (fun arg ->
+ scan_this_list_may_cont (inmathjax dodo) lexbuf (get_subst ()) arg)
+ i
+ with SubstTop -> Dest.put lxm
+ end ;
+ inmathjax dodo lexbuf }
+| _ as lxm
+ { Dest.put_char lxm ; inmathjax dodo lexbuf }
+| eof { () }
+
{
let () = ()
@@ -1759,7 +1825,12 @@ let input_file loc_verb main filename lexbuf =
(* Styles and packages *)
+let saw_doc = "\\hva at doc"
+
let do_documentclass command lexbuf =
+ if Latexmacros.exists saw_doc then
+ raise (Misc.ScanError (sprintf "Multiple occurrences of %s" command)) ;
+ Latexmacros.global_def saw_doc zero_pat (Subst []) ;
Save.start_echo () ;
let {arg=opt_arg} = save_opt "" lexbuf in
let {arg=arg} = save_arg lexbuf in
@@ -2365,7 +2436,7 @@ def_code "\\@getprintnostyle"
def_code "\\@getprint"
(fun lexbuf ->
let arg = get_prim_arg lexbuf in
-(* eprintf "GET PRINT: '%s'\n" arg ; *)
+(* eprintf "GET PRINT: '%s'\n" arg ;*)
let buff = MyLexing.from_string arg in
Dest.put (Save.tagout buff)) ;
;;
@@ -2580,7 +2651,7 @@ let setif cell b lexbuf =
let extract_if name =
let l = String.length name in
if l <= 3 || String.sub name 0 3 <> "\\if" then
- raise (Error ("Bad newif: "^name)) ;
+ raise (Misc.ScanError ("Bad newif: "^name)) ;
String.sub name 3 (l-3)
;;
@@ -3142,7 +3213,10 @@ let def_printcount name f =
def_code name
(fun lexbuf ->
let cname = get_prim_arg lexbuf in
- let cval = Counter.value_counter cname in
+ let cval =
+ match cname with
+ | "inputlineno" -> Location.get_lineno ()
+ | _ -> Counter.value_counter cname in
let pp = f cval in
Dest.put pp)
;;
diff --git a/lexstate.ml b/lexstate.ml
index ca0c31f..7e675ec 100644
--- a/lexstate.ml
+++ b/lexstate.ml
@@ -115,11 +115,15 @@ let rec pretty_subst_rec indent = function
let full_pretty_subst s = pretty_subst_rec " " s
exception Error of string
-
+exception SubstTop
+type jax = JaxOut | JaxInline | JaxDisplay
+
(* Status flags *)
let display = ref false
and raw_chars = ref false
and in_math = ref false
+and jaxauto = ref false
+and injaxauto = ref JaxOut
and whitepre = ref false
and optarg = ref false
and styleloaded = ref false
@@ -221,25 +225,23 @@ and is_top = function
let prerr_args () = pretty_subst !subst
-let scan_arg lexfun i =
- let args = match !subst with
- | Top -> [||]
- | Env args -> args in
- if i >= Array.length args then begin
- if !verbose > 1 then begin
- prerr_string ("Subst arg #"^string_of_int (i+1)^" -> not found") ;
- pretty_subst !subst
- end ;
- raise (Error "Macro argument not found")
- end;
- let arg = args.(i) in
-
- if !verbose > 1 then begin
- eprintf
- "Subst arg #%i -> %a\n" i pretty_body arg.arg
- end ;
- let r = lexfun arg in
- r
+let scan_arg lexfun i = match !subst with
+ | Top -> raise SubstTop
+ | Env args ->
+ if i >= Array.length args then begin
+ if !verbose > 1 then begin
+ prerr_string ("Subst arg #"^string_of_int (i+1)^" -> not found") ;
+ pretty_subst !subst
+ end ;
+ raise (Error "Macro argument not found")
+ end;
+ let arg = args.(i) in
+ if !verbose > 1 then begin
+ eprintf
+ "Subst arg #%i -> %a\n" i pretty_body arg.arg
+ end ;
+ let r = lexfun arg in
+ r
and scan_body do_exec body args = match body with
| CamlCode _|Toks _ -> do_exec body
@@ -291,7 +293,7 @@ and restore_flags () =
in_math := pop stack_in_math ;
display := pop stack_display
-(* Total ckeckpoint of lexstate *)
+(* Total checkpoint of lexstate *)
type saved_lexstate =
(Lexing.lexbuf MyStack.saved * subst MyStack.saved) MyStack.saved *
bool MyStack.saved * bool MyStack.saved
diff --git a/lexstate.mli b/lexstate.mli
index 99ebe33..72714d4 100644
--- a/lexstate.mli
+++ b/lexstate.mli
@@ -35,12 +35,17 @@ val top_subst : subst
val get_subst : unit -> subst
exception Error of string
+exception SubstTop
+type jax = JaxOut | JaxInline | JaxDisplay
+
type alltt = Not | Inside | Macro
val effective : alltt -> bool
val raw_chars : bool ref
val display : bool ref
val in_math : bool ref
+val jaxauto : bool ref
+val injaxauto : jax ref
val alltt : alltt ref
val whitepre: bool ref
val optarg : bool ref
diff --git a/lexstyle.mll b/lexstyle.mll
index aaf4255..000f206 100644
--- a/lexstyle.mll
+++ b/lexstyle.mll
@@ -38,6 +38,7 @@ rule extract styles = parse
extract styles lexbuf }
| [^'<']+ { extract styles lexbuf }
| eof { styles }
+| "" { error "extract" lexbuf }
and extract_tag tag styles = parse
| '>' { styles }
@@ -54,6 +55,7 @@ and extract_tag tag styles = parse
| '#'?['a'-'z''A'-'Z''0'-'9''-''+''_'':''.']+))?
(* '"' *)
{ extract_tag tag styles lexbuf }
+| "" { error "extract_tag"lexbuf }
and skip_tag = parse
| [^'>']* '>' { () }
@@ -65,6 +67,7 @@ and skip_comment = parse
{skip_comment lexbuf}
| eof
{error "End of file in comment" lexbuf}
+| "" { error "comment" lexbuf }
and dump m out = parse
| "<style" blank+ "type" blank* "=" blank* '"' "text/css" '"' blank* '>' '\n'?
@@ -92,11 +95,13 @@ and dump m out = parse
| [^'<']+ as lxm
{ output_string out lxm ; dump m out lexbuf }
| eof { true }
-
+| "" { error "dump" lexbuf }
+
and dump_comment out = parse
| "-->" '\n'? as lxm { output_string out lxm }
| _ as c { output_char out c ; dump_comment out lexbuf }
| eof {error "End of file in comment" lexbuf}
+| "" { error "dump_comment" lexbuf }
and dump_tag out = parse
| [^'>']* '>' as lxm { output_string out lxm }
diff --git a/libs.def b/libs.def
index cee292d..bf2e112 100644
--- a/libs.def
+++ b/libs.def
@@ -1,4 +1,4 @@
ALLLIB= alltt.hva amsmath.hva articlecommon.hva babel.hva bookcommon.hva booktabs.hva comment.hva compat.hva hyperref.hva hrlang.hva ifthen.hva index.hva iso-symb.hva keyval.hva latexcommon.hva listings.hva lstlang1.hva lstlang2.hva lstlang3.hva makeidx.hva mathop.hva moreverb.hva multibib.hva multind.hva natbib-common.hva packages.hva plain.hva program.hva spaces.hva supertabular.hva underscore.hva url.hva verbatim.hva french-common.hva german-common.hva english.hva czech.hva portuguese [...]
-HTMLLIB= amssymb.hva amsfonts.hva article.hva austrian.hva book.hva color.hva colortbl.hva commongraphic.hva fancysection.hva fancyvrb.hva french.hva german.hva graphics.hva graphicx.hva hevea.hva common-math.hva mathpartir.hva natbib.hva png.hva gif.hva svg.hva report.hva seminar.hva sword.hva symb-eng.hva symb-ent.hva symb-fra.hva symb-mathml.hva symb-text.hva urlhref.hva xypic.hva undersection.hva
+HTMLLIB= amssymb.hva amsfonts.hva article.hva austrian.hva book.hva color.hva colortbl.hva commongraphic.hva fancysection.hva fancyvrb.hva french.hva german.hva graphics.hva graphicx.hva hevea.hva common-math.hva mathpartir.hva natbib.hva png.hva gif.hva svg.hva report.hva seminar.hva sword.hva symb-eng.hva symb-ent.hva symb-fra.hva symb-mathml.hva symb-text.hva urlhref.hva xypic.hva undersection.hva mathjax.hva mathjaxauto.hva
TEXTLIB=article.hva book.hva color.hva colortbl.hva fancysection.hva hevea.hva report.hva seminar.hva french.hva austrian.hva german.hva natbib.hva
INFOLIB=article.hva book.hva hevea.hva report.hva seminar.hva
diff --git a/location.ml b/location.ml
index dd239c8..0088d5c 100644
--- a/location.ml
+++ b/location.ml
@@ -51,7 +51,7 @@ let check () =
and hot saved =
let to_finalize = stack in
- MyStack.restore stack saved ;
+ MyStack.restore stack saved ;
let _,_,_,file_now = MyStack.top stack in
MyStack.finalize to_finalize
(fun (_,_,_,file) -> file == file_now)
@@ -97,7 +97,7 @@ type t = string * int * int
let do_get_pos () = match !curfile with
No -> -1,-1
| Yes file ->
- try
+ try
let char_pos = Lexing.lexeme_start !curlexbuf
and last_pos,last_line = !curline in
let last_pos,last_line =
@@ -116,6 +116,10 @@ let get_pos () =
!curlexname,nline,nchars
;;
+let get_lineno () =
+ let nline,_ = do_get_pos () in
+ nline
+
let do_print_pos full (s,nline,nchars) =
if nline >= 0 then
prerr_string
@@ -136,5 +140,3 @@ and print_fullpos () =
and print_this_pos p = do_print_pos false p
and print_this_fullpos p = do_print_pos true p
-
-
diff --git a/location.mli b/location.mli
index 8c912d2..cb1d82b 100644
--- a/location.mli
+++ b/location.mli
@@ -19,6 +19,7 @@ val restore : unit -> unit
type t
val get_pos : unit -> t
+val get_lineno : unit -> int
val print_pos : unit -> unit
val print_fullpos : unit -> unit
val print_this_pos : t -> unit
diff --git a/mathjax.sty b/mathjax.sty
new file mode 100644
index 0000000..eefc052
--- /dev/null
+++ b/mathjax.sty
@@ -0,0 +1,9 @@
+\ProvidesPackage{mathjax}
+\newcommand{\jax at auto}{\newcommand{\jax at auto@ok}{}}
+\newcommand{\jax at std}
+{\newenvironment{mathjax}{}{}%
+\newenvironment{displayjax}{\[}{\]}%
+\newcommand{\textjax}[1]{\(##1\)}}
+\DeclareOption{auto}{\jax at auto}
+\ProcessOptions%
+\@ifundefined{jax at auto@ok}{\jax at std}{}
diff --git a/ocb.sh b/ocb.sh
index b024922..ccf5ff4 100755
--- a/ocb.sh
+++ b/ocb.sh
@@ -1,5 +1,6 @@
#!/bin/sh -e
-
+CHECK=yes
+export CHECK
. ./config.sh
OCBOCAMLFLAGS=''
@@ -45,4 +46,4 @@ else
do
rule $i
done
-fi
\ No newline at end of file
+fi
diff --git a/saveUtils.ml b/saveUtils.ml
index 70f2634..f907a59 100644
--- a/saveUtils.ml
+++ b/saveUtils.ml
@@ -54,7 +54,7 @@ let error s =
let my_int_of_string s =
try int_of_string s
- with Failure "int_of_string" ->
+ with Failure _ ->
error ("Integer argument expected: ``"^s^"''")
exception Eof
diff --git a/verb.mll b/verb.mll
index 7ef90e5..5bd02fa 100644
--- a/verb.mll
+++ b/verb.mll
@@ -859,14 +859,14 @@ and start_inverb put = parse
and scan_byline process finish = parse
| "\\end" [' ''\t']* '{' ([^'}']+ as env) '}' as lxm
- {if
- (not !input_verb || MyStack.empty stack_lexbuf)
+ { (* eprintf "by_line: lxm='%s' cur_env=%s\n" lxm !Scan.cur_env ; *)
+ if (not !input_verb || MyStack.empty stack_lexbuf)
&& env = !Scan.cur_env then begin
finish () ;
scan_this Scan.main ("\\end"^env) ;
Scan.top_close_block "" ;
Scan.close_env !Scan.cur_env ;
- Scan.check_alltt_skip lexbuf
+ ()
end else begin
Out.put line_buff lxm ;
scan_byline process finish lexbuf
@@ -882,8 +882,7 @@ and scan_byline process finish = parse
scan_byline process finish lexbuf
end else begin
finish () ;
- raise
- (Eof "scan_byline")
+ raise (Eof "scan_byline")
end}
and scan_bycommand out is_cmd = parse
@@ -1058,6 +1057,14 @@ let put_html () =
Out.reset line_buff
;;
+let put_subst () =
+ let line = Out.to_string line_buff in
+(* eprintf "put_subst: '%s'\n" line ; *)
+ Out.reset line_buff ;
+ Dest.put (Subst.subst_this line) ;
+ ()
+;;
+
let open_forget lexbuf =
let process = (fun () -> Out.reset line_buff)
and finish = (fun () -> Out.reset line_buff) in
@@ -1067,7 +1074,12 @@ let open_raw lexbuf =
let process = (fun () -> put_html () ; Dest.put_char '\n')
and finish = put_html in
noeof (scan_byline process finish) lexbuf
-
+
+let open_subst lexbuf =
+ let process = (fun () -> put_subst () ; Dest.put_char '\n')
+ and finish = put_subst in
+ noeof (scan_byline process finish) lexbuf
+
let open_rawhtml lexbuf = match !Parse_opts.destination with
| Parse_opts.Html -> open_raw lexbuf
| _ -> open_forget lexbuf
@@ -1811,6 +1823,34 @@ let init_longtable () =
register_init "longtable" init_longtable
;;
+(* mathjax *)
+
+let init_mathjax auto =
+ (fun () ->
+ Lexstate.jaxauto := auto ;
+ def_code "\\@textjax"
+ (fun lexbuf ->
+ let arg = subst_arg lexbuf in
+ Dest.open_group "*mathjax*" ;
+ Dest.clearstyle () ;
+ Dest.put "\\(" ;
+ Dest.put arg ;
+ Dest.put "\\)" ;
+ Dest.close_group ()) ;
+ def_code "\\mathjax"
+ (fun lexbuf ->
+ Dest.open_group "*mathjax*" ;
+ Dest.clearstyle () ;
+ open_subst lexbuf) ;
+ def_code "\\endmathjax"
+ (fun _lexbuf ->
+ Dest.close_group ()) ;
+ ())
+;;
+
+register_init "mathjax at auto" (init_mathjax true);
+register_init "mathjax at std" (init_mathjax false)
+;;
def_code "\\@scaninput"
(fun lexbuf ->
diff --git a/version.ml b/version.ml
index eef95d1..56be730 100644
--- a/version.ml
+++ b/version.ml
@@ -9,8 +9,8 @@
(* *)
(***********************************************************************)
-let real_version = "2.29"
-let release_date = "2016-07-26"
+let real_version = "2.30"
+let release_date = "2017-07-26"
let version =
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/hevea.git
More information about the Pkg-ocaml-maint-commits
mailing list