Question
Hi. Have searched everywhere, and can't find the answer to a simple question - how do I insert a tab into a regular page that will be changed into spaces?
.
- TWiki version:
- Web server:
- Server OS:
- Web browser:
- Client OS:
--
DavidHay - 27 Feb 2002
Answer
My editor (Multi-edit) does it for me. So you can copy-paste text into you browser window. But I am not sure what you want to accomplish. Do you want to align words over multiple lines? Web browsers are free play with whitespace characters when rendering a page. You have little control over spaces. Maybe you may want to use <VERBATIM> HTML tag? Or use HTML tables?
--
PeterMasiar - 28 Feb 2002
David may be familiar with the feature over on
WardsWiki that let's you insert tabs while editing and tabs are changed automatically to a group of three spaces on saving the page, thus making it a little easier to do the various three space indents.
Revised: Conversion of tabs to spaces is the default action on TWiki, and there is, AFAIK, no option to disable the conversion. (Note: I originally thought the feature did not exist on TWiki, which is why notes following this one may be confusing.)
tab test
tab test in pre
tab test in verbatim
I created the item below by entering <tab>*<space>tab..., and it is now displayed as a list item and converted to spaces.
New: After realizing my error, maybe I should try to summarize clearly what happens to tabs when entered on a TWiki page:
- When the TWiki page is saved each tab is converted to a group of (three) spaces.
- When a TWiki page is rendered, there are no tabs to render. Multiple spaces are treated per the appropriate rules of TWiki or HTML, for example:
- TWiki: "three spaces * space" at the beginning of a line creates a bullet list item, in other words, three spaces * space are replaced by TWiki "on the fly" with the appropriate HTML tags to make a list item
- HTML: multiple spaces, if any are left after the TWiki on the fly conversions, are rendered as a single space
--
RandyKramer - 28 Feb 2002
I'm having the opposite issue. I want to use tabs to format my text within an edit window, with the understanding that they are lost in the HTML rendering.
I'm trying to keep some table work I'm doing sane and readable in edit, because the formatting looks fine after its saved. However, the tabs disappear when I save the page and then load it again later in the editor. Is there a way to disable tab removal?
Example:
Using spaces, multiple rows don't line up without manual spacing to adjust for the size of the content.
| One | Two | Three | Four | Five |
| Five | Four | Three | Two | One |
If you use tabs (imitated by spaces here because they get removed), the rows line up without much effort. The tabs aren't preserved on save and get converted to spaces, wasting the effort of formatting the table.
| One | Two | Three | Four | Five |
| Five | Four | Three | Two | One |
Ideas?
--
RussellAdams - 13 Mar 2002
My guess is, are you using IE? On windows, tab will move cursor (focus) to next widget (form element on the screen) -- or to next HTML link, BTW. This is how browser behaves. IMHO there is nothing you can do about it, except apply old Micro$oft workaround:
don't use it. 
Full disclosure: I am using Win and IE, too.
--
PeterMasiar - 13 Mar 2002
Actually, again, this isn't concerning the browser or the way tabs render in HTML. I'm trying to keep multiple lines of text lined up when in the edit cgi text area. Tabs are entered just fine into the text box. In fact, if I go check the file that is created when I save, the tabs are intact. However, when its loaded next time for me to update the file, all the tabs are expanded into spaces. I'd like to find a way to disable this.
Oh, I'm running Linux and using Netscape. ;]
--
RussellAdams - 14 Mar 2002
Oops, found out I lied

-- modified my note of 28 Feb 2002 (above), based on
RussellAdams' observation that tabs
are converted to spaces.
--
RandyKramer - 15 Mar 2002
Please note that the tabs are not immediately converted into spaces when saved. Its when the edit screen is next opened that tabs are converted to spaces when read from the data file.
Line #180 in edit.cgi does the actual conversion.
180 $text =~ s/\t/ /go;
I think I'm going to patch my local version to apply that conversion upon viewing, before handling text formatting so the tabs instead of spaces for bullets work. However, I don't want the file changed. In order to keep my lines aligned, the tabs cannot be removed from the file.
I think I'll apply the conversion logic in view.cgi, on line 185 just before the handleCommonTags function call.
Can anyone advise me as to why I should not make this change, or anything it could adversely affect?
--
RussellAdams - 15 Mar 2002
To follow up to my prior note, there was no need to modify the viewer cgi. Bulleted items that use tabs for separation are still viewable when the tab conversion code is removed from edit.
Now I'm editing tables and my lines are staying properly formatted and aligned between lines! =]
--
RussellAdams - 15 Mar 2002