Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global enable_tests 0

Name:       marked
Version:    0.3.2
Release:    9%{?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
%if 0%{?fedora} >= 19
ExclusiveArch: %{nodejs_arches} noarch
%else
ExclusiveArch: %{ix86} x86_64 %{arm} noarch
%endif

BuildRequires:  nodejs-packaging
BuildRequires:  web-assets-devel
BuildRequires:  uglify-js

%if 0%{?enable_tests}
BuildRequires:  npm(express)
BuildRequires:  npm(markdown)
BuildRequires:  npm(showdown)
# Not yet packaged for Fedora.
# BuildRequires:  npm(robotskirt)
%endif

Requires:       js-marked = %{version}-%{release}

%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.


%package -n js-marked
Summary:    A markdown parser for JavaScript built for speed
Group:      System Environment/Libraries
Requires:   web-assets-filesystem

%description -n js-marked
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

# remove the bundled minified marked
rm -f marked.min.js


%build
uglifyjs --comments '/Copyright/' lib/marked.js -o marked.min.js


%install
mkdir -p %{buildroot}%{_jsdir}/marked
cp -pr lib/marked.js marked.min.js %{buildroot}%{_jsdir}/marked

mkdir -p %{buildroot}%{nodejs_sitelib}/marked
cp -pr package.json component.json \
    %{buildroot}%{nodejs_sitelib}/marked
mkdir -p %{buildroot}%{nodejs_sitelib}/marked/lib
ln -sf %{_jsdir}/marked/marked.js \
    %{buildroot}%{nodejs_sitelib}/marked/lib/marked.js
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_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

%nodejs_symlink_deps --check
# /usr/bin/npm install robotskirt
%__nodejs ./test/
%endif


%files
%{nodejs_sitelib}/marked
%{_bindir}/marked
%{_mandir}/man1/marked.1*


%files -n js-marked
%doc LICENSE README.md doc/
%{_jsdir}/marked

%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 23 2014 T.C. Hollingsworth <tchollingsworth@gmail.com> - 0.3.2-2
- build browser version

* Sat Apr 19 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.3.2-1
- update to upstream release 0.3.2

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Jun 27 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.9-2
- restrict to compatible arches

* Fri May 31 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.2.9-1
- update to upstream release 0.2.9

* 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