how to format a $htmlpage without form feed

O

Oliver Bleckmann

perhaps a simple question ;-)
how to format a html page without form feeds?
i thougt this would work, but it doesn't...
$htmlpage =~ s/\</\<\n/S;
replace the > of each tag with a > plus form feed
any idea?
 
J

John Bokma

Oliver said:
perhaps a simple question ;-)
how to format a html page without form feeds?
i thougt this would work, but it doesn't...
$htmlpage =~ s/\</\<\n/S;
replace the > of each tag with a > plus form feed
any idea?

[1] \n is not form feed
[2] what do you want to do? breaking lines? That's an HTML question
 
T

Tad McClellan

Oliver Bleckmann said:
i thougt this would work, but it doesn't...
$htmlpage =~ s/\</\<\n/S;


Of course not, it does not even compile...

any idea?


Writing actual Perl code would be a good idea. :)

You must get it to compile and run before it even has a chance to "work".



Have you seen the Posting Guidelines that are posted here frequently?
 
O

Oliver Bleckmann

sorry line feed and yes it is a html question if you view it in the browser
but theres is no line feed in raw text at all
John Bokma said:
Oliver said:
perhaps a simple question ;-)
how to format a html page without form feeds?
i thougt this would work, but it doesn't...
$htmlpage =~ s/\</\<\n/S;
replace the > of each tag with a > plus form feed
any idea?

[1] \n is not form feed
[2] what do you want to do? breaking lines? That's an HTML question
 
T

Tad McClellan

Oliver Bleckmann said:
$htmlpage =~ s/\</\<\n/S;
replace the > of each tag with a > plus form feed


You have those little >pointy< things going in 2 different
directions there, so which is it?

\n is NOT a "form feed", it is a "line feed".

\f is a "form feed" character.


Whitespace does not matter in HTML, so even if you did make the
change I think you are attempting, it would not change how the
webpage was displayed in a browser.

Do you want to do this just so it is easier to read the raw HTML file,
or do you want to add <br>eaks that the browser will act on?
 
J

Jürgen Exner

Oliver said:
perhaps a simple question ;-)
how to format a html page without form feeds?

You could use newlines instead of form feeds.

Joking aside, are you talking about formatting the HTML source code or about
formatting the rendered result in a browser?
i thougt this would work, but it doesn't...
$htmlpage =~ s/\</\<\n/S;
replace the > of each tag with a > plus form feed

Well, your text doesn't seem to have anything to do with your code fragment
Which one is it?

jue
 
J

John Bokma

Oliver said:
sorry line feed and yes it is a html question if you view it in the
browser but theres is no line feed in raw text at all

[1] don't top post
[2] This is a Perl group, not an HTML group.
 
O

Oliver Bleckmann

ok guys,
i see that you don't understand what i mean.
at first: this has nothing to do with html rendering in a browser. italk
about the raw text.
for i am german, my english isn't the best.
i mean a line feet - sorry my fault - which should be used to format a
string without any line feed (the \n thing, you know)
again this has nothing to do with <br>.
the only thing is, that this string consists of html tags. it would be
nice - just for reading - to break a line after every
closed tag - that means after a ">".

a substitution of the ">" by a ">" with following line feet doesn't work
!!!!!!!!!!
ok, this is a shortend version - compiles and works, if you skip the
supstitoution block

use LWP::Simple;
$URL="http://de.finance.yahoo.com/q/cq?s=710000&m=a";
$inh = get($URL);
open (DATEI, ">c:/boerse.htm") or die "Couldn't open for writing:
$!\n";

if ( $inh =~ m/(.+)Tabellenansicht(.+)/s )
{
$inh2 = $2;
}
if ( $inh2 =~ m/(.+)Kursdaten downloaden(.+)/s )
{
$inh3 = $1;
}

if ( $inh3 = s/"\>"/"\>\n"/sgoi)
{
print DATEI $inh3;
}
close (DATEI);
 
T

Tad McClellan

Oliver Bleckmann said:
if ( $inh3 = s/"\>"/"\>\n"/sgoi)


You are requiring a 3-character substring:
double quote
closing angle bracket
double quote

If your angle brackets don't have quote characters, then the
pattern will not match.

If the pattern does not match then s/// does not do anything.

You need to write a pattern that will match rather than fail,
take out the double quotes.

And the backslashes, angle brackets are not special in regexes
nor in strings.

And the s///s option, it does not do anything when there is no
dot (.) in your pattern.

And the s///o option, it does not do anything when there is no
variable part in your pattern.

And the s///i option, it does not do anything when there are no
letters in your pattern.


Do not throw options onto the end willy nilly.

Use the ones you need, don't use the ones you don't need.

To do that, you will need to understand what each does, see the docs.
 
O

Oliver Bleckmann

damn, that's what i started with - was in the original code paster from tv
parser, another very old project - and now
it works! I must have been too tired yesterday, thanks.
 
A

Alan J. Flavell

ok guys,
i see that you don't understand what i mean.

I see that you haven't yet positioned yourself to make effective use
of Usenet.
for i am german, my english isn't the best.

In meine Erfahrung, erwarten die .de-Gruppen *auch* (koennete sagen
"noch strenger"), dass man die usenet-Regeln ("Netiquette") einhaelt.
http://www.kirchwitz.de/~amk/dni/einleitung und de.newusers.infos
koennte helfen.

Anyway, the key to solving a complex problem (and, based on what
you're posting, this appears to represent a complex problem for you)
is to identify the parts of the problem, and solve each of them *in
their proper place*. If you're having problems with the HTML that
you're generating from a Perl script, then the right place to solve
that is a forum where HTML is on topic, not a Perl programming group.

The only real Perl problem relevance that I've noticed so far in your
posting to this thread is the meaning of \n, which you got wrong at
first and then seem to have reacted inappropriately when it was
pointed out to you. The killfile awaits.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top