|
Subject: Re: Color and font size of cells within a table From: Norman Walsh <norm@xxxxxxxxxxxxx> Date: Wed, 11 Mar 1998 14:32:21 -0500 |
/ "Jordi Mulet" <jmulet@xxxxxxxxxx> was heard to say:
[...]
| We are using the DocBook style sheets of Norman and we are interested
| about modify the color and the font size of several cells in a table. We
| are pursuing to redefine the process in an external file conveni.dsl as
|
| (define ($process-cell-para-contents$ para colnum align body)
[...]
|
| but use a Processing Instruction in the table or in the cell
I understand you to mean that you want to do something like this in
your source document:
...
<row>
<entry><?cell-color red>some red text</entry>
<entry>regular colored text</entry>
</row>
Where the "cell-color" PI might be inherited from the <row>
level or even farther above. If this is the case, I think that
$process-cell-para-contents$ is probably not quite the right
plae to do it.
Instead, I'd modify $process-cell$. The lines marked with *** below
are the lines I'm adding/changing:
(define ($process-cell$ entry preventry overhang)
(let* (
;; (celldebug (debug (string-append
;; (number->string (cell-column-number entry overhang))
;; " "
;; (data entry))))
(colnum (cell-column-number entry overhang))
(lastcellcolumn (if (node-list-empty? preventry)
0
(- (+ (cell-column-number preventry overhang)
(hspan preventry))
1)))
(lastcolnum (if (> lastcellcolumn 0)
(overhang-skip overhang lastcellcolumn)
0))
;; *** vvv
(color ($find-color-pi$))
;; *** ^^^
(htmlgi (if (have-ancestor? "TBODY" entry)
"TD"
"TH")))
(make sequence
;; This is a little bit complicated. We want to output empty cells
;; to skip over missing data. We start count at the column number
;; arrived at by adding 1 to the column number of the previous entry
;; and skipping over any MOREROWS overhanging entrys. Then for each
;; iteration, we add 1 and skip over any overhanging entrys.
(let loop ((count (overhang-skip overhang (+ lastcolnum 1))))
(if (>= count colnum)
(empty-sosofo)
(make element gi: htmlgi
(make entity-ref name: "nbsp")
;; (literal (number->string lastcellcolumn) ", ")
;; (literal (number->string lastcolnum) ", ")
;; (literal (number->string (hspan preventry)) ", ")
;; (literal (number->string colnum ", "))
;; ($debug-pr-overhang$ overhang)
(loop (overhang-skip overhang (+ count 1))))))
(make element gi: htmlgi
attributes: (append
(if (> (hspan entry) 1)
(list (list "COLSPAN" (number->string (hspan entry))))
'())
(if (> (vspan entry) 1)
(list (list "ROWSPAN" (number->string (vspan entry))))
'())
;; *** vvv
(if color
(list (list "STYLE" (string-append "color: " color)))
'())
;; *** ^^^
(if (equal? (cell-colwidth entry colnum) "")
'()
(list (list "WIDTH" (cell-colwidth entry colnum))))
(list (list "ALIGN" (cell-align entry colnum)))
(list (list "VALIGN" (cell-valign entry colnum))))
($process-cell-contents$ entry colnum)))))
I've used the CSS style attribute to change the color of the cell, I can't
think of another way to do it off the top of my head. If you need to do
it with <FONT> or something, you'll have to adjust the function a little
more.
Now all we need is a definition of $find-color-pi$. The HTML stylesheets
already include a pi-matching function, so I think this will do it:
(define ($find-color-pi$)
(let ((color (inherited-pi-value (current-node) "cell-color")))
(if color
color
#f)))
Does that help?
| and no an fix factor.
I'm a little lost here. Could you explain in a little more detail
what you mean by a fix factor?
--norm
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Color and font size of cells wi, Norman Walsh | Thread | Re:Color and font size of cells wit, Jordi Mulet |
| Re: Color and font size of cells wi, Norman Walsh | Date | Re: Enhanced Text, Norman Walsh |
| Month |