This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: More on that ^@^@ bug (Was: db150.zip bug?)


Hello,

The code that looks suspicious is (i think):

======
     70 (define (dsssl-country-code #!optional (node (current-node)))
     71   (let* ((lang     ($lang$))
     72          (ctrycode (if (> (string-index lang "_") 0)
     73                        (substring lang
     74                                   (+ (string-index lang "_") 1)
     75                                   (string-length lang))
     76                        #f)))
     77     (if ctrycode
     78         (string->symbol (case-fold-up ctrycode))
     79         #f)))
======

I think this is Lisp and I have no idea of Lisp.
However, let's try.
When we enter the function, $lang$ is "en". 
	If $lang contains an underscore (that is, it's like EN_GB),
		chop the characters from "_" to the right leaving "EN"
	Else
		set it to #f (just found, this is for 'false')
	EndIf

Line 77 now.
	If ctrycode is not #f (it is, so we go to the ELSE)
		capitalise
	Else
		set it to 'false'
	EndIf

Eventually, the value of line 79 (#f) is the output of the function.

Question: Is the Country Code derived from the Language Code?
	  I don't think so.

Solution: If we accept that lang-code=country-code, we should then
	  change line 76 to 'lang)))'.

The change between db149.zip to db150.zip is:
==>
dbprint.dsl: Support country subclassing of language        
==<

The diff that I think matters is:

==>
@@ -61,10 +61,22 @@
                #f)))))

 (define (dsssl-language-code #!optional (node (current-node)))
-  (let ((lang (if (inherited-attribute-string (normalize "lang") node)
-                 (inherited-attribute-string (normalize "lang") node)
-                 %default-language%)))
-    (string->symbol (case-fold-up lang))))
+  (let* ((lang     ($lang$))
+        (langcode (if (> (string-index lang "_") 0)
+                      (substring lang 0 (string-index lang "_"))
+                      lang)))
+    (string->symbol (case-fold-up langcode))))
+
+(define (dsssl-country-code #!optional (node (current-node)))
+  (let* ((lang     ($lang$))
+        (ctrycode (if (> (string-index lang "_") 0)
+                      (substring lang
+                                 (+ (string-index lang "_") 1)
+                                 (string-length lang))
+                      #f)))
+    (if ctrycode
+       (string->symbol (case-fold-up ctrycode))
+       #f)))

 (define ($paragraph$)
   (make paragraph
==<

> ----------
> From: 	Chris Nettleton[SMTP:nettleto@ccfn.demon.co.uk]
> Reply To: 	docbook@lists.oasis-open.org
> Sent: 	28 January 2000 15:40
> To: 	docbook@lists.oasis-open.org
> Subject: 	Re: DOCBOOK: db150.zip bug?
> 
> On Fri, 28 Jan 2000, Norman Walsh wrote:
> >/ Chris Nettleton <nettleto@ccfn.demon.co.uk> was heard to say:
> >| I tracked down this jadetex oddity to file docbook/print/dbprint.dsl"
> line
> >| 91, which is now commented out:
> >| 
> >|      87     space-after: %para-sep%
> >|      88     quadding: %default-quadding%
> >|      89     hyphenate?: %hyphenation%
> >|      90     language: (dsssl-language-code)
> >|      91 ;;    country: (dsssl-country-code)
> >|      92     (process-children)))
> >
> >That's very odd. Are you specifying a LANG attribute in this document?
> >Can you change line 91 to:
> >
> >  country: (debug (dsssl-country-code))
> >
> >and tell me what you get?
> 
> Here it is:
> 
> jade  -d /home/nettleto/xgc/src/xgc/doc/stylesheets/print.dsl -t tex ...
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> jade:/opt/sgmltools/share/sgml/stylesheets/docbook/print/dbprint.dsl:91:9:
> I: debug "#f"
> 
> Regards
> 
> -- 
> _______________
> Chris Nettleton
> Farnborough, UK
> Tel: 01252 377200 (+44 1252 377200)
> Fax: 01252 377203 (+44 1252 377203)
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]