Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global enable_tests 0

Name:       marked
Version:    0.2.8
Release:    3%{?dist}
Summary:    A markdown parser for Node.js built for speed
License:    MIT
Group:      System Environment/Libraries
URL:        https://github.com/chjj/marked
Source0:    http://registry.npmjs.org/marked/-/marked-%{version}.tgz
# The test files are not included in the npm tarball.
# Source1 is generated by running Source10, which pulls from the upstream
# version control repository.
Source1:    tests-v%{version}.tar.bz2
Source10:   dl-tests.sh
BuildArch:  noarch

Patch0:     %{name}-0.2.8-fix-link-defs-after-blocks.patch

BuildRequires:  nodejs-devel

%if 0%{?enable_tests}
BuildRequires:  npm(express)
%endif

%description
marked is a full-featured markdown compiler that can parse huge chunks of
markdown without having to worry about caching the compiled output or
blocking for an unnecessarily long time.

marked is extremely fast and frequently outperforms similar markdown parsers.
marked is very concise and still implements all markdown features, as well
as GitHub Flavored Markdown features.

marked more or less passes the official markdown test suite in its entirety.
This is important because a surprising number of markdown compilers cannot
pass more than a few tests.


%prep
%setup -q -n package
%setup -q -T -D -a 1 -n package
%patch0 -p1


%build
#nothing to do


%install
mkdir -p %{buildroot}%{nodejs_sitelib}/marked
cp -pr package.json lib/ \
    %{buildroot}%{nodejs_sitelib}/marked
mkdir -p %{buildroot}%{nodejs_sitelib}/marked/bin
install -p -D -m0755 bin/marked \
    %{buildroot}%{nodejs_sitelib}/marked/bin/marked
mkdir -p %{buildroot}/%{_bindir}
ln -sf %{nodejs_sitelib}/marked/bin/marked \
    %{buildroot}%{_bindir}/marked

mkdir -p %{buildroot}%{_mandir}/man1
install -p -D -m0644 man/marked.1 \
    %{buildroot}%{_mandir}/man1/marked.1

%nodejs_symlink_deps


%if 0%{?enable_tests}
%check
# gfm_break test will always fail due to author's choice not to include gfm
# line breaks: https://github.com/chjj/marked/issues/49

# gfm_code_hr_list test is known to fail but the author has not yet arrived
# at a satisfactory solution: https://github.com/chjj/marked/pull/118

# def_blocks and double_link are also known to fail:
# https://github.com/chjj/marked/issues/136#issuecomment-15016714

cp -pr %{nodejs_sitelib} .
%__nodejs ./test/
%endif


%files
%doc LICENSE README.md
%{nodejs_sitelib}/marked
%{_bindir}/marked
%{_mandir}/man1/marked.1*


%changelog
* Sun Mar 17 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.8-3
- add further information about test failures (all known to fail)

* Tue Mar 12 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.8-2
- add information about test failures

* Thu Feb 14 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.8-1
- initial package