File: j_latin2html

package info (click to toggle)
journal-dev 1-4
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 72 kB
  • ctags: 9
  • sloc: perl: 135; makefile: 50
file content (33 lines) | stat: -rwxr-xr-x 1,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/perl
#
# Last modification: Mon, 28 Oct 1996 08:55:33 +0200
#
# j_latin2html  - Copyright (c)1996 by Fabrizio Polacco <fpolacco@debian.org>.
# All rights reserved.  This program is free software; you can redistribute it
# and/or modify it under the same terms as Perl itself.

# This script is intended to be used to build the debian package of the html
# on-line magazine Pluto Journal, but can be used to easily build also other
# online magazines.

# Usage: j_latin2html <source-file> <dest-file> the script copies <source-file>
# into <dest-file> substituting each latin1 char with the corresponding HTML
# entity.

# require libwww-perl
use HTML::Entities %char2entity;

die "Usage: j_latin2html <source-file> <dest-file>\n" if scalar(@ARGV) != 2;
$IN = $ARGV[0];
$OUT = $ARGV[1];

open( OUT, "> $OUT") or die "Cannot open output file $OUT\n";
open(IN, $IN) or die "Cannot open input file $IN\n";
while ( <IN> )
{
	s/([\200-\377])/$HTML::Entities::char2entity{$1}/go;
	print OUT ;
}
close IN;
close OUT;