Page 1 of 1

Spontaneous capitalization in richtext

PostPosted: Tue Jun 22, 2021 10:51 am
by Andy
I'm seeing words in a different text color getting an initial cap when in ToolBook they are all lowercase. Below is an example involving the second appearance of the word "scrumptious" near the end of the text. I can provide the .tbk if you wish.
Thanks, Andy

From the AXF file:
<Text id="p0.o2"
name="t0"
backgroundColor="255,255,255"
borderStyle="none"
borderColor="0,0,0"
borderSize="0"
fontFace="Verdana"
fontSize="21"
fontUnits="pixels"
fontStyle="normal"
fontWeight="normal"
fontColor="0,0,0"
width="601"
height="176"
zorder="16384"
left="98"
top="15"
wordWrap="true"
lineSpacing="1.5">
<HTML>
<![CDATA[<p><font color=#800080><b>Scrump</b>tious</font> (<b>ad</b>jec<b>tive</b>) – <b>Ex</b>tr<u>e</u>me<b>ly</b> <b>t</b><b><u>a</u></b><b>st</b>y, <b>d</b><b><u>e</u></b>li<b>cious</b>.<br/><br/>The <b>choc</b><u>o</u><b>late</b> c<u>a</u>ke was <font color=#800080><b>scrump</b>tious</font>.<br/></p>]]>
</HTML>
</Text>

From the published js file:
p0.o2=new _nE("p0.o2","sys20",true,true,false,"t0","",p0,true,false,null,false,false,0,0.0,null,"<p><span style='color:#800080;'><b>Scrump</b>tious</span> (<b>ad</b>jec<b>tive</b>) – <b>Ex</b>tr<u>e</u>me<b>ly</b> <b>t</b><b><u>a</u></b><b>st</b>y, <b>d</b><b><u>e</u></b>li<b>cious</b>.<br/><br/>The <b>choc</b><u>o</u><b>late</b> c<u>a</u>ke was <span style='color:#800080;'><b>Scrump</b>tious</span>.<br/></p>");

Re: Spontaneous capitalization in richtext

PostPosted: Tue Jun 22, 2021 11:37 am
by Clifton
Please attach/send the tbk that gives you trouble.
Generally, more complex formatting is best done in an XML file that automatically loads with the page.

Re: Spontaneous capitalization in richtext

PostPosted: Tue Jun 22, 2021 12:59 pm
by Andy
I'm having trouble getting the tbk to you. It won't upload or email. What do you suggest?
Thanks, Andy

Re: Spontaneous capitalization in richtext

PostPosted: Tue Jun 22, 2021 1:15 pm
by Clifton
Please send it to [email protected]

Re: Spontaneous capitalization in richtext

PostPosted: Tue Jun 22, 2021 3:15 pm
by Clifton
I would guess that ToolBook is making a global, case-insensitive search in your rich text and replacing all instances with its HTML equivalent. If I change the text color of the second instance of "scrumptious" from rgb(128,0,128) to rgb(128,1,128), then the replacement is treated as unique and the export works as expected.

In the longrun, I would recommend creating an XML file for this type of complex formatting. Nowadays, XML is the best way to go when building ToolBook pages. It makes the export go really fast and you can post edit jus the XML file rather than re-exporting pages again. It is the most reliable way to ensure you get exactly what you expect. Using an XML file for this page exports like this—my actual XML export:

In this case, you really don't even have to create the rich text on the ToolBook side, just use plain text as boiler plate. So you know what content exists on the page. For word definitions, I would suggest creating a CSS stylesheet so all your definitions use similar color, styling, and fonts. In addition, you can use a google font in your CSS stylesheet so the result looks good everywhere in all browsers.

Here is the actual XML used in the above example:


Have fun!