Skip to content

Commit

Permalink
Merge branch 'release/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sommerregen committed Sep 9, 2015
2 parents c61e866 + 570cf0b commit f62f859
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

2. [](#improved)
* Added blueprints for Grav Admin plugin
* Document PHP iconv Requirement [#1](https://github.com/Sommerregen/grav-plugin-toc/issues/1)
3. [](#bugfix)
* Fixed [#2](https://github.com/Sommerregen/grav-plugin-toc/issues/2) (Not working with Grav's Admin Panel)
* Fixed broken TOC after caching pages

# v1.2.0
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

## About

> This plugin needs the [PHP iconv module](http://php.net/manual/en/function.iconv.php) in order to properly convert UTF-8 titles into human readable slugs.
`Toc` is a plugin for [**Grav**](http://getgrav.org) used to generate Table of Contents from a Markdown document based on special markers. The markers are `[TOC]` and `[MINITOC]`, where the latter can be used for a (minified) Table of Contents to give an overview of the current content of the section. By default, the Table of Contents links to the contents (`anchorlinks`) and adds visible permanent links (`permalinks`) to all headers. Further, all headers will automatically have unique id attributes generated based upon the text of the header. See how it looks like:

![Screenshot Toc Plugin](assets/screenshot.png "Toc Preview")
Expand Down
6 changes: 5 additions & 1 deletion classes/Toc.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,11 @@ protected function hyphenize($word, $language = null)
$text = trim($text, '-');

// Transliterate
$text = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text);
if (function_exists('iconv')) {
$text = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text);
} else {
$text = mb_convert_encoding($text, 'UTF-8', 'ISO-8859-15');
}

// Lowercase
$text = strtolower($text);
Expand Down

0 comments on commit f62f859

Please sign in to comment.