Commit ac51c146 authored by Gérard Huet's avatar Gérard Huet

Simplification of Corpus.citation; commit-corpus in MMakefile

parent a8cb8f9a
......@@ -187,7 +187,7 @@ module type S = sig
;
value url : string -> mode -> Sentence.t -> string
;
value citation : string -> int -> string -> bool -> string
value citation : string -> int -> string
;
end
;
......@@ -212,7 +212,8 @@ module Make (Loc : Location) : S = struct
value sentence subdir id =
let file = sentence_file subdir id in
if Sys.file_exists file then (Gen.gobble file : Sentence.t) else
raise No_such_sentence
failwith "No_such_sentence"
(* raise No_such_sentence *)
;
value contents subdir =
let subdir = ~/subdir in
......@@ -242,7 +243,8 @@ module Make (Loc : Location) : S = struct
let file = sentence_file dir id in
let sentence = Sentence.make id text unsandhied analysis in
if not force && Sys.file_exists file then
raise Sentence_already_exists
failwith "Sentence_already_exists"
(* raise Sentence_already_exists *)
else
Gen.dump sentence file
;
......@@ -251,7 +253,8 @@ module Make (Loc : Location) : S = struct
value mkdir dirname =
try Unix.mkdir ~/dirname 0o755 with
[ Unix.Unix_error (Unix.EEXIST, _, _) ->
raise (Section_already_exists (Filename.basename dirname))
failwith ("Section_already_exists" ^ (Filename.basename dirname))
(* raise (Section_already_exists (Filename.basename dirname)) *)
]
;
type mode = [ Reader | Annotator | Manager ]
......@@ -287,7 +290,8 @@ module Make (Loc : Location) : S = struct
in
Cgi.url path ~query:(Cgi.query_of_env env)
;
value citation subdir id text_str editable =
(* Idir
value citation subdir id text_str editable =
let text = Sanskrit.read_VH False text_str in
let mode = if editable then Annotator else Reader in
let sentence =
......@@ -311,6 +315,9 @@ module Make (Loc : Location) : S = struct
]
in
url subdir mode sentence
;
; *)
value citation subdir id =
url subdir Reader (sentence subdir id)
;
end
;
......@@ -112,12 +112,11 @@ module type S = sig
;
value url : string -> mode -> Sentence.t -> string
;
(* [citation subdir id text editable] returns an URL to the analysis
of the sentence [text] whose number is [id] in the corpus
subdirectory [subdir]. [editable] is a flag to indicate if the
sentence is editable or not. Raise [Failure "citation"] if an
(* [citation subdir id ]] returns an URL to the analysis
of the sentence whose number is [id] in the corpus
subdirectory [subdir]. Raise [Failure "citation"] if an
error occurs. *)
value citation : string -> int -> string -> bool -> string
value citation : string -> int -> string
;
end
;
......
......@@ -34,18 +34,18 @@ GOLD=$(SKTRESOURCES)GOLD# Heritage in Goldendict format databases
XMLBANKS=$(SKTRESOURCES)XML# Heritage Sanskrit morphology in XML databases
# Path to global Sanskrit corpus downloaded from Git.
SKTCORPUS = $(SKTRESOURCES)CORPUS
SKTCORPUS=$(SKTRESOURCES)CORPUS
# Path to the corpus in the server area.
SERVERCORPUS = $(SERVERPUBLICDIR)CORPUS
SERVERCORPUS=$(SERVERPUBLICDIR)CORPUS
# Macro to extract information from the Apache configuration.
apache_config_extract = $(shell apachectl -S | grep $(1) | \
cut -d ' ' -f 2 | cut -d '=' -f 2)
# User and group under which CGIs are executed.
APACHE_USER = $(call apache_config_extract,"User")
APACHE_GROUP = $(call apache_config_extract,"Group")
APACHE_USER=$(call apache_config_extract,"User")
APACHE_GROUP=$(call apache_config_extract,"Group")
# Virtual path for make
VPATH=ML
......@@ -491,7 +491,7 @@ web_services: # Will write localized site pages in DICO and export cgis
cp -p SITE/xml.html DICO
release: $(DICO) web_services releasecgi releaseMW releasedata releasedoc \
releasebook
releasebook releasecorpus
# releasexml - no XML release on server - lookup Heritage_Resources
# releasepdf disabled at present as bulky and un-finished
echo "Version $(VERSION) of Sanskrit site released on $(SERVERHOST)"
......@@ -525,12 +525,6 @@ releasedata: abrevs
cp $(SITEPAGE_EN) $(SERVERPUBLICDIR)index.html; \
fi # default language from lexicon parameter
cp -R $(DICO) $(SERVERPUBLICDIR) # hypertext Heritage dictionary
# Copy the corpus in the server area.
cp -R $(SKTCORPUS) $(SERVERPUBLICDIR)
# Make the corpus in the server area writable by CGIs.
chown -R $(APACHE_USER):$(APACHE_GROUP) $(SERVERCORPUS)
# so that cgis invocations in DICO pages are relocated consistently with config:
cd $(SERVERPUBLICDIR) && for i in `ls DICO/*.html`; do (\
sed '1,$$s|!CGIDECL|$(CGIBINURL)$(CGIDECL)|g' < $$i >temp; \
......@@ -546,6 +540,12 @@ rm temp ); done
cp $(SCRIPTS) $(SERVERPUBLICDIR)DICO # Javascript in DICO dir
# cp $(DOC_IMAGES) $(SERVERPUBLICDIR)IMAGES
releasecorpus:
# Copy the corpus in the server area.
cp -R $(SKTCORPUS) $(SERVERPUBLICDIR)
# Make the corpus in the server area writable by CGIs.
chown -R $(APACHE_USER):$(APACHE_GROUP) $(SERVERCORPUS)
BOOKPRINTS=$(BOOK)/Heritage.pdf $(BOOK)/abrevs.pdf
releasebook:
......@@ -791,5 +791,11 @@ reinstall: uninstall
export SERVERCORPUS
.PHONY: export-corpus
export-corpus:
export-corpus: # ???
$(MAKE) -C $(SKTRESOURCES) commit-corpus
# saving corpus acquisitions
commit-corpus:
cp -R $(SERVERCORPUS) $(SKTRESOURCES)
# TODO: git add des nouvelles citations, git commit, git push
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment