PageBox: servlet running in sandbox on J2EE PageBox

for
support@pagebox.net PageBox: servlet running in sandbox on J2EE Word version of this document Printer-friendly version of this document Cuckoo generated
Presentation FAQ Reference Customization Runtime Forms Demo Math Verification Downloads Legal

Advanced functions in Cuckoo

Element support

Horizontal rule

To create a horizontal rule (<hr/>) in the HTML page, create an empty paragraph in Horizontal style like this:


Preserve

The <pre> element preserves the text format. Within a <pre> element all characters are interpreted literally and retained in display, including multiple spaces, tabs, carriage returns and linefeeds.

You can use two Word styles to create <pre> elements:

  • Preserve. Preserve is a character style and allows you to preserve the text format of a character string.

  • PreservePar. PreservePar is a paragraph style and allows you to preserve the text format of a multi-line area.

Mathematics

Cuckoo 0.0.5 and above support characters and styles used in Mathematics and Chemistry.

It leverages on Word and browser capabilities.

Mathematics and Greek support in Word 97/2000

Subscript and Superscript

In Mathematics you often need to write things such as x2.

In Chemistry you often need to write things such as H2O.

Cuckoo leverages on Word Superscript and Subscript to display smaller characters above or below the normal characters.

If you don't yet have configured Word with Superscript and Subscript here is how to do it.

Open up the Tools... Customize menu and choose the All Commands category:

Scroll down to find the Subscript and Superscript options. Then click the desired option and drag it on the toolbar. Your toolbar should now contain x2 and x2:

Now if you want to write x2 type x as usual, click on x2 button, type 2 and click again on x2 to revert to normal mode.

Note:

Normally you don't need to configure Word because Subscript and Superscript are already saved in cuckoo.dot.

Equation Editor

The Equation Editor comes with Microsoft Office or Works (including OEM editions). However it is not installed under a standard installation. Therefore you need to retrieve your installation CDROM and do a custom installation. Once the Equation Editor is installed, just follow the same procedure as for Superscript and Subscript:

  • Open up the Tools... Customize menu and choose the Insert category

  • Scroll down to find the Equation Editor option. Then click and drag the option on the toolbar. Your toolbar should now contain Öa

You can learn how to use the Equation Editor on spot.pcc.edu/academ/math/faculty/simonds/handouts/equation/ and on

www.rdg.ac.uk/SerDepts/su/Topic/WordProc/WoP2Kequ01/.

When Cuckoo finds an Equation in the document it generates a small .gif image and a <img> element.

Symbols

A Font named Symbol supports Mathematical symbols and Greek characters in Word.

If you type 'a' with the Symbol font a a is displayed.

The Symbol font is the same as the Symbol font of browsers. You can find the codes of Greek and Mathematical characters here. However in Word Symbol characters are stored on two bytes, for instance F022 or -4074 for ".

Issues

Support of Greek and Mathematical characters is buggy. There is a gap between what should be supported and what really works and there are problems on browsers as well as in Word.

Browsers

HTML 4.0 uses Unicode as its base character set and we should be able for instance to display " with &#8704;. Furthermore named entities were defined and we should be able to use &forall;, arguably easier to remember.

Before HTML 4.0 the only solution was to use the Symbol font. We could code " with

<font face="Symbol">&#34;</font> where 34 is 22 in decimal.

The math browser page shows how well your browser supports HTML 4 and Symbol font.

The table below summarizes the situation:

Browser

Behavior with default installation

Old browsers and Opera 5

Only Symbol font

Internet Explorer 5 and 6

Partial support of named entities and Unicode + support of Symbol font

Netscape 6.2, Mozilla 0.9.6 and Opera 6

Full support of named entities and Unicode. No support of Symbol font

To summarize it is impossible to display symbols and Greek characters on all browsers without checking the browser type.

Insert Symbol

Whatever symbol you choose, Word Insert Symbol inserts x0028 or '(' in the document. Ok the character code is stored somewhere else (it is displayed!) but impossible to retrieve with VBA. Therefore we created a Word document containing all supported characters.

Download and inflate this file. Then Copy | Paste Mathematical symbols from this file to your document.

For Greek characters, it is faster to type the Latin equivalent. You can easily remember that a a is an a, a b is a b and so on.

Implementation

cuckoo.dot

cuckoo.dot processes characters written with the Symbol font.

If the character is a character listed in the Math browser page and in the Word document, it converts it into the equivalent Unicode numbered entity, for instance &#8704; for ". Otherwise it copies the ASCII value of the character:

If r.text > ChrW(61440) Then ' If the character is F0xx

Dim k As Integer

k = AscW(r.text) ' Convert the character in integer

processMathChar = txt & Chr(4096 + k)

Else

processMathChar = txt & r.text

End If

cuckoo.dot also identifies Subscript and Superscript and wraps the character(s) in a <span> element.

math-gen.js

cuckoo.dot generates XML and HTML 4 files appropriate for a display in Netscape 6, Mozilla 0.9.6 and Opera 6.

These files will not display all Greek characters and Mathematical symbol on other browsers.

math-gen.js is a WSH script that makes two things:

  1. It converts Unicode numbered entities into Symbol character codes

  2. It inserts a script that detects the browser version and redirects to the HTML 4 version when the browser is Netscape 6, Mozilla or Opera 6:

function redirect() {

window.location = window.location.toString().replace(".html", "-nav6.html");

}

var agt=navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);

var is_nav = ((agt.indexOf("mozilla")!=-1) && (agt.indexOf("spoofer")==-1)&& (agt.indexOf("compatible") == -1) && (agt.indexOf("opera")==-1)&& (agt.indexOf("webtv")==-1) && (agt.indexOf("hotjava")==-1));var is_nav6up = (is_nav && (is_major >= 5));

var is_gecko = (agt.indexOf("gecko") != -1);

var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);

if (is_nav6up || is_gecko || is_opera6)

setTimeout("redirect();", 10);

Note:

math-gen.js is designed to process HTML files generated by cuckoo-gen.js.

MathGreek

We defined a MathGreek Word style with the Symbol font.

We also defined a MathGreek CSS class:

.MathGreek {

font-size:small;

font-family:Symbol;

}

You don't need to use MathGreek because Cuckoo tests the font.

However if you define another style with the Symbol font, you must also define a CSS class with a Symbol font-family.

math-verif

Click on math-verif.html to see the different advanced functions of Cuckoo.

Contact:support@pagebox.net
©2001 Alexis Grandemange. Last modified .

Cuckoo 0.05 released

  1. Web authoring with Word

  2. Page construction with XSLT

  3. Support of ASP, JSP, PHP, Cocoon, Resin

  4. Support of forms

  5. Support of Latin languages and Greek

  6. Support of Math symbols, Greek, Equation Editor, Subscript and Superscript

  7. Support of <pre> and <hr>

Open Source under GNU LGPL.

Help wanted!

If you know Arab, Chinese, Hebrew, Japanese and want to help for Cuckoo internationalisation... please contact us.

Table of Content
Element support
Horizontal rule
Preserve
Mathematics
Mathematics and Greek support in Word 97/2000
Subscript and Superscript
Equation Editor
Symbols
Issues
Browsers
Insert Symbol
Implementation
cuckoo.dot
math-gen.js
MathGreek
math-verif