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