diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-01-17 10:56:15 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-01-31 14:32:38 +0100 |
commit | fb8854ab6b8b3751b797d01efcbea5b4653007b8 (patch) | |
tree | af3716eb1a1b71127520e1c5850827dbb727324a /doc-tool | |
parent | 92796201dff87cc8ae0b16d06f6892d8af69ccef (diff) | |
download | dotty-fb8854ab6b8b3751b797d01efcbea5b4653007b8.tar.gz dotty-fb8854ab6b8b3751b797d01efcbea5b4653007b8.tar.bz2 dotty-fb8854ab6b8b3751b797d01efcbea5b4653007b8.zip |
Fix trailing bullet lists
Diffstat (limited to 'doc-tool')
-rw-r--r-- | doc-tool/src/dotty/tools/dottydoc/model/comment/MarkdownShortener.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/model/comment/MarkdownShortener.scala b/doc-tool/src/dotty/tools/dottydoc/model/comment/MarkdownShortener.scala index 841232e52..8ad8024ae 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/comment/MarkdownShortener.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/comment/MarkdownShortener.scala @@ -14,6 +14,7 @@ class MarkdownShortener { def shorten(node: Node, maxLen: Int = 150): Node = { var len = 0 + var didUnlinkBullets = false def count(node: Node, length: => Int, shortenOrUnlink: Int => Unit) = { val remaining = math.max(maxLen - len, 0) @@ -48,6 +49,17 @@ class MarkdownShortener { }), new VisitHandler(classOf[Image], new Visitor[Image] { override def visit(node: Image) = count(node, maxLen, _ => node.unlink()) + }), + new VisitHandler(classOf[BulletListItem], new Visitor[BulletListItem] { + override def visit(node: BulletListItem) = count( + node, + if (didUnlinkBullets) maxLen + else node.getSegments.map(_.length).reduceLeft(_ + _), + _ => { + node.unlink() + didUnlinkBullets = true // unlink all following bullets + } + ) }) ) |