Problem with templates and Chinese Text

The preview issue is the same issue as the link below.

Preview will not update if the title starts with Japanese

If the title is a 2-byte character, $HTMLExportFileName must be alphanumeric.
I use a stamp to set $HTMLExportFileName in English ( with Translate Shell ).

I made a simple modification based on the original file.

  • Set $HTMLExportFileName of each note in English

  • Set MyNumber

  • Fix the “弧线视图/Element” template
    <a href="SceneView/^value($HTMLExportPath.split("/").at(-1))^">
    <a href="^value($HTMLExportFileName($Name(parent)))^/^value($HTMLExportPath.split("/").at(-1))^">

  • Add and fix “Templates/Header” from the original file.

样板FixVersion.tbx (1.1 MB)

1 Like

Is this necessary for internal preview? My hunch is yes as even if not exporting, OS safefy restrictions for the browser means Tinderbox has to make (‘export’) pages even if this is intenal and never seen on disk.

The original demo TBX in which this is based had all sorts of basic HTML errors. Web browsers are pretty forgiving, but at least the HTML is now correct. Otherwise the content is as before:
TBX L- Author Books, Scripts & Screenplays with Tinderbox SampleFile - clean HTML.tbx (922.6 KB)

Same file, edited to include ^title^ within <head> section of the ‘Header’ template:
TBX L- Author Books, Scripts & Screenplays with Tinderbox SampleFile - clean HTML-v2.tbx (926.6 KB)

If the ^title^ export code wrongly encodes double-byte languages (Chinese, Japanese, etc.) you can edit this line in template ‘Header’:

<title>^title^</title>

to:

<title>^value($Name)^</title>
2 Likes

Based on what fixed in the original demo (see above), I’ve also cleaned up the HTML in file ‘样板FixVersion.tbx’ (otherwise unchanged), and attach it here: 样板FixVersion-clean HTML.tbx (462.1 KB).

I don’t read Chinese so I’ve copy/pasted text based on where it went in the original TBX and put the same text in the same place in the ‘fixed’ HTML.

I hope I’ve introduced no errors and meanwhile, the HTML code is as per W3C and not a the WebKit engine’s best guess of the occasionally bizarre HTML code in the original document.

Oh, and apology to @wwchao as I can now see the bad HTML that called out wasn’t your choice but simply code copied for the original demo/tutorial file.

I hope that helps :slight_smile:

2 Likes

Thank you again, it wasn’t my fault! smile

1 Like

That’s very helpful and well put.

This involves some very old parts of the export system — parts that predate Unicode!

1 Like

Thanks to everyone for help on this issue.

I’ve rewritten the section of Tinderbox that chooses default file names for HTML export, and this should now be straightforward.

The fix should appear in the next release.

2 Likes