1: A simple program that takes a text file and then converts it to html pls leave feed back im new so dont burn me to much
2:
3:
4:
5: #!/usr/bin/perl
6:
7: # webulid sipel text to html conversion
8: #no links boldface blank space no crap
9:
10: $title = '';
11: $bgcolor = '';
12: $text = '';
13: $head = '';
14: $mail = '';
15:
16: print "enter the title to use for your web page: ";
17: chomp($title = <STDIN>);
18:
19: foreach $color ('backround', 'text') {
20: $in = '';
21: while () {
22: print "enter the $color color )? for options): ";
23: chomp($in = <stdin>);
24: $in = lc $in;
25:
26: if ($in eq '?') { #print help
27: print "One of: \nwhite, black, red, green, blue,\n";
28: print "orange, purple, yellow aqua, gray,\n";
29: print "silver, fuchsia, lime, maroon,navy,\n";
30: print "olive, or return for none\n";
31: next;
32: } elsif ($in eq '' or
33: $in eq 'white' or
34: $in eq 'black' or
35: $in eq 'red' or
36: $in eq 'blue' or
37: $in eq 'green' or
38: $in eq 'orange' or
39: $in eq 'purple' or
40: $in eq 'yellow' or
41: $in eq 'aqua' or
42: $in eq 'gray' or
43: $in eq 'silver' or
44: $in eq 'fuchisa' or
45: $in eq 'lime' or
46: $in eq 'maroon' or
47: $in eq 'navy' or
48: $in eq 'olive') { last; }
49: else {
50: print "that's not a color.\n";
51: }
52: }
53:
54: if ($color eq 'backround') {
55: $bgcolor = $in;
56: } else {
57: $text = $in;
58: }
59: }
60:
61: print "enter a heading: ";
62: chomp($head = <STDIN>);
63:
64: print "enter your email address: ";
65: chomp($mail = <STDIN>);
66:
67: print '*' x 30;
68:
69: print "\n<HTML>\n<HEAD>\n<TITLE>$title</TITLE>\n";
70: print "</HEAD>\n<BODY";
71: if ($bgcolor ne '') {print qq( BGCOLOR="bgcolor"); }
72: if ($text ne '') { print qq( TEXT="$text"); }
73: print">\n";
74: print"<H1>$head</h1>\n<p>";
75:
76: while (<>) {
77: if ($_ eq "\n") {
78: print "<p>\n";
79: } else {
80: print $_;
81: }
82: }
83:
84: print qq(<HR\n<ADDRESS><A HREF="mailto:$mail</A></ADDRESS>\n);
85: print "</BODY>\n</HTML>\n";
86:
87:
88:
89:
90:
91:
92:
93:
94:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: text2html
by tachyon (Chancellor) on Jul 09, 2001 at 20:14 UTC | |
|
Re: text2html
by Chady (Priest) on Jul 09, 2001 at 10:45 UTC | |
|
Re: text2html
by Anonymous Monk on Jul 09, 2001 at 22:38 UTC |