Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Fixing Alignment and More

There are three ways Kupu will destroy the alignment:
1. <CENTER> tags are removed.
2. Align attributes are removed.
3. TABLEs remove all formatting.

CENTER


HTML4 and XHTML do not include the CENTER tag. That means around 2050, someone is going to create a browser that does not support the CENTER tag. In preparation for that day, Lenya removes all CENTER tags.

This is not a major problem because Lenya does not create CENTER tags. But if you edit the source code for a document, or import or paste source code from somewhere else, you are probably not hoping Lenya will remove those pesky CENTER tags. Most people will be surprised by their removal.

To fix:
FILE: apache-lenya-1.2.2\build\lenya\webapp\lenya\resources\kupu\common\kupucontentfilters.js
CHANGE:
'center': 0
TO:
'center': 1

While you are there, add any other tags you want to use. If a tag is not on this list, it will be removed from all documents, along with anything inside the tag. If it is on the list, but has a zero, then the tag will be removed, but the contents will remain. If it has a one, the tag and its contents will be kept. I also added:
'hr': 1
HR is a valid XHTML tag, so I am uncertain why it is missing.

ALIGN and NAME attributes


The CENTER tag has been deprecated because we are supposed to use align="center" to center things. The Kupu editor adds align=center when you click the button. Then saving the document removes all "align" attributes. This is called a BUG!

This is probably specific to Lenya 1.2.2. The same bug was implemented quite differently in Lenya 1.2.4. See the Linczak's July 9, 2005 posting to the User Mailing List for fixing Lenya 1.2.4. His post is near the bottom of the page.


To fix:
FILE: apache-lenya-1.2.2\build\lenya\webapp\lenya\resources\kupu\apache-lenya\lenya\kupusave.xsl
WARNING: If there are any mistakes in this file, Kupu and Lenya will return the original document without any errors or changes. Make certain that every tag is closed properly.


Remove:
<xsl:template match="@align"/>
<xsl:template match="@name"/>

The first line removes those pesky "align" attributes that are making your documents so well formatted.

The second line removes "name" attributes. <A NAME="paul"> is how we link to pages with URLs using the #:
http://www.example.com/people.html#paul
would open the people page and scroll down so "paul" is at the top of the screen. Kupu will not add anchors for you, but you would be able to "Edit Source" and add them if they were not removed during saving. Removing that line lets them survive.

TABLE


FILE: C:\apache-lenya-1.2.2\build\lenya\webapp\lenya\resources\kupu\silva\kupusilvatools.js

This file is just nasty.
1. The TABLE CLASS must be 'plain', 'grid', 'list', 'listing', or 'data'. Anything else is changed to 'plain'. Your custom table classes just disappeared.
2. CELLPADDING and CELLSPACING are set to "0".
3. The number of cells in each ROW is counted respecting COLSPAN, and empty cells are added at the end of any row that has less. That will include any row where COLSPAN was used because COLSPAN is discarded.
4. All other attributes are discarded. Yes, ALIGN="CENTER" disappeared.

<TABLE BORDER="1" CELLPADDING="5" CELLSPACING="10"><TR VALIGN="TOP"><TD ROWSPAN="3">3 Rows</TD><TD COLSPAN="2">2 columns</TD></TR>
<TR VALIGN="BOTTOM"><TD>1 cell</TD><TD ROWSPAN="2">2 Rows</TD></TR>
<TR VALIGN="MIDDLE"><TD>1 cell</TD></TR>
<TR VALIGN="MIDDLE"><TD>1 cell</TD><TD>1 cell</TD><TD>1 cell</TD></TR>
</TABLE>
3 Rows2 columns
1 cell2 Rows
1 cell
1 cell1 cell1 cell


Becomes:
<table class="plain" border="1" cellpadding="0" cellspacing="0"><tbody><tr><td>3 Rows</td><td>2 columns</td><td>&nbsp;</td></tr><tr><td>1 cell</td><td>2 Rows</td><td>&nbsp;</td></tr><tr><td>1 cell</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>1 cell</td><td>1 cell</td><td>1 cell</td></tr></tbody></table>
3 Rows2 columns 
1 cell2 Rows 
1 cell  
1 cell1 cell1 cell


I am not rewriting this file. Too much other code depends on tables having no functionality.

The CENTER button is nice enough to add ALIGN=CENTER to the TD tags. Which are removed by this code when saving. The workaround is to edit the source and put <P ALIGN="CENTER">...</P>or <CENTER>...</CENTER> inside your TDs. As long as you did one of the above fixes.

<< CachingInternet Explorer >>

Contact Solprovider
Paul Ercolino