Tabs

N

Neal

Hi,

I writing an application which converts documents to HTML. At the moment
I'm converting tabs in the original document to:

    

which as you can imagine, is quite messy. Does anyone know another way
of
inserting tabs into a HTML document?

Thanks,


The solution would depend on *why* you are using the tabs. Is it a chart?
Use table markup. Is it a paragraph indent? <p style="text-indent:
4em;">djdjd</p>. There are other possibilities.
 
S

Sid Ismail

: Hi,
:
: I writing an application which converts documents to HTML. At the moment
: I'm converting tabs in the original document to:
:
: &nbsp;&nbsp;&nbsp;&nbsp;
:
: which as you can imagine, is quite messy. Does anyone know another way of
: inserting tabs into a HTML document?


Tables? Or use a spacer.gif? URL ?

Sid
 
W

Webcastmaker

I writing an application which converts documents to HTML. At the moment
I'm converting tabs in the original document to:
&nbsp;&nbsp;&nbsp;&nbsp;
which as you can imagine, is quite messy. Does anyone know another way of
inserting tabs into a HTML document?

See if you can get your program to make some assumptions about how
the tabs are used. For example if there is a single tab right after
a line feed, followed by a capital letter, then more than likely it
is the beginning of a paragraph where you can easily use some CSS to
make up the space. If it is several tabs in a row, then it is
probably a center. And if it is tab-text-tab-text-tab then it is
probably data for a table.

You know the documents, you would probably be the best at deciding
which assumptions work most of the time. Then you can automate the
majority of your work.
 
E

Ed

Hi,

I writing an application which converts documents to HTML. At the moment
I'm converting tabs in the original document to:

&nbsp;&nbsp;&nbsp;&nbsp;

which as you can imagine, is quite messy. Does anyone know another way of
inserting tabs into a HTML document?

Thanks,
 
T

Toby Inkster

Ed said:
I writing an application which converts documents to HTML. At the moment
I'm converting tabs in the original document to:
&nbsp;&nbsp;&nbsp;&nbsp;

That's arguably the best way for an automated converter to do it.

Another method might be:
<span class="tab"> </span>

with this style-sheet:
span.tab { padding-left: 4em; }
 
M

Mitja

Ed said:
Thanks for your replies.

Basically I want to convert the tabs in the original
documents to spaces. The number of spaces per tab is
decided by the user. By using &nbsp; I get the desired
result, but the HTML source is unreadable (it's just full
of &nbsp;). Does anyone know any alternatives?

It was said more than once: it depends on the use of tabs. Could you show us
an example of a document you're trying to convert?
 
D

Dylan Parry

Ed said:
It looks like using <PRE> </PRE> could solve my problem. I've
inserted a <FONT FACE="courier new"> statement inside the <PRE> block.
Could doing this cause any problems? Is it better to let the <PRE>
statement select the font?

I think actually that <pre> probably is the best solution for what you are
proposing, but I would suggest using CSS to set the font for the element,
and not font elements :)
 
M

Mitja

Ed said:
The type of document is VHDL source code. Here is an
example of some code:

main : process(RST, MCLK)
begin
if RST = '0' then
clock <= '1';
edge_count <= 0;
elsif rising_edge(MCLK) then
if edge_count = 3 then
clock <= not clock;
edge_count <= 0;
else
edge_count <= edge_count + 1;
end if;
end if;
end process main;

All of the tabs are from the left hand margin (e.g. no
text is centered or right hand justified).

In that case, I'd go for <pre>. If you want to color the code, you can still
nest <span>s inside that:

pre span { color:red }

<pre>
<span>function</span> foo()
<span>begin</span>
print(<span>"foo bar"</span>);
<span>end;</span>
</pre>

This example doesn't use classes, you'll probably want to introduce things
like span.keyword, span.string, ...
 
M

Mitja

Ed said:
It looks like using <PRE> </PRE> could solve my
problem. I've inserted a <FONT FACE="courier new">
statement inside the <PRE> block. Could doing this cause
any problems? Is it better to let the <PRE> statement
select the font?

Wow... what a delay. You post just appeared on my server. If you used
<font>, you probably won't understand the example I gave in my previous
post. I suggest reading a basic tutorial on css. Or maybe someone around
here is patient enough to write it all down and explain it to you. I'm not
;)
 
J

Jeff Thies

Toby said:
Ed wrote:




That's arguably the best way for an automated converter to do it.

Another method might be:
<span class="tab"> </span>

with this style-sheet:
span.tab { padding-left: 4em; }

works in everything but IE5 (works in IE6). Thread on this in
C.I.W.A.Stylesheets

Cheers,
Jeff
 
E

Ed

Ed said:
Hi,

I writing an application which converts documents to HTML. At the moment
I'm converting tabs in the original document to:

&nbsp;&nbsp;&nbsp;&nbsp;

which as you can imagine, is quite messy. Does anyone know another way of
inserting tabs into a HTML document?

Thanks,

Thanks for your replies.

Basically I want to convert the tabs in the original documents to spaces.
The number of spaces per tab is decided by the user. By using &nbsp; I get
the desired result, but the HTML source is unreadable (it's just full of
&nbsp;). Does anyone know any alternatives?

Thanks again,
 
E

Ed

Mitja said:
It was said more than once: it depends on the use of tabs. Could you show us
an example of a document you're trying to convert?

The type of document is VHDL source code. Here is an example of some code:

main : process(RST, MCLK)
begin
if RST = '0' then
clock <= '1';
edge_count <= 0;
elsif rising_edge(MCLK) then
if edge_count = 3 then
clock <= not clock;
edge_count <= 0;
else
edge_count <= edge_count + 1;
end if;
end if;
end process main;

All of the tabs are from the left hand margin (e.g. no text is centered or
right hand justified).
 
E

Ed

Ed said:
show

The type of document is VHDL source code. Here is an example of some code:

main : process(RST, MCLK)
begin
if RST = '0' then
clock <= '1';
edge_count <= 0;
elsif rising_edge(MCLK) then
if edge_count = 3 then
clock <= not clock;
edge_count <= 0;
else
edge_count <= edge_count + 1;
end if;
end if;
end process main;

All of the tabs are from the left hand margin (e.g. no text is centered or
right hand justified).

It looks like using <PRE> </PRE> could solve my problem. I've inserted a
<FONT FACE="courier new"> statement inside the <PRE> block. Could doing
this cause any problems? Is it better to let the <PRE> statement select the
font?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top