Converting Text to HTML or XHTML

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

Converting Text to HTML or XHTML

Postby mfoster » Sun Sep 27, 2009 11:55 pm

Hi,

Does anyone know if there is a function in UEStudio which would convert a preformatted text file (arranged in paragraphs) to HTML or XHTML? I have looked around but cannot find anything.

Cheers,

Mark Foster
mfoster
Newbie
 
Posts: 5
Joined: Thu Sep 17, 2009 2:39 pm

Re: Converting Text to HTML or XHTML

Postby Mofi » Mon Sep 28, 2009 3:31 am

There is no such command. But a small macro or script can make such a conversion. For example the following macro with property Continue if search string not found checked makes the first steps to convert a text into a HTML file. You can further adapt it to your needs.

Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
TrimTrailingSpaces
Find RegExp "%[ ^t]+"
Replace All ""
Loop 0
Find "^p^p^p"
Replace All "^p^p"
IfNotFound
ExitLoop
EndIf
EndLoop
Find RegExp "[~ ^t^r^n]"
EndSelect
Key LEFT ARROW
SelectToTop
IfSel
Delete
EndIf
Find MatchCase "&"
Replace All "&"
Find MatchCase "<"
Replace All "&lt;"
Find MatchCase ">"
Replace All "&gt;"
Find MatchCase """
Replace All "&quot;"
Bottom
Find RegExp Up "[~ ^t^r^n]"
EndSelect
Key LEFT ARROW
Key RIGHT ARROW
SelectToBottom
IfSel
Delete
EndIf
Top
Clipboard 9
CopyFilePath
"<html>
<head>
 <title>"
Paste
ClearClipboard
Clipboard 0
"</title>
"
IfColNumGt 1
DeleteToStartofLine
"</head>
<body>

<p>"
Find "^p^p"
Replace All "</p>^p^p<p>"
Bottom
"</p>

</body>
</html>
"
Top
Find MatchCase "<title"
Key RIGHT ARROW
Find RegExp "[~<]+"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Converting Text to HTML or XHTML

Postby mfoster » Mon Sep 28, 2009 2:26 pm

Thank you once again.

Mark Foster
mfoster
Newbie
 
Posts: 5
Joined: Thu Sep 17, 2009 2:39 pm


Return to UEStudio General Discussion