anatoly techtonik wrote:
I think I can make the necessary modifications, but somebody have to explain
what needs to be changed in more ordinary-human-compatible format. =)
(I'm not an expert in DSSSL)
ok, i'll try to remember what i did to the precioussss DSSSL
A little background: so far <function> could safely convert everything to
lower case as we were only dealing with PHP userland functions and these
are case insensitive anyway
But now we have to deal with C names, too, and these are case sensitive.
luckily the engine code doesn't use studlyCaps so we only need to distinguish
between all lower case function names and all upper case MACROs
Another restriction we have to deal with is the fact that both the DSSSL
and the XSL stylesheet processors generate HTML file names from id attributes
but convert the id values to lowercase first so that id doesn't matter whether
output is written to a case sensitive or insensitive file system.
This leads to another problem with functions and macros like
zend_wrong_param_count() and ZEND_WRONG_PARAM_COUNT(): their ID attributes
would be different but both would be written to the same file. So i had to
introduce two different prefices zend-api. and zend-api-macro. for these.
So we either have C functions that are always lowercase, PHP functions that
may be mixed case but need to be folded down to lowercase, and C macros
that are all uppercase and should stay so. The following new function
will convert a string to lowercase unless *all* characters within are
uppercase:
+;; convert to lower case unless all characters are upper case
+(define (case-fold-updown str)
+ (let (
+ (upstr (case-fold-up str))
+ (downstr (case-fold-down str))
+ )
+ (if (equal? upstr str) upstr downstr )
+ )
+)
+
now we have to change the way <function> is rendered
so far we made <function> a link to the function reference by first converting
it into the id attribute format by:
- converting it to lowercase
- replacing _ with - (as some tools in the past didn't play nice with _ in ids)
- replacing :: with . (as : is not a valid character in windows file names)
then we'd check whether an id like that existed and whether the <function> tag
was not within the reference page for its function itself. if both conditions
were met a link was created, else the function name was just rendered bold
but not linked to anything
now we have to check against three different kind of ids with prefixes
'function.',
'zend-api.' and 'zend-api-macro.' instead of just 'function.', and we also have
to
apply the new, more complex case folding rules:
(element function
- (let* ((function-name (data (current-node)))
- (linkend
- (string-append
- "function."
- (case-fold-down (string-replace
- (string-replace function-name "_" "-")
- "::" "."))))
- (target (element-with-id linkend))
- (parent-gi (gi (parent))))
+ (let* (
+ (function-name (data (current-node)))
+ (id-base (string-replace
+ (string-replace function-name "_" "-")
+ "::" "."))
+ (linkend (string-append "function." (case-fold-down id-base )))
+ (target (element-with-id linkend))
+ (linkend2 (string-append "zend-api." (case-fold-down id-base )))
+ (target2 (element-with-id linkend2))
+ (linkend3 (string-append "zend-api-macro." id-base ))
+ (target3 (element-with-id linkend3))
+ (parent-gi (gi (parent)))
+ )
+
(cond
;; function names should be plain in FUNCDEF
((equal? parent-gi "funcdef")
@@ -158,8 +177,8 @@
;; If a valid ID for the target function is not found, or if the
;; FUNCTION tag is within the definition of the same function,
;; make it bold, add (), but don't make a link
- ((or (node-list-empty? target)
- (equal? (case-fold-down
+ ((or (and (node-list-empty? target) (node-list-empty? target2)
(node-list-empty? target3))
+ (equal? (case-fold-updown
(data (node-list-first
(select-elements
(node-list-first
@@ -169,7 +188,7 @@
(ancestor-member (parent) (list "refentry")))
"refnamediv")))
"refname"))))
- (case-fold-down function-name)))
+ (case-fold-updown function-name)))
($bold-seq$
(make sequence
(process-children)
and now for the creation of the actual link, so far we just had a single
target to link to
- attributes: (list
- (list "HREF" (href-to target)))
now we have 3 different possible targets and have to check which of these is
actually to be used (its the one that is not empty). if its a MACRO we also
have to make it lowercase at this point so that we match the filename:
+ attributes: (list
+ (list "HREF" (href-to (cond ((not (node-list-empty?
target3)) (case-fold-down target3))
+ ((not (node-list-empty?
target2)) target2)
+ ((not (node-list-empty?
target)) target)
+ ))
+ )
+ )