I do this all the time when doing any kind of text in TSE that I plan to put
in internet messages or transfer to Word, Notepad, or other word processors.
integer temp_id
/**************************************************************
Copy a block to the Windows clipboard.
Before being copied, the block is wrapped at the maximum line
length.
**************************************************************/
proc main()
integer right_margin, marked_it
marked_it = False
if isBlockMarked()
if not isBlockInCurrFile()
Warn("Block not in current file")
return ()
endif
elseif Query(UseCurrLineIfNoBlock)
MarkLine()
marked_it = True
else
Warn("No block")
return ()
endif
right_margin = Set(RightMargin, MAXLINELEN)
PushBlock()
PushPosition()
if temp_id == 0 or not GotoBufferId(temp_id)
temp_id = CreateTempBuffer()
endif
EmptyBuffer()
CopyBlock()
BegFile()
repeat until not WrapPara()
BegFile()
MarkChar()
EndFile()
MarkChar()
CopyToWinClip()
Set(RightMargin, right_margin)
PopPosition()
PopBlock()
if marked_it or Query(UnMarkAfterPaste) <> Off
UnMarkBlock()
endif
end
________________________________
From: sem...@googlegroups.com on behalf of Lane Whittaker
Sent: Thu 4/17/2008 2:13 AM
To: SemWare
Subject: [TSE] Unwrap Para for HTML?
If there still are wishes after using this macros or techniques, possibly supply some specific source code examples about how it should be and how it is now.
with friendly greetings,
Knud van Eeden
----- Original Message ----
From: Lane Whittaker <y8norx...@sneakemail.com>
To: SemWare <sem...@googlegroups.com>
Sent: Thursday, April 17, 2008 2:13:45 AM
Subject: [TSE] Unwrap Para for HTML?
Before I try to re-invent the wheel, has anyone done anything along
the lines of a macro to "unwrap" a paragraph? Probably in regards to
HTML.
The situation is I have a number of text files created in TSE that I
want to put on a Wiki website. While the page size suits me, my very
slight nodding acquaintance with HTML indicates it's preferable to not
have embedded EoLs in text bodies to make the page display cleanly for
others with different display requirements. So, I need to unwrap all
my paragraphs. The Wiki will recognize HTML code, but doesn't require
it. It will automatically adjust pasted long lines to fit the
display.
I've done it manually, so I know the issues. But over the course of
several thousand KB that gets tedious real fast. The real kicker is
detecting "lists". I don't see any way except the "Mark I Eyeball"
to catch them and skip over them. But even something that deals with
one para at time is an improvement over concatenating a line at a time
working backwards through a paragraph.
Anyone have anything or suggestions?
--LaneW
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
It seems it's called 1liner2.zip at this point and is at the top of the list.
http://www.semware.com/html/tseprofiles.php
The version I'm using came programmed to put two spaces after every period (like old typewriter formatting for the period at the end of a sentence). You may want to rem out that part of the code.
Fred Holmes
I can't see why XML is any kind of advantage for storing data, when you
have something like <gender>M</gender> for every person instead of a
simple M. That's almost a 20:1 inflation. Can you tell I started out
with cards? ;)
Steve
--
Steve Cramer
Athens, GA
http://www.savvypaddler.com
This is an XML to text converter:
Using TSE replace "</?.*>" by "" with options "gnx".
Caveat: it depends on the text not containing "<" and ">".
> Anybody have an XML to text converter? A client wants to send me a data
> file in XML but our software is set up to read flat ASCII.
>
> I can't see why XML is any kind of advantage for storing data, when you
> have something like <gender>M</gender> for every person instead of a
> simple M. That's almost a 20:1 inflation. Can you tell I started out
> with cards? ;)
>
> Steve
XML:
1. Easier data exchange: you can convert your data rather automatically to other formats
(at the price of putting some extra information in it). E.g. RSS.
2. Standard format: It uses a standard format
3. Formats to simplify XML have been created, e.g. JSON
4. In general I would go for tables (that is rows and columns to store the data in) which I store and handle in TSE on my local machine or USB stick. Then convert it e.g. to SQL which I copy/paste in a MySql client. And MySql has converting routines from database tables to XML.
Similar to mathematics, where the rectangle is one of the simplest geometric figures, the table (this rectangular collection of rows and columns) is one of the simplest structures (and most versatile structures) to store your data in.
5. XSLT is certainly not an intuitive language. It is a special case of a tree processing language (of which XML is a special case). So using recursion and the like. Rather difficult to learn. You usually copy paste from something that works, and adapt it to your needs.
with friendly greetings,
Knud van Eeden
----- Original Message ----
From: Steve Cramer <cram...@charter.net>
To: sem...@googlegroups.com
Sent: Thursday, April 17, 2008 3:58:53 PM
Subject: [TSE] XML
Anybody have an XML to text converter? A client wants to send me a data
file in XML but our software is set up to read flat ASCII.
I can't see why XML is any kind of advantage for storing data, when you
have something like <gender>M</gender> for every person instead of a
simple M. That's almost a 20:1 inflation. Can you tell I started out
with cards? ;)
Steve
--
Steve Cramer
Athens, GA
http://www.savvypaddler.com
Steve
How to convert XML to a text table?
1. In that case using an XSLT program would be indeed a method.
http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=XSLT%20convert%20XML%20SQL
So you have
1. Your XML program
2. Your XSLT program
3. In your XML program you write in the top where the XSLT program is located (usually in the same directory)
4. Then you start your XML program (e.g. from the command line
'start <your XML program name>', or double click it in e.g. WIndows Explorer) to see the (text table) output, which you can copy/paste
2. Other approaches:
XML -> CSV -> Import in database -> Table
And I have written a TSE routine (I use it myself quite a lot, some manual editing is currently necessary, but it does the job) which converts CSV to (=fixed (column distance) values. Or thus text tables.
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000031
3. The other way around convert a database table back to XML, you can e.g. use
mysqldump
with the parameter
-X
or
--xml
to dump your database tables as well-formed XML.
4. Also have a look at e.g. the program XMLSpy.
Steve
--
Ed Ahlsen-Girard
Senior Network Engineer
TYBRIN Corporation
tybrin.com
850-337-2830
850-337-2885 (fax)
This e-mail and any files transmitted with it are the property of TYBRIN Corporation, are private, and are intended solely for the use of the individual or entity to which this email is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please delete this message immediately. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited.
with friendly greetings,
Knud van Eeden
----- Original Message ----
From: knud van eeden <knud_va...@yahoo.com>
To: sem...@googlegroups.com
Sent: Thursday, April 17, 2008 6:49:26 PM
Subject: [TSE] Re: XML
Quick response:
How to convert XML to a text table?
1. In that case using an XSLT program would be indeed a method.
http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=XSLT%20convert%20XML%20SQL
So you have
1. Your XML program
2. Your XSLT program
3. In your XML program you write in the top where the XSLT program is located (usually in the same directory)
4. Then you start your XML program (e.g. from the command line
'start <your XML program name>', or double click it in e.g. WIndows Explorer) to see the (text table) output, which you can copy/paste
2. Other approaches:
XML -> CSV -> Import in database -> Table
And I have written a TSE routine (I use it myself quite a lot, some manual editing is currently necessary, but it does the job) which converts CSV to (=fixed (column distance) values. Or thus text tables.
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000031
3. The other way around convert a database table back to XML, you can e.g. use
mysqldump
with the parameter
-X
or
--xml
to dump your database tables as well-formed XML.
4. Also have a look at e.g. the program XMLSpy.
with friendly greetings,
Knud van Eeden
Steve
Converting XML to SQL and SQL to CSV
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000133
Depending on the given XML data file this might work out of the box, otherwise
there must be done some adaptations.
with friendly greetings,
Knud van Eeden
----- Original Message ----
From: Steve Cramer <cram...@charter.net>
To: sem...@googlegroups.com
Sent: Thursday, April 17, 2008 6:16:44 PM
Subject: [TSE] Re: XML
Here's a different XSLT style sheet approach that will yield the same
result as the example Knud provided.
--- cut here: begin --------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- output as text, strip whitespace -->
<xsl:output method="text" indent="no" />
<xsl:strip-space elements="*"/>
<!-- look for the table node -->
<xsl:template match="table" >
<xsl:apply-templates select="record" />
</xsl:template>
<xsl:template match="record">
<xsl:text>INSERT INTO </xsl:text>
<xsl:value-of select="/table/@name" />
<xsl:text>(</xsl:text>
<xsl:apply-templates select="child::*" mode="insert" />
<xsl:text>VALUES(</xsl:text>
<xsl:apply-templates select="child::*" mode="values" />
</xsl:template>
<xsl:template match="child::*" mode="insert">
<xsl:value-of select="name()" />
<xsl:choose>
<xsl:when test="position() != last()">, </xsl:when>
<xsl:otherwise>) </xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="child::*" mode="values">
<xsl:param name="quoted-value" select="concat('"',.,'"')" />
<xsl:value-of select="$quoted-value" />
<xsl:choose>
<xsl:when test="position() != last()">,</xsl:when>
<xsl:otherwise>);</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
--- cut here: end ----------------------------------------------------
Using Internet Explorer v7, I get an error using the XSLT stylesheet:
Required white space was missing. Error processing resource
<xsl:param name="quoted-value" select="concat('"',.,'"')" />
----------------------------------------------------^
with friendly greetings,
Knud van Eeden
Knud and Steve,
</xsl:stylesheet>
xsl:param name="quoted-value" select="concat('"',.,'"')"
I hope this works. I use Michael Kaye's Saxon. That might be the difference.
knud van eeden wrote:
> Jim,
>
> Using Internet Explorer v7, I get an error using the XSLT stylesheet:
>
> Required white space was missing. Error processing resource
> xsl:param name="quoted-value" select="concat('"',.,'"')"
<xsl:param name="quoted-value" select="concat( '"', . , '"' )" />
----- Original Message ----
From: Jim Sylva <jas...@northrim.net>
Sent: Friday, April 18, 2008 8:01:32 PM
Subject: [TSE] Re: XML
Jim
________________________________
From: sem...@googlegroups.com on behalf of S.E. Mitchell
Sent: Thu 4/17/2008 3:30 AM
To: sem...@googlegroups.com
--
Ed Ahlsen-Girard
Senior Network Engineer
TYBRIN Corporation
tybrin.com
850-337-2830
850-337-2885 (fax)
This e-mail and any files transmitted with it are the property of TYBRIN Corporation, are private, and are intended solely for the use of the individual or entity to which this email is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please delete this message immediately. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited.
-----Original Message-----
From: sem...@googlegroups.com [mailto:sem...@googlegroups.com] On Behalf Of Steve Cramer
Sent: Thursday, April 17, 2008 8:59 AM
To: sem...@googlegroups.com
cheers,
Rob.
-----Oorspronkelijk bericht-----
Van: sem...@googlegroups.com namens Ed Ahlsen-Girard
Verzonden: do 5-6-2008 19:55
Aan: sem...@googlegroups.com; cram...@charter.net
Onderwerp: [TSE] Re: XML
proc main()
lReplace('\<\/.*>', '', 'xn')
BegFile()
while lFind('\<{.#}\>\c', 'x')
InsertText(Format('':32-CurrCol():' '))
endwhile
lReplace('^{ *}\<{.#}\>', '\2\1', 'gxn')
BegFile()
while lFind('^$', 'x')
DelLine()
endwhile
BegFile()
end
<F2> main()
It's all done by magic. OTOH: TSE is a powerful toy...
cheers,
Rob den Heijer
-----Oorspronkelijk bericht-----
Van: sem...@googlegroups.com namens S.E. Mitchell
Verzonden: vr 6-6-2008 20:41
sorry pal
-----------------------------------------
Van: sem...@googlegroups.com namens Rens Duijsens
Verzonden: za 7-6-2008 23:19
Aan: sem...@googlegroups.com
Onderwerp: [TSE] Re: XML
Snap......
There goes my learning moment. :-)
Friendly greetings
Rens
________________________________
Van: Heijer, Rob den
Verzonden: za 7-6-2008 10:24
Aan: sem...@googlegroups.com
Onderwerp: RE: [TSE] Re: XML
Crude but working:
proc main()
// Eliminate all closing tags by replacing them with empty strings
lReplace('\<\/.*>', '', 'xn')
BegFile()
// Put all values in the same column:
// While finding a tag, place the cursor before the closing bracket ( \c )
while lFind('\<{.#}\>\c', 'x')
// Insert spaces to align the value
InsertText(Format('':32-CurrCol():' '))
endwhile
// Swap the leading spaces and the tag, at the same time removing "<" and ">"
lReplace('^{ *}\<{.#}\>', '\2\1', 'gxn')
BegFile()
// Delete remaining empty lines