Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global commit f08dbfd8c33d7d5c30d736b5a4ef4d1f361e93ae

%global installdir  %{_jsdir}/highlight.js
%global assetdir    %{_webassetdir}/highlight.js

Name:       nodejs-highlight-js
Version:    8.0.0
Release:    3%{?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
ExclusiveArch:  %{nodejs_arches} noarch

BuildRequires:  nodejs-packaging
BuildRequires:  python3
BuildRequires:  uglify-js
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 lib/ \
    %{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
* Sun Apr 27 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 8.0.0-3
- fix incorrect changelog entry

* Sun Apr 27 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 8.0.0-2
- explicitly Require latest version of uglify-js

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

* 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