%{?nodejs_find_provides_and_requires}
%global commit edbe72ae43c820f5d6e417bd3f0a5a71f0f65046
%global installdir %{_jsdir}/highlight.js
%global assetdir %{_webassetdir}/highlight.js
Name: nodejs-highlight-js
Version: 7.5.0
Release: 4%{?dist}
Summary: Highlight.js syntax highlighting with language auto-detection for Node.js
License: BSD
Group: System Environment/Libraries
URL: https://github.com/isagalaev/highlight.js
Source0: https://github.com/isagalaev/highlight.js/archive/%{commit}/%{name}-%{version}.tar.gz
# yuicompressor is not yet available for Fedora.
Patch0: %{name}-7.5.0-Use-uglifyjs-instead-of-yuicompressor.jar.patch
BuildArch: noarch
%if 0%{?fedora} || 0%{?rhel} >= 7
ExclusiveArch: %{nodejs_arches} noarch
%else
ExclusiveArch: %{ix86} x86_64 %{arm} noarch
%endif
BuildRequires: nodejs-packaging
BuildRequires: uglify-js
BuildRequires: python3
BuildRequires: web-assets-devel
Requires: js-highlight-styles = 0:%{version}-%{release}
%description
Highlight.js highlights syntax in code examples on blogs, forums and, in fact,
on any web page. It's very easy to use because it works automatically: finds
blocks of code, detects a language, and highlights it.
%package -n js-highlight
Summary: Highlight.js syntax highlighting with language auto-detection for the browser
Group: System Environment/Libraries
Requires: web-assets-filesystem
Requires: js-highlight-styles = 0:%{version}-%{release}
%description -n js-highlight
Highlight.js highlights syntax in code examples on blogs, forums and, in fact,
on any web page. It's very easy to use because it works automatically: finds
blocks of code, detects a language, and highlights it.
%package -n js-highlight-styles
Summary: Stylesheets for use with highlight.js
Group: System Environment/Libraries
Requires: web-assets-filesystem
%description -n js-highlight-styles
Stylesheets for use with the js-highlight and nodejs-highlight-js packages.
%prep
%setup -q -n highlight.js-%{commit}
%patch0 -p1
rm -f tools/yuicompressor.jar
%build
# This creates build/lib/* and build/{package.json,LICENSE,README.md}
/usr/bin/python3 tools/build.py -t node
mv build node
# This creates build/highlight.pack.js
/usr/bin/python3 tools/build.py
mv build browser
%install
# Install stylesheets
mkdir -p %{buildroot}%{assetdir}
cp -pr src/styles \
%{buildroot}%{assetdir}
# Install Node.js version
mkdir -p %{buildroot}%{nodejs_sitelib}/highlight.js
pushd node
cp -pr package.json *.js \
%{buildroot}%{nodejs_sitelib}/highlight.js
ln -sf %{assetdir}/styles \
%{buildroot}%{nodejs_sitelib}/highlight.js/styles
popd
# Install browser version
mkdir -p %{buildroot}%{installdir}
pushd browser
cp -pr highlight.pack.js \
%{buildroot}%{installdir}
ln -sf %{assetdir}/styles \
%{buildroot}%{installdir}/styles
popd
%nodejs_symlink_deps
%files
%doc LICENSE README.md
%{nodejs_sitelib}/highlight.js
%files -n js-highlight
%doc LICENSE README.md
%{installdir}
%files -n js-highlight-styles
%{assetdir}
%changelog
* Thu May 08 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 7.5.0-4
- depend explicitly on latest version of uglifyjs
* Sat Apr 26 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 7.5.0-3
- remove logic for building on EL6
* Sat Apr 26 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 7.5.0-2
- add logic for building on EL6
* Sat Apr 26 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 7.5.0-1
- update to upstream release 7.5.0
- build highlight.pack.js (#1089945), but patch to use uglifyjs instead of
yuicompressor which is not yet available on Fedora
- create js-highlight subpackage and adhere to new web asset guidelines
- include stylesheets as subpackage
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Jun 19 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 7.3.0-2
- rebuild for missing npm(highlight-js) provides on EL6
* Fri Mar 15 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 7.3.0-1
- initial package