Skip to content

Commit a1db77d

Browse files
committed
trie des dates de la forme mar#..#apr
git-svn-id: https://www.lri.fr/svn/demons/bibtex2html/trunk@357 6aee9057-109c-4a6d-8c93-4c3f535006fd
1 parent cf31ac6 commit a1db77d

File tree

7 files changed

+86
-49
lines changed

7 files changed

+86
-49
lines changed

CHANGES

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
Version 1.81, 12/05/2006
3+
========================
4+
o new option --print-keys to display the sorted keys (and exit)
5+
o improved date sorting to handle months such as mar # "\slash " # apr
6+
o no table anymore with -nokeys (only HTML paragraphs)
7+
28
Version 1.80, 15/3/2006
39
=======================
410
o remove leading ./ in front of relative URLs (was introduced a long
@@ -121,7 +127,7 @@ Version 1.54 10/7/2002
121127

122128
Version 1.53 18/6/2002
123129
======================
124-
o keywords displayed if a field "keywords" is present; option --no-heywords
130+
o keywords displayed if a field "keywords" is present; option --no-keywords
125131
o aux2bib now handles multiple citations (\citation{foo,bar,gee})
126132
(patch by Jose Ramon Alvarez Sanchez)
127133

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ DOCDIR = $(prefix)/doc/bibtex2html
1717
# End of configuration part
1818
#########################################
1919

20-
VERSION=1.80
20+
VERSION=1.81
2121

2222
OCAMLC = @OCAMLC@
2323
OCAMLOPT = @OCAMLOPT@

expand.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* (enclosed in the file GPL).
1515
*)
1616

17-
(*i $Id: expand.ml,v 1.13 2004-08-24 09:27:36 filliatr Exp $ i*)
17+
(*i $Id: expand.ml,v 1.14 2006-05-12 16:05:02 filliatr Exp $ i*)
1818

1919
(*s Expansion of abbreviations in BibTeX databases. *)
2020

@@ -103,10 +103,13 @@ let int_of_month = function
103103
| _ -> invalid_arg "int_of_month"
104104

105105
let month_day_re = Str.regexp "\\([a-zA-Z]+\\)\\( \\|~\\)\\([0-9]+\\)"
106+
let month_anything = Str.regexp "\\([a-zA-Z]+\\)"
106107

107108
let parse_month m =
108109
if Str.string_match month_day_re m 0 then
109110
int_of_month (Str.matched_group 1 m), int_of_string (Str.matched_group 3 m)
111+
else if Str.string_match month_anything m 0 then
112+
int_of_month (Str.matched_group 1 m), 1
110113
else
111114
int_of_month m, 1
112115

@@ -119,7 +122,7 @@ let extract_year k f =
119122
int_of_string (List.assoc "YEAR" f)
120123
with Failure "int_of_string" ->
121124
if not !Options.quiet then
122-
eprintf "Warning: incorrect year in entry %s\n" k;
125+
eprintf "Warning: incorrect year in entry %s@." k;
123126
if !Options.warn_error then exit 2;
124127
0
125128

@@ -143,6 +146,7 @@ let rec extract_date el (_,k,f) =
143146
try
144147
let y = extract_year k f in
145148
let m,d = extract_month k f in
149+
(* eprintf "extract_date: year = %d month = %d day = %d@." y m d; *)
146150
{ year = y; month = m; day = d }
147151
with Not_found ->
148152
try extract_date el (find_entry (List.assoc "CROSSREF" f) el)

latexmacros.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* (enclosed in the file GPL).
1515
*)
1616

17-
(*i $Id: latexmacros.ml,v 1.55 2006-03-15 09:14:15 filliatr Exp $ i*)
17+
(*i $Id: latexmacros.ml,v 1.56 2006-05-12 16:05:02 filliatr Exp $ i*)
1818

1919
(*s This code is Copyright (C) 1997 Xavier Leroy. *)
2020

@@ -154,6 +154,7 @@ def "\\&" [Print "&"];
154154
def "\\$" [Print "$"];
155155
def "\\%" [Print "%"];
156156
def "\\_" [Print "_"];
157+
def "\\slash" [Print "/"];
157158
def "\\copyright" [Print "(c)"];
158159
def "\\th" [Print "þ"];
159160
def "\\TH" [Print "Þ"];

main.ml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* (enclosed in the file GPL).
1515
*)
1616

17-
(*i $Id: main.ml,v 1.58 2004-09-16 09:39:16 filliatr Exp $ i*)
17+
(*i $Id: main.ml,v 1.59 2006-05-12 16:05:02 filliatr Exp $ i*)
1818

1919
(*s Main module of bibtex2html. *)
2020

@@ -246,6 +246,7 @@ let insert_title_url bib =
246246
i*)
247247

248248
let parse_only = ref false
249+
let print_keys = ref false
249250

250251
let translate fullname =
251252
let input_bib = Readbib.read_entries_from_file fullname in
@@ -268,6 +269,14 @@ let translate fullname =
268269
(fun (name,bibitems) -> (name,sort_entries entries bibitems))
269270
biblios
270271
in
272+
if !print_keys then begin
273+
List.iter
274+
(fun (_,bibitems) ->
275+
List.iter (fun (_,_,(_,k,_)) -> printf "%s\n" k) bibitems)
276+
sb;
277+
flush stdout;
278+
exit 0
279+
end;
271280
format_list
272281
(if !expand_abbrev_in_bib_output then
273282
Bibtex.expand_abbrevs input_bib
@@ -280,7 +289,7 @@ let translate fullname =
280289
let keys =
281290
List.fold_right
282291
(fun s e -> Bibtex.KeySet.remove s e) !excluded keys in
283-
Some (Bibfilter.saturate input_bib keys)
292+
Some (Bibfilter.saturate input_bib keys)
284293
else None)
285294

286295

@@ -321,6 +330,8 @@ Usage: bibtex2html <options> [filename]
321330
-heveaurl use HeVeA's \\url macro
322331
-noabstract
323332
do not print the abstracts (if any)
333+
-nokeywords
334+
do not print the keywords (if any)
324335
-noheader do not print the header (bibtex2html command)
325336
-nofooter do not print the footer (bibtex2html web link)
326337
-noexpand do not expand abbreviations in the BibTeX output
@@ -340,6 +351,8 @@ Usage: bibtex2html <options> [filename]
340351
declare a note field
341352
-dl use DL lists instead of TABLEs
342353
-labelname use the label name when inserting a link
354+
--print-keys
355+
print the sorted bibtex keys and exit
343356
-debug verbose mode (to find incorrect BibTeX entries)
344357
-q quiet mode
345358
-w stop on warning
@@ -380,7 +393,7 @@ let parse () =
380393
| ("-nolinks" | "-no-links" | "--no-links") :: rem ->
381394
print_links := false; parse_rec rem
382395
| ("-nokeys" | "-no-keys" | "--no-keys") :: rem ->
383-
nokeys := true; parse_rec rem
396+
nokeys := true; table := NoTable; parse_rec rem
384397
| ("-usekeys" | "-use-keys" | "--use-keys") :: rem ->
385398
use_keys := true; parse_rec rem
386399
| ("-rawurl" | "-raw-url" | "--raw-url") :: rem ->
@@ -417,7 +430,7 @@ i*)
417430
| ("-both" | "--both") :: rem ->
418431
both := true; parse_rec rem
419432
| ("-dl" | "--dl") :: rem ->
420-
table := false; parse_rec rem
433+
table := DL; parse_rec rem
421434

422435
(* Controlling the translation *)
423436
| ("-m" | "-macros-from" | "--macros-from") :: f :: rem ->
@@ -491,6 +504,8 @@ i*)
491504
Options.debug := true; parse_rec rem
492505
| "-parse-only" :: rem ->
493506
parse_only := true; parse_rec rem
507+
| ("-print-keys" | "--print-keys") :: rem ->
508+
print_keys := true; parse_rec rem
494509

495510
| [fbib] ->
496511
if not (Sys.file_exists fbib) then begin

translate.ml

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* (enclosed in the file GPL).
1515
*)
1616

17-
(*i $Id: translate.ml,v 1.70 2005-01-19 13:52:02 filliatr Exp $ i*)
17+
(*i $Id: translate.ml,v 1.71 2006-05-12 16:05:02 filliatr Exp $ i*)
1818

1919
(*s Production of the HTML documents from the BibTeX bibliographies. *)
2020

@@ -45,10 +45,12 @@ let bibentries_file = ref ""
4545
let title_url = ref false
4646
let use_label_name = ref false
4747
let use_keys = ref false
48-
let table = ref true
4948
let note_fields = ref ([] : string list)
5049
let abstract_name = ref "Abstract"
5150

51+
type table_kind = Table | DL | NoTable
52+
let table = ref Table
53+
5254
(* internal name, plus optional external name *)
5355
type field_info = string * (string option)
5456

@@ -156,7 +158,7 @@ let footer ch =
156158
Html.open_href ch own_address;
157159
output_string ch "bibtex2html";
158160
Html.close_href ch;
159-
output_string ch " "; output_string ch Version.version;
161+
output_string ch " "; output_string ch Version.version; output_string ch ".";
160162
Html.close_balise ch "em";
161163
Html.close_balise ch "p";
162164
output_string ch "\n";
@@ -335,37 +337,44 @@ let separate_file (b,((_,k,f) as e)) =
335337
close_out ch;
336338
in_summary := true
337339

338-
let open_table ch =
339-
Html.open_balise ch (if !table then "table" else "dl")
340-
341-
let close_table ch =
342-
Html.close_balise ch (if !table then "table" else "dl")
343-
344-
let open_row ch =
345-
if !table then begin
346-
Html.open_balise ch "tr valign=\"top\""; output_string ch "\n";
347-
Html.open_balise ch "td align=\"right\""; output_string ch "\n"
348-
end else begin
349-
Html.open_balise ch "dt"; output_string ch "\n"
350-
end
351-
352-
let new_column ch =
353-
if !table then begin
354-
Html.close_balise ch "td"; output_string ch "\n";
355-
Html.open_balise ch "td"; output_string ch "\n"
356-
end else begin
357-
Html.close_balise ch "dt"; output_string ch "\n";
358-
Html.open_balise ch "dd"; output_string ch "\n"
359-
end
360-
361-
let close_row ch =
362-
if !table then begin
363-
Html.close_balise ch "td"; output_string ch "\n";
364-
Html.close_balise ch "tr"; output_string ch "\n"
365-
end else begin
366-
(* JK Html.paragraph ch; output_string ch "\n"; *)
367-
Html.close_balise ch "dd"; output_string ch "\n"
368-
end
340+
let open_table ch = match !table with
341+
| Table -> Html.open_balise ch "table"
342+
| DL -> Html.open_balise ch "dl"
343+
| NoTable -> ()
344+
345+
let close_table ch = match !table with
346+
| Table -> Html.close_balise ch "table"
347+
| DL -> Html.close_balise ch "dl"
348+
| NoTable -> ()
349+
350+
let open_row ch = match !table with
351+
| Table ->
352+
Html.open_balise ch "tr valign=\"top\""; output_string ch "\n";
353+
Html.open_balise ch "td align=\"right\""; output_string ch "\n"
354+
| DL ->
355+
Html.open_balise ch "dt"; output_string ch "\n"
356+
| NoTable ->
357+
Html.open_balise ch "p"
358+
359+
let new_column ch = match !table with
360+
| Table ->
361+
Html.close_balise ch "td"; output_string ch "\n";
362+
Html.open_balise ch "td"; output_string ch "\n"
363+
| DL ->
364+
Html.close_balise ch "dt"; output_string ch "\n";
365+
Html.open_balise ch "dd"; output_string ch "\n"
366+
| NoTable ->
367+
output_string ch "\n"
368+
369+
let close_row ch = match !table with
370+
| Table ->
371+
Html.close_balise ch "td"; output_string ch "\n";
372+
Html.close_balise ch "tr"; output_string ch "\n"
373+
| DL ->
374+
(* JK Html.paragraph ch; output_string ch "\n"; *)
375+
Html.close_balise ch "dd"; output_string ch "\n"
376+
| NoTable ->
377+
Html.close_balise ch "p"
369378

370379
let one_entry_summary ch biblio (_,b,((_,k,f) as e)) =
371380
if !Options.debug then begin
@@ -380,9 +389,8 @@ let one_entry_summary ch biblio (_,b,((_,k,f) as e)) =
380389
if !multiple then Html.open_href ch (k ^ !link_suffix);
381390
latex2html ch (if !use_keys then k else Hashtbl.find cite_tab k);
382391
if !multiple then Html.close_href ch;
383-
end
384-
else
385-
output_string ch "&nbsp;";
392+
end else
393+
if !table <> NoTable then output_string ch "&nbsp;";
386394
Html.close_anchor ch;
387395
if (not !nokeys) or !multiple then output_string ch "]";
388396
(* end of JK changes *)
@@ -493,13 +501,14 @@ let format_list biblio sorted_bl keys =
493501
first_pass sorted_bl;
494502
bibentries_file := !output_file ^ "_bib";
495503
if !both then begin
504+
let old_print_keywords = !print_keywords in
496505
(* short version *)
497506
print_abstract := false;
498507
print_keywords := false;
499508
summary biblio sorted_bl;
500509
(* long version with abstracts and keywords *)
501510
print_abstract := true;
502-
print_keywords := true;
511+
print_keywords := old_print_keywords;
503512
let old_output = !output_file in
504513
output_file := !output_file ^ "_abstracts";
505514
summary biblio sorted_bl;

translate.mli

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* (enclosed in the file GPL).
1515
*)
1616

17-
(*i $Id: translate.mli,v 1.8 2004-09-16 09:39:16 filliatr Exp $ i*)
17+
(*i $Id: translate.mli,v 1.9 2006-05-12 16:05:02 filliatr Exp $ i*)
1818

1919
(*s Production of the HTML documents from the BibTeX bibliographies. *)
2020

@@ -43,7 +43,9 @@ val bib_entries : bool ref
4343
val input_file : string ref
4444
val output_file : string ref
4545
val use_label_name : bool ref
46-
val table : bool ref
46+
47+
type table_kind = Table | DL | NoTable
48+
val table : table_kind ref
4749

4850
(*s Inserting links for some BibTeX fields. *)
4951

0 commit comments

Comments
 (0)