Text2html tool

8 views
Skip to first unread message

Carlo Hogeveen

unread,
Aug 29, 2021, 7:13:23 PM8/29/21
to Semware @ GoogleGroups

 

This new tool converts the current buffer’s text to an unsaved HTML page including TSE’s syntax highlighting.

 

This can be used to generate syntax highlighted code snippets for use in your own web page.

For example, I am in the process of making the code snippets in this web page syntax highlighted:

https://ecarlo.nl/tse/files/TSE_Pro_v4.4_Undocumented_Features.html

 

This can also be used to copy syntax highlighted code snippets into an email, provided that your email client supports the necessary HTML.

Outlook does support this, iOS mail mostly supports this.

As far as I currently know, even if the receiver’s email client does not support it, it will still show the code snippet, just not syntax highlighted.

I have created an example syntax highlighted code snippet at the bottom of this email.

I would love to hear from you whether your email client does or does not support showing it syntax highlighted.

 

Text2html download page:

https://ecarlo.nl/tse/index.html#Text2html

 

Syntax highlighted code snippet:

// Calculate the square of a number

proc Main()

  string  reply [5] = ''

  integer number    = 0

  integer square    = 0

  while Ask('Calculate the square of which number?', reply)

    number = Val(reply)

    square = number * number

    Warn('The square of'; number; 'is'; square)

  endwhile

  PurgeMacro(SplitPath(CurrMacroFilename(), _NAME_))

end Main

 

Outlook showed the above snippet just like I sent it.

iOS mail showed the snippet syntax highlighted, but not with default white letters on a black backround, but the reverse.

Let me know the name of your email client and how shows the snippet, and I will add that to the documentation.

 

Carlo

 

 

 

Rick Bradley

unread,
Aug 29, 2021, 8:46:19 PM8/29/21
to Carlo Hogeveen, sem...@googlegroups.com
Carlo:

Pegasus with IE renderer displays the highlighted text.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/00e001d79d2b%24756e0ca0%24604a25e0%24%40ecarlo.nl.
>


Regards
F.J. (Rick) Bradley

Intuition (n): an uncanny sixth sense which tells people that they are
right, whether they are or not.


knud van eeden

unread,
Dec 31, 2021, 12:43:01 PM12/31/21
to Semware @ GoogleGroups, TSE Editor List
Hello,

1. I tried to HTML syntax highlight a Java program, e.g.

snippet:

===

import java.io.*;
//
import java.math.BigInteger;
//
public static void main( String[] args ) throws IOException {
//
if ( args.length != 2 ) {
//
return;
//
String s = "";
//
String s01 = "";
String s02 = "";
String s03 = "";
String s04 = "";
String s05 = "";
String s06 = "";
String s07 = "";
String s08 = "";
String s09 = "";
String s10 = "";
String s11 = "";
String s12 = "";
String s13 = "";
//
/*
6 018d
7 0299
8 0000
9 0002
10 00000001
11 0000
12 0006
13 00000000
14 0000000d
15 0000000d
*/

===

but it did not show the expected syntax highlight in the generated HTML page.

Result: It showed everything in the same color.

Expected: It should show syntax highlighted keywords, similar what you see syntax highlighted in TSE.

===

Steps to reproduce:

1. Create a new file in TSE 

2. And give it the extension .java (so that TSE syntax highlights it accordingly)

3. Copy / paste the Java snippet in that TSE file

4. Run text2html.mac (located in the TSE mac directory)

5. Choose 'style'

6. That generates automatically a .HTML file.

7. Save that HTML file 

    e.g. as 

     foobar.html

8. Run that file in a browser (e.g. Google Chrome, FireFox, Opera, Vivaldi, ...)

9. Result: It typically shows everything in the same color.

10. Expect: E.g. TSE syntax highlighted Java keywords (e.g. 'import', 'public', 'return', ... should show also in the generated HTML
file with different colors.

Please advise

Thanks
with friendly greetings
Knud van Eeden



--

Carlo Hogeveen

unread,
Dec 31, 2021, 2:03:54 PM12/31/21
to sem...@googlegroups.com

 

Fixed: The Text2html tool now also works if TSE's cursor line is configured to be colored differently than other text lines.

https://ecarlo.nl/tse/index.html#Text2html

 

 

knud van eeden

unread,
Dec 31, 2021, 2:19:25 PM12/31/21
to SemWare TSE Pro Text Editor
Thanks Carlo,

Great, that works now using your latest Text2Html.s version


Very handy.

with friendly greetings
Knud van Eeden


Reply all
Reply to author
Forward
0 new messages