BETAmodules.com is in beta — open to partnerships & joint ventures.Build with us

html_toc

v1.2.0RubyGems· Ruby

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 <toc />, 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 <toc /> pseudo-tag is then replaced with the table of contents, and the the modified source is returned.

The verdict
Abandoned. Last published 11 years ago. No recent activity — look for a maintained alternative.
No recent activity — look for a maintained alternative.
Live from the RubyGems registry · derived rules, not AI
How it scores
MaintenanceAbandoned
PopularityNiche
SecurityClean
LicensePermissive
DepsZero deps
Maintenance
Last published 11 years ago.
Popularity
6 downloads / week
Security
No known advisories for this version (OSV).
License
MIT
Dependencies
No runtime dependencies
Recent releases
  • 1.2.011 years ago
  • 1.1.011 years ago
  • 1.0.211 years ago
  • 1.0.111 years ago
  • 1.0.011 years ago
html_toc — 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 <toc />, 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 <toc /> pseudo-tag is then replaced with the table of contents, and the the modified source is returned. (Ruby / RubyGems) · Modules