mirror of
https://git.freebsd.org/ports.git
synced 2025-07-17 17:29:23 -04:00
Add p5-SGML-Parser-OpenSP 0.100r1, parse SGML documents using OpenSP.
PR: ports/114975 Submitted by: Naram Qashat <cyberbotx at cyberbotx.com> Approved by: rafan (mentor, implicit)
This commit is contained in:
parent
568bb68fda
commit
7e4b26ddf0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=196500
11 changed files with 277 additions and 0 deletions
|
@ -473,6 +473,7 @@
|
|||
SUBDIR += p5-Regexp-Log
|
||||
SUBDIR += p5-Regexp-Log-Common
|
||||
SUBDIR += p5-SGML-DTDParse
|
||||
SUBDIR += p5-SGML-Parser-OpenSP
|
||||
SUBDIR += p5-SGMLSpm
|
||||
SUBDIR += p5-SVG
|
||||
SUBDIR += p5-Search-Estraier
|
||||
|
|
31
textproc/p5-SGML-Parser-OpenSP/Makefile
Normal file
31
textproc/p5-SGML-Parser-OpenSP/Makefile
Normal file
|
@ -0,0 +1,31 @@
|
|||
# New ports collection makefile for: p5-SGML-Parser-OpenSP
|
||||
# Date created: 27 August 2007
|
||||
# Whom: Naram Qashat <cyberbotx@cyberbotx.com>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= SGML-Parser-OpenSP
|
||||
PORTVERSION= 0.100r1
|
||||
CATEGORIES= textproc perl5
|
||||
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
|
||||
MASTER_SITE_SUBDIR= SGML
|
||||
PKGNAMEPREFIX= p5-
|
||||
DISTNAME= ${PORTNAME}-0.99
|
||||
|
||||
MAINTAINER= cyberbotx@cyberbotx.com
|
||||
COMMENT= Parse SGML documents using OpenSP
|
||||
|
||||
BUILD_DEPENDS= onsgmls:${PORTSDIR}/textproc/opensp \
|
||||
p5-File-Temp>=0:${PORTSDIR}/devel/p5-File-Temp \
|
||||
p5-Class-Accessor>=0:${PORTSDIR}/devel/p5-Class-Accessor
|
||||
RUN_DEPENDS= ${BUILD_DEPENDS}
|
||||
|
||||
USE_DOS2UNIX= yes
|
||||
PERL_CONFIGURE= yes
|
||||
CC= ${CXX}
|
||||
CONFIGURE_ARGS+="INC=-I${LOCALBASE}/include -I${LOCALBASE}/lib"
|
||||
|
||||
MAN3= SGML::Parser::OpenSP.3 SGML::Parser::OpenSP::Tools.3
|
||||
|
||||
.include <bsd.port.mk>
|
3
textproc/p5-SGML-Parser-OpenSP/distinfo
Normal file
3
textproc/p5-SGML-Parser-OpenSP/distinfo
Normal file
|
@ -0,0 +1,3 @@
|
|||
MD5 (SGML-Parser-OpenSP-0.99.tar.gz) = cb08669ed566ef4070671cf57aa749e3
|
||||
SHA256 (SGML-Parser-OpenSP-0.99.tar.gz) = 4822da26240b6feb2e435d84053377eb421afda584439b16da0f31f8fcfddc1b
|
||||
SIZE (SGML-Parser-OpenSP-0.99.tar.gz) = 33761
|
12
textproc/p5-SGML-Parser-OpenSP/files/patch-MANIFEST
Normal file
12
textproc/p5-SGML-Parser-OpenSP/files/patch-MANIFEST
Normal file
|
@ -0,0 +1,12 @@
|
|||
--- MANIFEST.orig 2007-07-29 03:17:26.000000000 +0800
|
||||
+++ MANIFEST 2007-07-29 03:17:35.000000000 +0800
|
||||
@@ -23,6 +23,9 @@
|
||||
t/17splitmessage.t
|
||||
t/18halt.t
|
||||
t/19refcounting.t
|
||||
+t/20passfd.t
|
||||
+t/21parsestring.t
|
||||
+t/22mwarnings.t
|
||||
t/98podsyn.t
|
||||
t/99podcov.t
|
||||
lib/SGML/Parser/OpenSP.pm
|
13
textproc/p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
Normal file
13
textproc/p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
Normal file
|
@ -0,0 +1,13 @@
|
|||
--- Makefile.PL.orig 2007-07-29 03:05:27.000000000 +0800
|
||||
+++ Makefile.PL 2007-07-29 03:06:38.000000000 +0800
|
||||
@@ -26,6 +26,10 @@
|
||||
Test::Exception => 0,
|
||||
File::Temp => 0,
|
||||
},
|
||||
+ PM => {
|
||||
+ 'lib/SGML/Parser/OpenSP.pm' => '$(INST_LIB)/SGML/Parser/OpenSP.pm',
|
||||
+ 'lib/SGML/Parser/OpenSP/Tools.pm' => '$(INST_LIB)/SGML/Parser/OpenSP/Tools.pm'
|
||||
+ },
|
||||
($] >= 5.005 ?
|
||||
(ABSTRACT_FROM => 'lib/SGML/Parser/OpenSP.pm',
|
||||
AUTHOR => 'Bjoern Hoehrmann <bjoern@hoehrmann.de>') : ()),
|
11
textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
Normal file
11
textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- OpenSP.xs.orig 2007-07-29 02:53:09.000000000 +0800
|
||||
+++ OpenSP.xs 2007-07-29 02:53:39.000000000 +0800
|
||||
@@ -445,7 +445,7 @@
|
||||
AV* av = (AV*)rv;
|
||||
I32 len = av_len(av);
|
||||
|
||||
- for (I32 i = 0; i < len; ++i)
|
||||
+ for (I32 i = 0; i <= len; ++i)
|
||||
{
|
||||
SV** svp = av_fetch(av, i, 0);
|
||||
|
50
textproc/p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
Normal file
50
textproc/p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
Normal file
|
@ -0,0 +1,50 @@
|
|||
--- /dev/null Fri Jul 27 20:05:08 2007
|
||||
+++ t/20passfd.t Fri Jul 27 20:06:50 2007
|
||||
X@@ -0,0 +1,46 @@
|
||||
+# 20passfd.t -- ...
|
||||
+#
|
||||
+# $Id: 20passfd.t,v 1.4 2005/08/14 18:07:19 hoehrmann Exp $
|
||||
+
|
||||
+use strict;
|
||||
+use warnings;
|
||||
+use Test::More tests => 7;
|
||||
+use Test::Exception;
|
||||
+use File::Spec qw();
|
||||
+
|
||||
+use constant NO_DOCTYPE => File::Spec->catfile('samples', 'no-doctype.xml');
|
||||
+use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
|
||||
+
|
||||
+BEGIN { use_ok('SGML::Parser::OpenSP') };
|
||||
+require_ok('SGML::Parser::OpenSP');
|
||||
+my $p = SGML::Parser::OpenSP->new;
|
||||
+isa_ok($p, 'SGML::Parser::OpenSP');
|
||||
+
|
||||
+sub TestHandler20::new { bless{ok1=>0},shift }
|
||||
+sub TestHandler20::start_element { shift->{ok1}++ }
|
||||
+
|
||||
+sub TestHandler21::new { bless{ok1=>0},shift }
|
||||
+sub TestHandler21::start_element { shift->{ok1}++ }
|
||||
+
|
||||
+#
|
||||
+# Check pass as filename (should work on all platforms).
|
||||
+$p = SGML::Parser::OpenSP->new;
|
||||
+my $h1 = TestHandler20->new;
|
||||
+$p->handler($h1);
|
||||
+$p->pass_file_descriptor(0);
|
||||
+lives_ok { $p->parse_string("<no-doctype></no-doctype>") } 'parse_string with temp file name';
|
||||
+is($h1->{ok1}, 1, "temp file name handler called");
|
||||
+undef $p;
|
||||
+
|
||||
+#
|
||||
+# Check pass as file descriptor (not on Win32).
|
||||
+SKIP: {
|
||||
+ skip 'passing fds for temp files not supported on Win32', 2 if $^O eq 'MSWin32';
|
||||
+ $p = SGML::Parser::OpenSP->new;
|
||||
+ my $h2 = TestHandler21->new;
|
||||
+ $p->handler($h2);
|
||||
+ $p->pass_file_descriptor(1);
|
||||
+ lives_ok { $p->parse_string("<no-doctype></no-doctype>") } 'parse by fd';
|
||||
+ is($h2->{ok1}, 1, "temp file descriptor handler called");
|
||||
+ undef $p;
|
||||
+}
|
||||
|
69
textproc/p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
Normal file
69
textproc/p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
Normal file
|
@ -0,0 +1,69 @@
|
|||
--- /dev/null Fri Jul 27 20:05:08 2007
|
||||
+++ t/21parsestring.t Fri Jul 27 20:06:55 2007
|
||||
X@@ -0,0 +1,65 @@
|
||||
+# 06parseliteral.t -- ...
|
||||
+#
|
||||
+# $Id: 21parsestring.t,v 1.1 2006/03/06 08:51:59 tbe Exp $
|
||||
+
|
||||
+use strict;
|
||||
+use warnings;
|
||||
+use Test::More tests => 13;
|
||||
+use Test::Exception;
|
||||
+use File::Spec qw();
|
||||
+
|
||||
+use constant NO_DOCTYPE => File::Spec->catfile('samples', 'no-doctype.xml');
|
||||
+use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
|
||||
+
|
||||
+BEGIN { use_ok('SGML::Parser::OpenSP') };
|
||||
+require_ok('SGML::Parser::OpenSP');
|
||||
+my $p = SGML::Parser::OpenSP->new;
|
||||
+isa_ok($p, 'SGML::Parser::OpenSP');
|
||||
+
|
||||
+#########################################################
|
||||
+## Parse using ->parse_string().
|
||||
+#########################################################
|
||||
+
|
||||
+sub TestHandler1::new { bless{ok1=>0,ok2=>0,ok3=>0,ok4=>0,ok5=>0,
|
||||
+ ok6=>0,ok7=>0,ok8=>0,ok9=>0,oka=>0},shift }
|
||||
+sub TestHandler1::start_element {
|
||||
+ my $s = shift;
|
||||
+ my $e = shift;
|
||||
+
|
||||
+ return unless defined $s;
|
||||
+ return unless defined $e;
|
||||
+
|
||||
+ $s->{ok1}++ if UNIVERSAL::isa($s, 'TestHandler1');
|
||||
+
|
||||
+ # Name
|
||||
+ $s->{ok2}++ if exists $e->{Name};
|
||||
+ $s->{ok3}++ if $e->{Name} =~ /no-doctype/i;
|
||||
+
|
||||
+ # Attributes
|
||||
+ $s->{ok4}++ if exists $e->{Attributes};
|
||||
+ $s->{ok5}++ if UNIVERSAL::isa($e->{Attributes}, "HASH");
|
||||
+ $s->{ok6}++ if scalar(keys(%{$_[1]->{Attributes}})) == 0;
|
||||
+
|
||||
+ # Included
|
||||
+ $s->{ok7}++ if exists $e->{Included};
|
||||
+ $s->{ok8}++ if $e->{Included} == 0;
|
||||
+
|
||||
+ # ContentType
|
||||
+ $s->{ok9}++ if exists $e->{ContentType};
|
||||
+}
|
||||
+
|
||||
+my $h1 = TestHandler1->new;
|
||||
+
|
||||
+$p->handler($h1);
|
||||
+lives_ok { $p->parse_string("<no-doctype></no-doctype>") }
|
||||
+ 'parsing with parse_string()';
|
||||
+
|
||||
+ok($h1->{ok1}, 'self to handler');
|
||||
+ok($h1->{ok2}, 'has name');
|
||||
+ok($h1->{ok3}, 'proper name');
|
||||
+ok($h1->{ok4}, 'has attrs');
|
||||
+ok($h1->{ok5}, 'attrs hash ref');
|
||||
+ok($h1->{ok6}, 'proper attrs');
|
||||
+ok($h1->{ok7}, 'has included');
|
||||
+ok($h1->{ok8}, 'included == 0');
|
||||
+ok($h1->{ok9}, 'has content type');
|
||||
|
71
textproc/p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
Normal file
71
textproc/p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
Normal file
|
@ -0,0 +1,71 @@
|
|||
--- /dev/null Fri Jul 27 20:05:08 2007
|
||||
+++ t/22mwarnings.t Fri Jul 27 20:06:59 2007
|
||||
@@ -0,0 +1,67 @@
|
||||
+# 10errors.t -- ...
|
||||
+#
|
||||
+# $Id: 22mwarnings.t,v 1.1 2006/11/07 11:14:13 hoehrmann Exp $
|
||||
+
|
||||
+use strict;
|
||||
+use warnings;
|
||||
+use Test::More tests => 7;
|
||||
+use Test::Exception;
|
||||
+use File::Spec qw();
|
||||
+
|
||||
+use constant NO_DOCTYPE => File::Spec->catfile('samples', 'no-doctype.xml');
|
||||
+use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
|
||||
+
|
||||
+BEGIN { use_ok('SGML::Parser::OpenSP') };
|
||||
+require_ok('SGML::Parser::OpenSP');
|
||||
+my $p = SGML::Parser::OpenSP->new;
|
||||
+isa_ok($p, 'SGML::Parser::OpenSP');
|
||||
+
|
||||
+#########################################################
|
||||
+## Error reporting
|
||||
+#########################################################
|
||||
+
|
||||
+sub TestHandler5::new { bless{ok=>0},shift }
|
||||
+sub TestHandler5::error
|
||||
+{
|
||||
+ return unless @_ == 2;
|
||||
+ $_[0]->{ok}++ if $_[1]->{Message} =~ /:8:7:W:/;
|
||||
+}
|
||||
+
|
||||
+my $h5 = TestHandler5->new;
|
||||
+$p->catalogs(TEST_CATALOG);
|
||||
+$p->warnings('xml');
|
||||
+$p->handler($h5);
|
||||
+lives_ok { $p->parse("<LITERAL>" . <<"__DOC__");
|
||||
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
+<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
+<head>
|
||||
+<title></title>
|
||||
+</head>
|
||||
+<body>
|
||||
+<p>foo & bar</p>
|
||||
+</body>
|
||||
+</html>
|
||||
+__DOC__
|
||||
+} 'ampersand as data';
|
||||
+
|
||||
+is($h5->{ok}, 1, 'ampersand as data generates warning');
|
||||
+
|
||||
+# special case
|
||||
+$p->warnings(qw/non-sgml-char-ref valid no-duplicate xml/);
|
||||
+
|
||||
+lives_ok { $p->parse("<LITERAL>" . <<"__DOC__");
|
||||
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
+<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
+<head>
|
||||
+<title></title>
|
||||
+</head>
|
||||
+<body>
|
||||
+<p>foo & bar</p>
|
||||
+</body>
|
||||
+</html>
|
||||
+__DOC__
|
||||
+} 'ampersand as data';
|
||||
+
|
||||
+is($h5->{ok}, 2, 'ampersand as data generates warning');
|
||||
|
5
textproc/p5-SGML-Parser-OpenSP/pkg-descr
Normal file
5
textproc/p5-SGML-Parser-OpenSP/pkg-descr
Normal file
|
@ -0,0 +1,5 @@
|
|||
SGML::Parser::OpenSP is an interface to the OpenSP parser. It allows for
|
||||
Perl scripts to parse an SGML document (including HTML) using the OpenSP
|
||||
parser.
|
||||
|
||||
WWW: http://search.cpan.org/dist/SGML-Parser-OpenSP/
|
11
textproc/p5-SGML-Parser-OpenSP/pkg-plist
Normal file
11
textproc/p5-SGML-Parser-OpenSP/pkg-plist
Normal file
|
@ -0,0 +1,11 @@
|
|||
%%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP/OpenSP.so
|
||||
%%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP/OpenSP.bs
|
||||
%%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP/.packlist
|
||||
%%SITE_PERL%%/%%PERL_ARCH%%/SGML/Parser/OpenSP.pm
|
||||
%%SITE_PERL%%/%%PERL_ARCH%%/SGML/Parser/OpenSP/Tools.pm
|
||||
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP
|
||||
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser
|
||||
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML
|
||||
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/SGML/Parser/OpenSP
|
||||
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/SGML/Parser
|
||||
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/SGML
|
Loading…
Add table
Reference in a new issue