Added JSP tag.
This commit is contained in:
parent
ae134efac4
commit
6bd908ba1f
3 changed files with 64 additions and 1 deletions
15
README.md
15
README.md
|
@ -11,7 +11,7 @@ A simple Kotlin/Java implementation of [Medium's Read Time calculation](https://
|
|||
```kotlin
|
||||
import net.thauvin.erik.readingtime.ReadingTime
|
||||
|
||||
...
|
||||
// ...
|
||||
|
||||
val rt = ReadingTime(htmlText)
|
||||
println(rt.calcEstimatedReadTime()) // eg: 2 min read
|
||||
|
@ -56,6 +56,19 @@ ReadingTime.wordCount(htmlText) // Returns the count of words. (HTML stripped)
|
|||
ReadingTime.imgCount(htmlText) // Returns the count of images. (HTML img tags)
|
||||
```
|
||||
|
||||
### JSP
|
||||
|
||||
A JSP tag is also available for easy incorporation into web applications:
|
||||
|
||||
```jsp
|
||||
<%@taglib uri="https://erik.thauvin.net/taglibs/readingtime" prefix="t"%>
|
||||
<t:readingtime postfix="min read" plural="min read" excludeImages="false" wpm="275">some_text</t:readingtime>
|
||||
```
|
||||
|
||||
None of the attributes are required.
|
||||
|
||||
Just drop the jar into your `WEB-INF/lib` directory.
|
||||
|
||||
### Gradle
|
||||
|
||||
To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/readingtime/blob/master/examples/build.gradle.kts) file:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue