File tree Expand file tree Collapse file tree 5 files changed +43
-11
lines changed
Expand file tree Collapse file tree 5 files changed +43
-11
lines changed Original file line number Diff line number Diff line change 22
33(library
44 (name htmlfromtexbooks)
5- (libraries str netstring ))
5+ (libraries str))
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ open Parser
22open Glossary
33open Utils
44
5- let url_encoded_str s = Netencoding.Url. encode s;;
5+ let url_encoded_str s = s;;
66
77let print_table_of_content ast min_chap =
88 let count = [|1 ;1 ;1 ;1 |] in
@@ -58,9 +58,9 @@ let print_table_of_content ast min_chap =
5858 | _ ::q -> aux acc q
5959 in (aux " " ast);;
6060
61- let parse_to_html ?(min_chap =1 ) ast =
61+ let parse_to_html ?(min_chap =1 ) write_before ast =
6262 let count = [|1 ;1 ;1 ;1 |] in
63- let rec aux ?(write =false ) acc ast =
63+ let rec aux ?(write =write_before ) acc ast =
6464 match ast with
6565 | [] -> acc
6666 | Nul ::q -> aux acc q
@@ -209,9 +209,10 @@ let prepare_body name str toc =
209209 doc;;
210210
211211
212- let print_file_in_html ?(min_chap =1 ) file outname =
212+ let print_file_in_html ?(min_chap =1 ) ?( write_before = false ) file outname =
213213 let a = pre_parse_file file in
214- let html = parse_to_html ~min_chap: min_chap a in
214+ let html = parse_to_html ~min_chap: min_chap write_before a in
215215 let toc = print_table_of_content a min_chap in
216- prepare_body (Hashtbl. find preamble " title" ) html toc
216+ let name = try Hashtbl. find preamble " title" with _ -> " Generic" in
217+ prepare_body name html toc
217218 |> write_to_file outname;;
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ let rec parse_string str =
9494let rec parse current_acc acc lst =
9595 match lst with
9696 | [] -> append_line current_acc acc
97- | t ::q when t= '$' -> let a,q2 = parse_math q in parse " " (a::acc) q2
97+ | t ::q when t= '$' -> let a,q2 = parse_math q in parse " " (a::(append_line current_acc acc) ) q2
9898 | t ::q when t= '\\' ->
9999 let cmd,l = parse_command q in
100100 parse " " (Cmd (cmd)::(append_line current_acc acc)) l
Original file line number Diff line number Diff line change 1+ < title > Generic</ title >
2+ < body >
3+ < style >
4+ .center {
5+ margin : auto;
6+ text-align : center;
7+ }
8+ </ style > < div class ="center ">
9+ < h1 > Generic</ h1 >
10+ < h2 > Table of Content</ h2 >
11+ < ul >
12+
13+ </ ul >
14+ </ div >
15+ tralalala
16+ </ p >
17+
18+ < p >
19+
20+ This is an integral
21+ < img src ="https://latex.codecogs.com/svg.image?x "/>
22+ < div style ="margin: auto; text-align: center; ">
23+ au center
24+
25+ </ div >
26+ < i > < b > !!!
27+ </ b > </ i > selsle
28+
29+
30+
31+ </ body >
Original file line number Diff line number Diff line change 11\documentclass{article}
2- \newcommand{\sep}{\begin{center}
3- \boldmath $\ast$~$\ast$~$\ast$
4- \end{center}}
52\usepackage{babel}
63Hello
74\begin{document}
85tralalala
6+ \bigskip
7+ This is an integral
8+ $\int^a_b f(x) \mathrm{d}x$
99\begin{center}
1010au center
1111\end{center}
You can’t perform that action at this time.
0 commit comments