From 052a1f7fa4be32c6e08fe8048729b1493dbfd662 Mon Sep 17 00:00:00 2001 From: Vladimir Schneider Date: Wed, 8 Apr 2020 12:46:45 -0400 Subject: [PATCH] fix for #396 --- .idea/markdown-navigator-enh.xml | 1 + .idea/markdown-navigator.xml | 6 +- .idea/markdown-navigator/COPY_HTML_MIME.xml | 8 +- .idea/markdown-navigator/Comms.xml | 10 +- .idea/markdown-navigator/GitHub_Templates.xml | 8 +- .idea/markdown-navigator/OVERVIEW.xml | 8 +- .idea/markdown-navigator/Wiki.xml | 8 +- .idea/misc.xml | 14 +- VERSION-TODO.md | 9 ++ VERSION.md | 35 +++++ flexmark-all/pom.xml | 2 +- flexmark-core-test/pom.xml | 2 +- flexmark-docx-converter/pom.xml | 2 +- flexmark-ext-abbreviation/pom.xml | 2 +- flexmark-ext-admonition/pom.xml | 2 +- flexmark-ext-anchorlink/pom.xml | 4 +- flexmark-ext-aside/pom.xml | 2 +- flexmark-ext-attributes/pom.xml | 2 +- flexmark-ext-autolink/pom.xml | 2 +- flexmark-ext-definition/pom.xml | 2 +- flexmark-ext-emoji/pom.xml | 2 +- flexmark-ext-enumerated-reference/pom.xml | 2 +- flexmark-ext-escaped-character/pom.xml | 2 +- flexmark-ext-footnotes/pom.xml | 2 +- flexmark-ext-gfm-issues/pom.xml | 2 +- flexmark-ext-gfm-strikethrough/pom.xml | 2 +- flexmark-ext-gfm-tasklist/pom.xml | 2 +- flexmark-ext-gfm-users/pom.xml | 2 +- flexmark-ext-gitlab/pom.xml | 2 +- flexmark-ext-ins/pom.xml | 2 +- flexmark-ext-jekyll-front-matter/pom.xml | 2 +- flexmark-ext-jekyll-tag/pom.xml | 2 +- flexmark-ext-macros/pom.xml | 2 +- flexmark-ext-media-tags/pom.xml | 2 +- flexmark-ext-spec-example/pom.xml | 2 +- flexmark-ext-superscript/pom.xml | 2 +- flexmark-ext-tables/pom.xml | 2 +- flexmark-ext-toc/pom.xml | 2 +- flexmark-ext-typographic/pom.xml | 2 +- flexmark-ext-wikilink/pom.xml | 2 +- flexmark-ext-xwiki-macros/pom.xml | 2 +- flexmark-ext-yaml-front-matter/pom.xml | 2 +- flexmark-ext-youtube-embedded/pom.xml | 2 +- flexmark-ext-zzzzzz/pom.xml | 2 +- flexmark-html2md-converter/pom.xml | 2 +- flexmark-integration-test/pom.xml | 2 +- .../java/samples/NodeRendererSample2.java | 124 ++++++++++++++++++ flexmark-jira-converter/pom.xml | 2 +- flexmark-osgi/pom.xml | 2 +- flexmark-pdf-converter/pom.xml | 2 +- flexmark-profile-pegdown/pom.xml | 2 +- flexmark-test-specs/pom.xml | 2 +- flexmark-test-util/pom.xml | 2 +- .../flexmark/test/util/spec/IParseBase.java | 2 +- flexmark-tree-iteration/pom.xml | 2 +- flexmark-util-ast/pom.xml | 2 +- flexmark-util-builder/pom.xml | 2 +- flexmark-util-collection/pom.xml | 2 +- flexmark-util-data/pom.xml | 2 +- .../flexmark/util/data/ScopedDataSet.java | 34 ++--- flexmark-util-dependency/pom.xml | 2 +- flexmark-util-experimental/pom.xml | 2 +- flexmark-util-format/pom.xml | 2 +- flexmark-util-html/pom.xml | 2 +- flexmark-util-misc/pom.xml | 2 +- flexmark-util-options/pom.xml | 2 +- flexmark-util-sequence/pom.xml | 2 +- flexmark-util-visitor/pom.xml | 2 +- flexmark-util/pom.xml | 2 +- flexmark-youtrack-converter/pom.xml | 2 +- flexmark/pom.xml | 2 +- .../parser/internal/DocumentParser.java | 1 - pom.xml | 2 +- 73 files changed, 291 insertions(+), 97 deletions(-) create mode 100644 flexmark-java-samples/src/com/vladsch/flexmark/java/samples/NodeRendererSample2.java diff --git a/.idea/markdown-navigator-enh.xml b/.idea/markdown-navigator-enh.xml index 4eb2419ad..28ca4b75b 100644 --- a/.idea/markdown-navigator-enh.xml +++ b/.idea/markdown-navigator-enh.xml @@ -1,6 +1,7 @@ + diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml index 9c271dfff..5016974eb 100644 --- a/.idea/markdown-navigator.xml +++ b/.idea/markdown-navigator.xml @@ -38,7 +38,7 @@ - + + + \ No newline at end of file diff --git a/VERSION-TODO.md b/VERSION-TODO.md index 9570cbf83..bf0db9472 100644 --- a/VERSION-TODO.md +++ b/VERSION-TODO.md @@ -7,6 +7,7 @@ - [Release 0.60.0](#release-0600) - [API Refactoring](#api-refactoring) - [Next 0.61.xx](#next-061xx) +- [0.61.2](#0612) - [0.61.0](#0610) - [0.60.2](#0602) - [0.60.0](#0600) @@ -214,6 +215,12 @@ Please give feedback on the upcoming changes if you have concerns about breaking `|` for each line that was wrapped. Otherwise, it is impossible to tell where each line ends and another begins. +## 0.61.2 + +* Fix: `ScopedDataSet.getAll()` and `ScopedDataSet.getKeys()` would not return keys from parent + scope. +* Fix: [#396, DocumentParser stops reading too early resulting in the document being cut off] + ## 0.61.0 * Fix: enable original spec tests @@ -2311,4 +2318,6 @@ Please give feedback on the upcoming changes if you have concerns about breaking [migrate flexmark-java 0_40_x to 0_42_0]: https://github.com/vsch/flexmark-java/blob/master/assets/migrations/migrate%20flexmark-java%200_40_x%20to%200_42_0.xml [migrate flexmark-java 0_42_x to 0_50_0.xml]: https://github.com/vsch/flexmark-java/blob/master/assets/migrations/migrate%20flexmark-java%200_42_x%20to%200_50_0.xml +[#396, DocumentParser stops reading too early resulting in the document being cut off]: https://github.com/vsch/flexmark-java/issues/396 + diff --git a/VERSION.md b/VERSION.md index be2f425e5..e7bd1fdc0 100644 --- a/VERSION.md +++ b/VERSION.md @@ -6,6 +6,8 @@ - [Release 0.60.0](#release-0600) - [API Refactoring](#api-refactoring) +- [0.61.2](#0612) +- [0.61.0](#0610) - [0.60.2](#0602) - [0.60.0](#0600) - [0.59.84](#05984) @@ -155,6 +157,35 @@ Please give feedback on the upcoming changes if you have concerns about breaking * `com.vladsch.flexmark.util.ast.NodeAdaptingVisitHandler` * `com.vladsch.flexmark.util.ast.NodeAdaptingVisitor` +## 0.61.2 + +* Fix: `ScopedDataSet.getAll()` and `ScopedDataSet.getKeys()` would not return keys from parent + scope. +* Fix: [#396, DocumentParser stops reading too early resulting in the document being cut off] + +## 0.61.0 + +* Fix: enable original spec tests +* Fix: merge [#391, PR: Fix: CRLF line separator in fenced code blocks produce redundant CR.] +* Fix: merge [#387, JUnit is in the compile scope] +* Add: ability to insert anchor ref targets to `HtmlIdGenerator` when scanning a document. +* Add: add `LinkResolverBasicContext` as base interface of `LinkResolverContext` to allow simple + context to pass to `LinkResolver` when resolving links without needing to implement all unused + methods of `LinkResolverContext`. +* Break: change argument to `LinkResolver` and `LinkResolverFactory` to + `LinkResolverBasicContext`. Except for `JekyllTagExtension`, the argument is still + `LinkResolverContext` and passed value can be cast to this if required. +* Add: support for `JekyllTagBlock` with `include` directive to `DocxRenderer` + + Use `{% include includeFile %}` to include the file into the source document. `includeFile` is + resolved relative to `DocxRenderer.DOC_RELATIVE_URL` or `DocxRenderer.DOC_ROOT_URL`. The + latter is used if `includeFile` starts with `/` + + Will only include files if `JekyllTagExtension.LINK_RESOLVER_FACTORIES` is not empty, in which + case the link resolvers will be used to resolve `includeFile` to full file path. Use singleton + list of `DocxLinkResolver.Factory` instance to resolve using doc relative and root url paths. +* Fix: `MergeLinkResolver` and `DocxLinkResolver` + ## 0.60.2 * Fix: change formatter sub-context rendering node to nullable @@ -1875,3 +1906,7 @@ Please give feedback on the upcoming changes if you have concerns about breaking [migrate flexmark-java 0_40_x to 0_42_0]: https://github.com/vsch/flexmark-java/blob/master/assets/migrations/migrate%20flexmark-java%200_40_x%20to%200_42_0.xml [migrate flexmark-java 0_42_x to 0_50_0.xml]: https://github.com/vsch/flexmark-java/blob/master/assets/migrations/migrate%20flexmark-java%200_42_x%20to%200_50_0.xml + +[#391, PR: Fix: CRLF line separator in fenced code blocks produce redundant CR.]: https://github.com/vsch/flexmark-java/pull/391 +[#387, JUnit is in the compile scope]: https://github.com/vsch/flexmark-java/pull/387 +[#396, DocumentParser stops reading too early resulting in the document being cut off]: https://github.com/vsch/flexmark-java/issues/396 diff --git a/flexmark-all/pom.xml b/flexmark-all/pom.xml index 89ebf31ab..7aea9c9b5 100644 --- a/flexmark-all/pom.xml +++ b/flexmark-all/pom.xml @@ -7,7 +7,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-all diff --git a/flexmark-core-test/pom.xml b/flexmark-core-test/pom.xml index 96aaa1ad1..e20bf2ccd 100644 --- a/flexmark-core-test/pom.xml +++ b/flexmark-core-test/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-core-test diff --git a/flexmark-docx-converter/pom.xml b/flexmark-docx-converter/pom.xml index 56e101ee2..d61c3db8e 100644 --- a/flexmark-docx-converter/pom.xml +++ b/flexmark-docx-converter/pom.xml @@ -5,7 +5,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-docx-converter diff --git a/flexmark-ext-abbreviation/pom.xml b/flexmark-ext-abbreviation/pom.xml index f40f9b882..7fd48e6b4 100644 --- a/flexmark-ext-abbreviation/pom.xml +++ b/flexmark-ext-abbreviation/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-abbreviation diff --git a/flexmark-ext-admonition/pom.xml b/flexmark-ext-admonition/pom.xml index 1c0c82897..ab16cf483 100644 --- a/flexmark-ext-admonition/pom.xml +++ b/flexmark-ext-admonition/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-admonition diff --git a/flexmark-ext-anchorlink/pom.xml b/flexmark-ext-anchorlink/pom.xml index eedcb70af..75221bdfa 100644 --- a/flexmark-ext-anchorlink/pom.xml +++ b/flexmark-ext-anchorlink/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-anchorlink @@ -28,7 +28,7 @@ com.vladsch.flexmark flexmark-jira-converter - 0.61.0 + 0.61.2 test diff --git a/flexmark-ext-aside/pom.xml b/flexmark-ext-aside/pom.xml index 48745988b..07295bfa8 100644 --- a/flexmark-ext-aside/pom.xml +++ b/flexmark-ext-aside/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-aside diff --git a/flexmark-ext-attributes/pom.xml b/flexmark-ext-attributes/pom.xml index fec41b5fe..b5e860e76 100644 --- a/flexmark-ext-attributes/pom.xml +++ b/flexmark-ext-attributes/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-attributes diff --git a/flexmark-ext-autolink/pom.xml b/flexmark-ext-autolink/pom.xml index 894c47bfb..d2c4214f1 100644 --- a/flexmark-ext-autolink/pom.xml +++ b/flexmark-ext-autolink/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-autolink diff --git a/flexmark-ext-definition/pom.xml b/flexmark-ext-definition/pom.xml index 6519291c9..fc033af36 100644 --- a/flexmark-ext-definition/pom.xml +++ b/flexmark-ext-definition/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-definition diff --git a/flexmark-ext-emoji/pom.xml b/flexmark-ext-emoji/pom.xml index bf8afd4f3..b70f46b53 100644 --- a/flexmark-ext-emoji/pom.xml +++ b/flexmark-ext-emoji/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-emoji diff --git a/flexmark-ext-enumerated-reference/pom.xml b/flexmark-ext-enumerated-reference/pom.xml index f72cf580e..25382d6b5 100644 --- a/flexmark-ext-enumerated-reference/pom.xml +++ b/flexmark-ext-enumerated-reference/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-enumerated-reference diff --git a/flexmark-ext-escaped-character/pom.xml b/flexmark-ext-escaped-character/pom.xml index acff9482c..01566e9c5 100644 --- a/flexmark-ext-escaped-character/pom.xml +++ b/flexmark-ext-escaped-character/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-escaped-character diff --git a/flexmark-ext-footnotes/pom.xml b/flexmark-ext-footnotes/pom.xml index c7f56e6cc..ea4047546 100644 --- a/flexmark-ext-footnotes/pom.xml +++ b/flexmark-ext-footnotes/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-footnotes diff --git a/flexmark-ext-gfm-issues/pom.xml b/flexmark-ext-gfm-issues/pom.xml index 38458dd64..a465ecc30 100644 --- a/flexmark-ext-gfm-issues/pom.xml +++ b/flexmark-ext-gfm-issues/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-gfm-issues diff --git a/flexmark-ext-gfm-strikethrough/pom.xml b/flexmark-ext-gfm-strikethrough/pom.xml index c93af391e..19887a0d4 100644 --- a/flexmark-ext-gfm-strikethrough/pom.xml +++ b/flexmark-ext-gfm-strikethrough/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-gfm-strikethrough diff --git a/flexmark-ext-gfm-tasklist/pom.xml b/flexmark-ext-gfm-tasklist/pom.xml index 4f6ed9f8a..5ee565a1d 100644 --- a/flexmark-ext-gfm-tasklist/pom.xml +++ b/flexmark-ext-gfm-tasklist/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-gfm-tasklist diff --git a/flexmark-ext-gfm-users/pom.xml b/flexmark-ext-gfm-users/pom.xml index 07180ad42..350e7cee9 100644 --- a/flexmark-ext-gfm-users/pom.xml +++ b/flexmark-ext-gfm-users/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-gfm-users diff --git a/flexmark-ext-gitlab/pom.xml b/flexmark-ext-gitlab/pom.xml index 66c4bfde5..e397a9ef0 100644 --- a/flexmark-ext-gitlab/pom.xml +++ b/flexmark-ext-gitlab/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-gitlab diff --git a/flexmark-ext-ins/pom.xml b/flexmark-ext-ins/pom.xml index c8484061a..5efaa52b6 100644 --- a/flexmark-ext-ins/pom.xml +++ b/flexmark-ext-ins/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-ins diff --git a/flexmark-ext-jekyll-front-matter/pom.xml b/flexmark-ext-jekyll-front-matter/pom.xml index 520a032fd..833e5f961 100644 --- a/flexmark-ext-jekyll-front-matter/pom.xml +++ b/flexmark-ext-jekyll-front-matter/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-jekyll-front-matter diff --git a/flexmark-ext-jekyll-tag/pom.xml b/flexmark-ext-jekyll-tag/pom.xml index 13f3bff32..0306d2347 100644 --- a/flexmark-ext-jekyll-tag/pom.xml +++ b/flexmark-ext-jekyll-tag/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-jekyll-tag diff --git a/flexmark-ext-macros/pom.xml b/flexmark-ext-macros/pom.xml index c0ac74b3f..3d3834174 100644 --- a/flexmark-ext-macros/pom.xml +++ b/flexmark-ext-macros/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-macros diff --git a/flexmark-ext-media-tags/pom.xml b/flexmark-ext-media-tags/pom.xml index 0f3475f1d..70a6b9bcc 100644 --- a/flexmark-ext-media-tags/pom.xml +++ b/flexmark-ext-media-tags/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-media-tags diff --git a/flexmark-ext-spec-example/pom.xml b/flexmark-ext-spec-example/pom.xml index 8577467dd..3aac29574 100644 --- a/flexmark-ext-spec-example/pom.xml +++ b/flexmark-ext-spec-example/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-spec-example diff --git a/flexmark-ext-superscript/pom.xml b/flexmark-ext-superscript/pom.xml index a1a65eed0..a80529159 100644 --- a/flexmark-ext-superscript/pom.xml +++ b/flexmark-ext-superscript/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-superscript diff --git a/flexmark-ext-tables/pom.xml b/flexmark-ext-tables/pom.xml index ad1df01ec..63d66aa50 100644 --- a/flexmark-ext-tables/pom.xml +++ b/flexmark-ext-tables/pom.xml @@ -5,7 +5,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-tables diff --git a/flexmark-ext-toc/pom.xml b/flexmark-ext-toc/pom.xml index 5921da3cd..62275f67a 100644 --- a/flexmark-ext-toc/pom.xml +++ b/flexmark-ext-toc/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-toc diff --git a/flexmark-ext-typographic/pom.xml b/flexmark-ext-typographic/pom.xml index 8079ec841..5f49b057f 100644 --- a/flexmark-ext-typographic/pom.xml +++ b/flexmark-ext-typographic/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-typographic diff --git a/flexmark-ext-wikilink/pom.xml b/flexmark-ext-wikilink/pom.xml index b9ad1281d..0a38ad3fa 100644 --- a/flexmark-ext-wikilink/pom.xml +++ b/flexmark-ext-wikilink/pom.xml @@ -5,7 +5,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-wikilink diff --git a/flexmark-ext-xwiki-macros/pom.xml b/flexmark-ext-xwiki-macros/pom.xml index 3ddea7ab9..d828229a3 100644 --- a/flexmark-ext-xwiki-macros/pom.xml +++ b/flexmark-ext-xwiki-macros/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-xwiki-macros diff --git a/flexmark-ext-yaml-front-matter/pom.xml b/flexmark-ext-yaml-front-matter/pom.xml index 016853316..d04322866 100644 --- a/flexmark-ext-yaml-front-matter/pom.xml +++ b/flexmark-ext-yaml-front-matter/pom.xml @@ -4,7 +4,7 @@ flexmark-java com.vladsch.flexmark - 0.61.0 + 0.61.2 flexmark-ext-yaml-front-matter diff --git a/flexmark-ext-youtube-embedded/pom.xml b/flexmark-ext-youtube-embedded/pom.xml index bab8bfd4e..ec9dfbd5d 100644 --- a/flexmark-ext-youtube-embedded/pom.xml +++ b/flexmark-ext-youtube-embedded/pom.xml @@ -4,7 +4,7 @@ flexmark-java com.vladsch.flexmark - 0.61.0 + 0.61.2 4.0.0 diff --git a/flexmark-ext-zzzzzz/pom.xml b/flexmark-ext-zzzzzz/pom.xml index f97308f20..af22b726e 100644 --- a/flexmark-ext-zzzzzz/pom.xml +++ b/flexmark-ext-zzzzzz/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-ext-zzzzzz diff --git a/flexmark-html2md-converter/pom.xml b/flexmark-html2md-converter/pom.xml index 08693b907..80d29488f 100644 --- a/flexmark-html2md-converter/pom.xml +++ b/flexmark-html2md-converter/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-html2md-converter diff --git a/flexmark-integration-test/pom.xml b/flexmark-integration-test/pom.xml index 86a391653..2d6bdf11a 100644 --- a/flexmark-integration-test/pom.xml +++ b/flexmark-integration-test/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-integration-test diff --git a/flexmark-java-samples/src/com/vladsch/flexmark/java/samples/NodeRendererSample2.java b/flexmark-java-samples/src/com/vladsch/flexmark/java/samples/NodeRendererSample2.java new file mode 100644 index 000000000..7563730d3 --- /dev/null +++ b/flexmark-java-samples/src/com/vladsch/flexmark/java/samples/NodeRendererSample2.java @@ -0,0 +1,124 @@ +package com.vladsch.flexmark.java.samples; + +import com.vladsch.flexmark.ast.Emphasis; +import com.vladsch.flexmark.ast.Paragraph; +import com.vladsch.flexmark.ast.SoftLineBreak; +import com.vladsch.flexmark.ast.StrongEmphasis; +import com.vladsch.flexmark.ext.autolink.AutolinkExtension; +import com.vladsch.flexmark.html.HtmlRenderer; +import com.vladsch.flexmark.html.HtmlWriter; +import com.vladsch.flexmark.html.renderer.NodeRenderer; +import com.vladsch.flexmark.html.renderer.NodeRendererContext; +import com.vladsch.flexmark.html.renderer.NodeRendererFactory; +import com.vladsch.flexmark.html.renderer.NodeRenderingHandler; +import com.vladsch.flexmark.parser.Parser; +import com.vladsch.flexmark.test.util.AstCollectingVisitor; +import com.vladsch.flexmark.util.ast.Node; +import com.vladsch.flexmark.util.data.DataHolder; +import com.vladsch.flexmark.util.data.MutableDataHolder; +import com.vladsch.flexmark.util.data.MutableDataSet; +import org.jetbrains.annotations.NotNull; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +public class NodeRendererSample2 { + static class SampleExtension implements HtmlRenderer.HtmlRendererExtension { + @Override + public void rendererOptions(@NotNull MutableDataHolder options) { + // add any configuration settings to options you want to apply to everything, here + } + + @Override + public void extend(@NotNull HtmlRenderer.Builder htmlRendererBuilder, @NotNull String rendererType) { + htmlRendererBuilder.nodeRendererFactory(new SampleNodeRenderer.Factory()); + } + + static SampleExtension create() { + return new SampleExtension(); + } + } + + static class SampleNodeRenderer implements NodeRenderer { + public SampleNodeRenderer(DataHolder options) { + + } + + @Override + public Set> getNodeRenderingHandlers() { + return new HashSet<>(Arrays.asList( + new NodeRenderingHandler<>(Paragraph.class, this::render), + new NodeRenderingHandler<>(SoftLineBreak.class, this::render), + new NodeRenderingHandler<>(StrongEmphasis.class, this::render), + new NodeRenderingHandler<>(Emphasis.class, this::render) + )); + } + + private void render(Paragraph node, NodeRendererContext context, HtmlWriter html) { + context.renderChildren(node); + if (node.getNext() != null) { + html.tag("br/").line(); + } + } + + private void render(SoftLineBreak node, NodeRendererContext context, HtmlWriter html) { + html.tag("br/").line(); + } + + private void render(StrongEmphasis node, NodeRendererContext context, HtmlWriter html) { + html.tag("b"); + context.renderChildren(node); + html.tag("/b"); + } + + private void render(Emphasis node, NodeRendererContext context, HtmlWriter html) { + html.tag("i"); + context.renderChildren(node); + html.tag("/i"); + } + + public static class Factory implements NodeRendererFactory { + @NotNull + @Override + public NodeRenderer apply(@NotNull DataHolder options) { + return new SampleNodeRenderer(options); + } + } + } + + static String commonMark(String markdown) { + MutableDataHolder options = new MutableDataSet(); + options.set(Parser.EXTENSIONS, Arrays.asList(AutolinkExtension.create(), SampleExtension.create())); + + // change soft break to hard break + options.set(HtmlRenderer.SOFT_BREAK, "
"); + + Parser parser = Parser.builder(options).build(); + Node document = parser.parse(markdown); + String ast = new AstCollectingVisitor().collectAndGetAstText(document); + System.out.println(markdown); + System.out.println("---------------------------------"); + System.out.println(ast); + System.out.println("---------------------------------"); + + HtmlRenderer renderer = HtmlRenderer.builder(options).build(); + String html = renderer.render(document); + return html; + } + + public static void main(String[] args) { + String html = commonMark("" + + "**bold text**\n" + + "\n" + + "*italic text*\n" + + ""); + System.out.println(html); + System.out.println("---------------------------------"); + String html2 = commonMark("" + + "**bold text**\n" + + "*italic text*\n" + + ""); + System.out.println(html2); + } +} diff --git a/flexmark-jira-converter/pom.xml b/flexmark-jira-converter/pom.xml index 95cbf844e..0bad6092e 100644 --- a/flexmark-jira-converter/pom.xml +++ b/flexmark-jira-converter/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-jira-converter diff --git a/flexmark-osgi/pom.xml b/flexmark-osgi/pom.xml index e6ffa4268..893c63f5c 100644 --- a/flexmark-osgi/pom.xml +++ b/flexmark-osgi/pom.xml @@ -7,7 +7,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-osgi diff --git a/flexmark-pdf-converter/pom.xml b/flexmark-pdf-converter/pom.xml index 48fa7abc7..f4e3e0926 100644 --- a/flexmark-pdf-converter/pom.xml +++ b/flexmark-pdf-converter/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-pdf-converter diff --git a/flexmark-profile-pegdown/pom.xml b/flexmark-profile-pegdown/pom.xml index 82de713cb..660f8ecf5 100644 --- a/flexmark-profile-pegdown/pom.xml +++ b/flexmark-profile-pegdown/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-profile-pegdown diff --git a/flexmark-test-specs/pom.xml b/flexmark-test-specs/pom.xml index 020dec035..fbd18a1a2 100644 --- a/flexmark-test-specs/pom.xml +++ b/flexmark-test-specs/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-test-specs diff --git a/flexmark-test-util/pom.xml b/flexmark-test-util/pom.xml index 71c2d99cf..3ff51df5c 100644 --- a/flexmark-test-util/pom.xml +++ b/flexmark-test-util/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-test-util diff --git a/flexmark-test-util/src/main/java/com/vladsch/flexmark/test/util/spec/IParseBase.java b/flexmark-test-util/src/main/java/com/vladsch/flexmark/test/util/spec/IParseBase.java index 25d82f693..bff1a3bc6 100644 --- a/flexmark-test-util/src/main/java/com/vladsch/flexmark/test/util/spec/IParseBase.java +++ b/flexmark-test-util/src/main/java/com/vladsch/flexmark/test/util/spec/IParseBase.java @@ -47,8 +47,8 @@ public boolean transferReferences(@NotNull Document document, @NotNull Document while (true) { int charsRead = bufferedReader.read(buffer); + if (charsRead < 0) break; file.append(buffer, 0, charsRead); - if (charsRead < buffer.length) break; } BasedSequence source = BasedSequence.of(file.toString()); diff --git a/flexmark-tree-iteration/pom.xml b/flexmark-tree-iteration/pom.xml index b7cf8a63a..b41d3a320 100644 --- a/flexmark-tree-iteration/pom.xml +++ b/flexmark-tree-iteration/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-tree-iteration diff --git a/flexmark-util-ast/pom.xml b/flexmark-util-ast/pom.xml index a9cb598a7..fe6a7a91c 100644 --- a/flexmark-util-ast/pom.xml +++ b/flexmark-util-ast/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-ast diff --git a/flexmark-util-builder/pom.xml b/flexmark-util-builder/pom.xml index ce9c1767c..520d350eb 100644 --- a/flexmark-util-builder/pom.xml +++ b/flexmark-util-builder/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-builder diff --git a/flexmark-util-collection/pom.xml b/flexmark-util-collection/pom.xml index 69e602535..ebedd5046 100644 --- a/flexmark-util-collection/pom.xml +++ b/flexmark-util-collection/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-collection diff --git a/flexmark-util-data/pom.xml b/flexmark-util-data/pom.xml index f5d532500..a9f8f5d3e 100644 --- a/flexmark-util-data/pom.xml +++ b/flexmark-util-data/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-data diff --git a/flexmark-util-data/src/main/java/com/vladsch/flexmark/util/data/ScopedDataSet.java b/flexmark-util-data/src/main/java/com/vladsch/flexmark/util/data/ScopedDataSet.java index 9aca45114..4ed108509 100644 --- a/flexmark-util-data/src/main/java/com/vladsch/flexmark/util/data/ScopedDataSet.java +++ b/flexmark-util-data/src/main/java/com/vladsch/flexmark/util/data/ScopedDataSet.java @@ -3,10 +3,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class ScopedDataSet extends DataSet { protected final DataHolder parent; @@ -28,15 +25,8 @@ public DataHolder getParent() { @Override public @NotNull Map, Object> getAll() { if (parent != null) { - - HashMap, Object> all = new HashMap<>(super.getAll()); - - for (DataKeyBase key : parent.getKeys()) { - if (!contains(key)) { - all.put(key, key.get(parent)); - } - } - + HashMap, Object> all = new HashMap<>(parent.getAll()); + all.putAll(super.getAll()); return all; } else { return super.getAll(); @@ -46,21 +36,21 @@ public DataHolder getParent() { @Override public @NotNull Collection> getKeys() { if (parent != null) { - - ArrayList> all = new ArrayList<>(super.getKeys()); - - for (DataKeyBase key : parent.getKeys()) { - if (!contains(key)) { - all.add(key); - } - } - + HashSet> all = new HashSet<>(parent.getKeys()); + all.addAll(super.getKeys()); return all; } else { return super.getKeys(); } } + @Override + public @NotNull MutableDataSet toMutable() { + MutableDataSet mutableDataSet = new MutableDataSet(); + mutableDataSet.dataSet.putAll(super.getAll()); + return parent != null ? new MutableScopedDataSet(parent, mutableDataSet) : mutableDataSet; + } + @Override public boolean contains(@NotNull DataKeyBase key) { return super.contains(key) || (parent != null && parent.contains(key)); diff --git a/flexmark-util-dependency/pom.xml b/flexmark-util-dependency/pom.xml index 22638757b..c633917b0 100644 --- a/flexmark-util-dependency/pom.xml +++ b/flexmark-util-dependency/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-dependency diff --git a/flexmark-util-experimental/pom.xml b/flexmark-util-experimental/pom.xml index 66c615383..e8de10ec4 100644 --- a/flexmark-util-experimental/pom.xml +++ b/flexmark-util-experimental/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-experimental diff --git a/flexmark-util-format/pom.xml b/flexmark-util-format/pom.xml index 556eb973e..468199cb0 100644 --- a/flexmark-util-format/pom.xml +++ b/flexmark-util-format/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-format diff --git a/flexmark-util-html/pom.xml b/flexmark-util-html/pom.xml index 73f8f54ec..a00914899 100644 --- a/flexmark-util-html/pom.xml +++ b/flexmark-util-html/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-html diff --git a/flexmark-util-misc/pom.xml b/flexmark-util-misc/pom.xml index 356e47741..886a5b8e5 100644 --- a/flexmark-util-misc/pom.xml +++ b/flexmark-util-misc/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-misc diff --git a/flexmark-util-options/pom.xml b/flexmark-util-options/pom.xml index 7a6ab4966..a746693a2 100644 --- a/flexmark-util-options/pom.xml +++ b/flexmark-util-options/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-options diff --git a/flexmark-util-sequence/pom.xml b/flexmark-util-sequence/pom.xml index 4927660a5..e3d067067 100644 --- a/flexmark-util-sequence/pom.xml +++ b/flexmark-util-sequence/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-sequence diff --git a/flexmark-util-visitor/pom.xml b/flexmark-util-visitor/pom.xml index 5fef59891..2a6226966 100644 --- a/flexmark-util-visitor/pom.xml +++ b/flexmark-util-visitor/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util-visitor diff --git a/flexmark-util/pom.xml b/flexmark-util/pom.xml index f28f8cb44..2899ef58b 100644 --- a/flexmark-util/pom.xml +++ b/flexmark-util/pom.xml @@ -5,7 +5,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-util diff --git a/flexmark-youtrack-converter/pom.xml b/flexmark-youtrack-converter/pom.xml index 90585826a..87236d439 100644 --- a/flexmark-youtrack-converter/pom.xml +++ b/flexmark-youtrack-converter/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-youtrack-converter diff --git a/flexmark/pom.xml b/flexmark/pom.xml index a6db4e825..f2d834edf 100644 --- a/flexmark/pom.xml +++ b/flexmark/pom.xml @@ -4,7 +4,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark diff --git a/flexmark/src/main/java/com/vladsch/flexmark/parser/internal/DocumentParser.java b/flexmark/src/main/java/com/vladsch/flexmark/parser/internal/DocumentParser.java index 481b8bf37..c4a539ecf 100644 --- a/flexmark/src/main/java/com/vladsch/flexmark/parser/internal/DocumentParser.java +++ b/flexmark/src/main/java/com/vladsch/flexmark/parser/internal/DocumentParser.java @@ -328,7 +328,6 @@ public Document parse(Reader input) throws IOException { // issue #91 if (charsRead < 0) break; file.append(buffer, 0, charsRead); - if (charsRead < buffer.length) break; } CharSequence source = BasedSequence.of(file.toString()); diff --git a/pom.xml b/pom.xml index a7ac72ada..02aa9cb0b 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ com.vladsch.flexmark flexmark-java - 0.61.0 + 0.61.2 flexmark-java Java re-implementation of commonmark-java based parser, with AST reflecting source elements, full source position tracking, greater parser extensibility.