Closed bhollis closed 11 years ago
There's at least one gem out there that tries to truncate HTML cleanly using Nokogiri. Might be worth a look: https://github.com/nono/HTML-Truncator
I am experiencing this problem and would prefer just to insert my own summary marker when required.
Browsing the code it looks like blog.summary_length cannot be disabled. I am using 100_000 as a workaround. Happy to submit a pull request to fix this. Just need to decide how it should be configured:
Yeah, this needs work. Certainly having the ability to just turn it off would help.
Fixed in #100.
My and @tdreyno's initial attempt at producing blog summaries didn't work because it would split tags, sometimes causing invalid HTML. @rumpuslabs fixed it to truncate the template, then render, which sounds better, except:
The correct solution would be to use Nokogiri to parse the rendered content, then iterate through the nodes, adding whole elements until the total text length got past a certain point. This would necessitate adding a dependency on
nokogiri
tomiddleman-blog
. Alternately, we could just drop the summary-based-on-length feature and require people place a break point in their blog posts.