# Generated from html_toc-1.2.0.gem by gem2rpm -*- rpm-spec -*-
%global gem_name html_toc
Name: rubygem-%{gem_name}
Version: 1.2.0
Release: 1%{?dist}
Summary: Generate and insert a table of contents into a HTML document
License: MIT
URL: https://github.com/GGadow/html_toc
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 2.1
BuildArch: noarch
%description
This gem is intended to be used in Rails pre-processing, after the page has
been generated but before it is delivered to the requestor.
It does a case-insensitive search in the source text for the pseudo-tag , which marks where the table of contents will be placed. If the tag is not
found, the unmodified source is returned.
If the tag is found, it searches the text for header tags in a given range,
and add an id attribute if the header does not already have one. If no headers
were found, it will remove the tag and return the modified source.
If there are headers, a link is generated for each one, using the header's
text and id for the link's text and href. The links are wrapped in some divs,
with classes and ids added so the table of contents can be styled. The
pseudo-tag is then replaced with the table of contents, and the the modified
source is returned.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
# Run the test suite.
popd
%files
%dir %{gem_instdir}
%{gem_libdir}
%{gem_instdir}/sample
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%changelog
* Tue Aug 24 2021 mockbuilder - 1.2.0-1
- Initial package