Unbundle fonts, improve fonts references
- properly handle unbundling fonts, so they're not present in -doc package - reference fonts as Web Assets to improve docs rendering when exported via web server Co-authored-by: Petr Menšík <pemensik@redhat.com>
This commit is contained in:
parent
8f8ec1f05d
commit
19b8629796
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
|||
|
||||
Name: python-%{srcname}
|
||||
Version: 1.0.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Sphinx theme for readthedocs.org
|
||||
|
||||
License: MIT
|
||||
|
@ -17,8 +17,6 @@ Source1: https://docs.readthedocs.io/en/latest/objects.inv
|
|||
# Remove all traces of html5shiv. We have no interest in supporting ancient
|
||||
# versions of Internet Explorer.
|
||||
Patch0: %{name}-html5shiv.patch
|
||||
# Unbundle fonts. Refer to local fonts instead.
|
||||
Patch1: %{name}-unbundle-fonts.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
@ -77,6 +75,35 @@ sed -e "s|\('https://docs\.readthedocs\.io/en/stable/', \)None|\1'%{SOURCE1}'|"
|
|||
-e "s|\('https://www\.sphinx-doc\.org/en/master/', \)None|\1'%{_docdir}/python-sphinx-doc/html/objects.inv'|" \
|
||||
-i docs/conf.py
|
||||
|
||||
# We patch the theme css files to unbundle fonts (they are required from Fedora)
|
||||
# Using Web Assets shall support the use case when documentation is
|
||||
# exported via web server
|
||||
# See: https://docs.fedoraproject.org/en-US/packaging-guidelines/Web_Assets/
|
||||
pushd sphinx_rtd_theme/static/css
|
||||
|
||||
rm -r fonts
|
||||
|
||||
# Edit the fonts references in theme.css and badge.css
|
||||
for FONT in lato-normal=lato/Lato-Regular.ttf \
|
||||
lato-bold=lato/Lato-Bold.ttf \
|
||||
lato-normal-italic=lato/Lato-Italic.ttf \
|
||||
lato-bold-italic=lato/Lato-BoldItalic.ttf \
|
||||
Roboto-Slab-Regular=google-roboto-slab-fonts/RobotoSlab-Regular.ttf \
|
||||
Roboto-Slab-Bold=google-roboto-slab-fonts/RobotoSlab-Bold.ttf;
|
||||
do
|
||||
L="${FONT%=*}"
|
||||
R="${FONT#*=}"
|
||||
sed \
|
||||
-e "s|src:\(url(fonts/$L\.[^)]*) format([^)]*),\?\)\+|src:url('/.sysassets/fonts/$R') type(\"truetype\")|g" \
|
||||
-i theme.css
|
||||
done
|
||||
|
||||
sed -e "s|src:url(fonts/fontawesome-webfont\.[^)]*);||" \
|
||||
-e "s|src:\(url(fonts/fontawesome-webfont\.[^)]*) format([^)]*),\?\)\+|src:local(\"fontawesome/FontAwesome\"),url('/.sysassets/fonts/fontawesome/fontawesome-webfont.ttf') format(\"truetype\")|" \
|
||||
-i badge_only.css theme.css
|
||||
|
||||
popd
|
||||
|
||||
# We cannot build the Javascript from source at this time, due to many missing
|
||||
# dependencies. Convince the build script to skip building the Javascript and
|
||||
# go on to the python.
|
||||
|
@ -101,14 +128,16 @@ rst2html --no-datestamp README.rst README.html
|
|||
rm docs/build/html/.buildinfo
|
||||
%endif
|
||||
|
||||
# Unbundle fonts
|
||||
rm -fr %{buildroot}%{python3_sitelib}/%{srcname}/static/css/fonts
|
||||
|
||||
%if %{without bootstrap}
|
||||
%check
|
||||
%if %{without bootstrap}
|
||||
%pytest
|
||||
%endif
|
||||
|
||||
# Test that the forbidden fonts were successfully removed from the css files
|
||||
! grep 'format("woff2\?")' \
|
||||
%{buildroot}%{python3_sitelib}/%{srcname}/static/css/badge_only.css \
|
||||
%{buildroot}%{python3_sitelib}/%{srcname}/static/css/theme.css
|
||||
|
||||
%files -n python%{python3_pkgversion}-%{srcname}
|
||||
%doc README.html
|
||||
%license LICENSE
|
||||
|
@ -145,6 +174,9 @@ rm -fr %{buildroot}%{python3_sitelib}/%{srcname}/static/css/fonts
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Mar 25 2022 Karolina Surma <ksurma@redhat.com> - 1.0.0-3
|
||||
- Unbundle fonts properly, improve referencing them in css files
|
||||
|
||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
|
|
Loading…
Reference in New Issue