Welcome to palaso.org
Website of the Payap Language Software Development Group
Formatting dictionaries with CSS
Author admin
In evaluating CSS as a stylesheet language for formatting dictionaries, I started putting PrinceXML through its paces. I tried what I considered to be
the hardest dictionary layout and while I think I have matched many of the features. The sidenotes are just not going to happen without specialized support for them in CSS. (The closest I could get was a float but of course if you have more than one within a line, they just write on top of each other). That result is here. I then switched to a more typical layout which had no problems at all. That result is here. You can get all the files to reproduce this exercise here.
Types of style
There are really a number items which contribute to the style of a dictionary:- Selection of fields
- Order of fields
- Textual markup - characters or text that is added before, after, or around items to distinguish a field from surrounding text
- Character styles - font changes
- Paragraph styles
- Page layout - columns
CSS3 Selectors
Another interesting behavior of CSS 3 is that you cannot select the first element having a class containing the word ‘pronunciation’:.pronunciation:first-of-type
You can only use the :first-of-type selector to select the first element with a particular name so a general div and span with class attributes would have to be converted to xml named elements instead. There is a way around this, given that our document will be generated from another format and that is to actually add classes first-of-type and last-of-type. Then the data becomes:
<span class="pronunciation
first-of-type">...</span><span
class="pronunciation">...</span><span class="pronunciation
last-of-type">...</span>
<span class="pronunciation first-of-type last-of-type">...</span>
Column-span
The only other problem I ran into was that Prince does not yet support the column-span property. This ended up not being a big problem since I just wanted the heading to span both columns and was able to work around this by making the first page of the section have a 12cm top margin and to float the heading into this space.Options
-
February 26, 2008 -
Typesetting, Dictionary, Developers -
0 comments
-
Comments RSS -
Del.ico.us
-
Digg!