TabStops and Tab Spacings
hakan at exformedia.se
hakan at exformedia.se
Wed Mar 6 15:16:50 EST 2019
There is a tab-size attribute that you can use but it can’t contain more than one number and it only handles ”number of spaces” for a tab like
tab-size: 6
Will give you 6-spaced tab.
To get the layout in HTML I instead suggest another approach. Replace each tab with an HTML-element to convert the text into something more HTML-like. I.e.
1<tab>2<tab>3 can be converted to something like
<span>1</span><span>2</span><span>3</span>
Then you can style your HTML in the way you want…
Or if you really want table data in HTML you can use a (drumroll please ;) <table>!
Converting a text field with tabs to an HTML table is a fairly straightforward process:
function tabTextToHTMLTable pText
set the itemDelimiter to tab
put "<table>” into tHTML
repeat for each line tLine in pText
put "<tr>” after tHTML
repeat for each item tItem in tLine
put ”<td>” & tItem & ”</td>” after tHTML
end repeat
put ”</tr>” after tHTML
end repeat
put "</table>” after tHTML
return tHTML
end tabTextToHTMLTable
There is an OLD proposal (like from 1998 or 97 if I remember correct) about tab-stops in HTML but to my knowledge it has never been implemented.
:-Håkan
On 5 Mar 2019, 14:59 +0100, hh via use-livecode <use-livecode at lists.runrev.com>, wrote:
> > Roger G. wrote:
> > Is there any way to export myFld to URL and retain the Tab spacings 15,250,320 ?
> > ...
> > I’m working with rtfText instead of HTMLText. (Again, not sure if that makes a
> > difference or even what the trades are of each).
>
> RtfText is, without a large JavaScript library, unusable as input for a browser
> widget (or a browser). The htmltext retains, alike rtfText, styled formatting.
>
> > Roger G. wrote:
> > I am not converting a "simple table field" but rather a simple field with
> > tabStops.
>
> A simple field with tabstops as input is OK.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list