summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-18 17:53:44 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-06-18 17:53:44 (GMT)
commitb8f74f94f21826901ff303095c2b88caad4a695e (patch) (side-by-side diff)
treec9f0051ebdeb43607f03d99a199d8b054b4f5624
parent978e459eb3f79853adf0dea0a8118f259e5cfa6e (diff)
downloadellinika-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 (more/less context) (ignore whitespace changes)
-rw-r--r--data/pl/0.xml1
-rw-r--r--src/cgi-bin/Makefile.am21
-rw-r--r--src/cgi-bin/conj.scm453
-rw-r--r--src/ellinika/conjugator.scm3
-rw-r--r--style.css7
5 files changed, 61 insertions, 24 deletions
diff --git a/data/pl/0.xml b/data/pl/0.xml
index 823e7af..9e74eb4 100644
--- a/data/pl/0.xml
+++ b/data/pl/0.xml
@@ -1437,6 +1437,7 @@ zrobić wszystkiego</M>
<NODE>
<K>λείπω</K>
<P>αμετ.</P>
+ <M>brakować</M>
<M>być nieobecnym</M>
</NODE>
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>&nbsp;")
- (if (not (member 'class unattested))
- (set! unattested (cons 'class unattested)))))
- (cond
((not (member 'root att))
(display "<a href=\"#root-na\">?</a>&nbsp;")
(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>"))
diff --git a/src/ellinika/conjugator.scm b/src/ellinika/conjugator.scm
index 8b689a4..e73a1cc 100644
--- a/src/ellinika/conjugator.scm
+++ b/src/ellinika/conjugator.scm
@@ -549,7 +549,8 @@ AND i.tense=\"~A\" AND i.ident=f.ident"
(cond
((not conj)
#f)
- (else (list-ref conj 7))))
+ (else
+ (list-ref conj 7))))
(define-public (empty-conjugation? conj)
(or
diff --git a/style.css b/style.css
index 98bb205..d918d6e 100644
--- a/style.css
+++ b/style.css
@@ -485,3 +485,10 @@ img.ellinika-img {
h2.verb {
text-decoration: underline;
}
+
+div.unattested {
+ display: block;
+ text-align: center;
+ border: 2px solid red;
+ width: 100%;
+}

Return to:

Send suggestions and report system problems to the System administrator.