diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-18 20:53:44 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-18 20:53:44 +0300 |
commit | b8f74f94f21826901ff303095c2b88caad4a695e (patch) | |
tree | c9f0051ebdeb43607f03d99a199d8b054b4f5624 /src/cgi-bin | |
parent | 978e459eb3f79853adf0dea0a8118f259e5cfa6e (diff) | |
download | ellinika-b8f74f94f21826901ff303095c2b88caad4a695e.tar.gz ellinika-b8f74f94f21826901ff303095c2b88caad4a695e.tar.bz2 |
conj.cgi: Further improvements.
* data/pl/0.xml: Update.
* src/cgi-bin/Makefile.am (dict.m4): Define SCRIPT_SUFFIX
* src/cgi-bin/conj.scm4 (class-attested?): New function.
(show-conjugation): Print a translation, if available. Provide
a link to dict.cgi.
If conjugation class is not attested, issue a prominent warning.
* style.css (div.unattested): New class.
Diffstat (limited to 'src/cgi-bin')
-rw-r--r-- | src/cgi-bin/Makefile.am | 21 | ||||
-rw-r--r-- | src/cgi-bin/conj.scm4 | 53 |
2 files changed, 51 insertions, 23 deletions
diff --git a/src/cgi-bin/Makefile.am b/src/cgi-bin/Makefile.am index 16fc3d2..6b32b42 100644 --- a/src/cgi-bin/Makefile.am +++ b/src/cgi-bin/Makefile.am @@ -25,16 +25,17 @@ dict.m4: Makefile echo 'changecom([;],[' >> $@ echo '])' >> $@ echo 'undefine([format])' >> $@ - echo 'define([IFACE],$(APACHE_IFACE))' >> $@ - echo 'define([GUILE_BINDIR],$(GUILE_BINDIR))' >> $@ - echo 'define([GUILE_SITE],@GUILE_SITE@)' >> $@ - echo 'define([PACKAGE],$(PACKAGE))'>> $@ - echo 'define([PREFIX],$(prefix))' >> $@ - echo 'define([SYSCONFDIR],$(sysconfdir))' >> $@ - echo 'define([LOCALEDIR],$(datadir)/locale)' >> $@ - echo 'define([HTMLDIR],$(HTMLDIR))' >> $@ + echo 'define([IFACE], [$(APACHE_IFACE)])' >> $@ + echo 'define([SCRIPT_SUFFIX], [@SCRIPT_SUFFIX@])'>>$@ + echo 'define([GUILE_BINDIR], [$(GUILE_BINDIR)])' >> $@ + echo 'define([GUILE_SITE], [@GUILE_SITE@])' >> $@ + echo 'define([PACKAGE], [$(PACKAGE)])'>> $@ + echo 'define([PREFIX], [$(prefix)])' >> $@ + echo 'define([SYSCONFDIR], [$(sysconfdir)])' >> $@ + echo 'define([LOCALEDIR], [$(datadir)/locale])' >> $@ + echo 'define([HTMLDIR], [$(HTMLDIR)])' >> $@ echo 'divert(0)dnl' >> $@ - echo 'ifelse(IFACE,[CGI],#! $(GUILE_BINDIR)/guile -s' >> $@ + echo 'ifelse(IFACE,[CGI],[#! $(GUILE_BINDIR)/guile -s]' >> $@ echo ')dnl' >> $@ echo '@AUTOGENERATED@' >> $@ echo 'ifelse(IFACE,[CGI],!#' >> $@ @@ -54,4 +55,4 @@ conj.scm: conj.scm4 dict.m4 dict.cgi: dict.scm nea.cgi: nea.scm - +conj.cgi: conj.scm diff --git a/src/cgi-bin/conj.scm4 b/src/cgi-bin/conj.scm4 index 7f7d347..72da00e 100644 --- a/src/cgi-bin/conj.scm4 +++ b/src/cgi-bin/conj.scm4 @@ -105,11 +105,6 @@ ifelse(IFACE,[CGI],(cgi:init)) (cdr tense)))) (display "<th>") (cond - ((not (member 'class att)) - (display "<a href=\"#class-na\">*</a> ") - (if (not (member 'class unattested)) - (set! unattested (cons 'class unattested))))) - (cond ((not (member 'root att)) (display "<a href=\"#root-na\">?</a> ") (if (not (member 'root unattested)) @@ -230,6 +225,31 @@ ifelse(IFACE,[CGI],(cgi:init)) (apply format #t fmtstr fmtargs) (display "</h2>")) +(define (class-attested? result) + (call-with-current-continuation + (lambda (return) + (for-each + (lambda (voice) + (for-each + (lambda (mood) + (for-each + (lambda (tense-list) + (for-each + (lambda (tense) + (if (and (not (empty-conjugation? tense)) + (conjugation:attested tense)) + (return (member 'class (conjugation:attested tense))))) + (cdr tense-list))) + (cdr mood))) + (cdr voice))) + result) + (return #f)))) + +(define (dict-cgi-name) + (let* ((my-name cgi-script-name) + (slpos (string-rindex my-name #\/))) + (string-append (substring my-name 0 slpos) "/dict.SCRIPT_SUFFIX"))) + (define (show-conjugation verb) (catch #t (lambda () @@ -244,17 +264,24 @@ ifelse(IFACE,[CGI],(cgi:init)) (language-code target-language)))) (cond ((and descr (not (null? descr))) - (format #t "<h2 class=\"verb\">~A - ~A</h2>" + (format #t "<h2 class=\"verb\"><a href=\"~A\">~A - ~A</a></h2>" + (make-cgi-name + (dict-cgi-name) "ident" (dict:encode-string verb)) verb (caar descr))) (else - (format #t "<h2 class=\"verb\">~A - (~A)</h2>" + (format #t + "<h2 class=\"verb\">~A - <span class=\"error\">(~A)</span></h2>" verb (_ "δεν βρέθηκε στο λέξικο"))))) - - (for-each - (lambda (voice) - (show-conjugation:voice voice)) - (conjugate-all verb))) + (let ((result (conjugate-all verb))) + (if (not (class-attested? result)) + (format #t + "<div class=\"unattested\"><p>~A</p></div>" + (_ "Η συζυγία αυτό του ρήματος δεν επιβεβαιώνεται από τη βάση δεδοµένων"))) + (for-each + (lambda (voice) + (show-conjugation:voice voice)) + result))) (lambda (key . args) (case key ((conjugator-error) @@ -362,7 +389,7 @@ ifelse(IFACE,[CGI],(cgi:init)) "Conjugation class of this verb is not attested")) ((root) (print-footnote "root-na" "?" - "Stem of this verb is not attested")))) + (_ "Το θέμα αυτού του χρόνου δεν επιβεβαιώνεται από τη βάση δεδοµένων"))))) unattested) (display "</div>")) |