Skip to content

Commit 530c023

Browse files
committed
minor fixes
1 parent 621758b commit 530c023

File tree

10 files changed

+38
-9
lines changed

10 files changed

+38
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ target/
3535
/flexmark-docx-converter/src/test/resources/PageBreak.xml
3636
/flexmark-docx-converter/src/test/resources/Tab.s.xml
3737
/flexmark-docx-converter/src/test/resources/Tab.xml
38+
/assets/comms/

VERSION.md

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ flexmark-java
99
- [Next 0.60.0](#next-0600)
1010
- [API Changes](#api-changes)
1111
- [Next](#next)
12+
- [Next 0.59.40](#next-05940)
13+
- [0.59.38](#05938)
1214
- [0.59.36](#05936)
1315
- [0.59.34](#05934)
1416
- [0.59.32](#05932)
@@ -161,6 +163,21 @@ Next
161163
[Yaml Front Matter Configuration](../../wiki/Yaml-Front-Matter-Configuration)
162164
* [ ] Add: spec example language per section options and rendering in HTML.
163165

166+
Next 0.59.40
167+
------------
168+
169+
* [ ] Add: `RichSequence.trimEndToEOL()`
170+
* [ ] Add: `RichSequence.trimStartToEOL()`
171+
* [ ] Add: `RichSequence.extendEndToEOL()`
172+
* [ ] Add: `RichSequence.extendStartToEOL()`
173+
174+
0.59.38
175+
-------
176+
177+
* Fix: remove unnecessary type param from `MutableDataHolder.remove(DataKeyBase<?>)`
178+
* Fix: `Parser.HEADING_NO_EMPTY_HEADING_WITHOUT_SPACE` had wrong regex. Did not allow non-empty
179+
headings without space either.
180+
164181
0.59.36
165182
-------
166183

flexmark-ext-attributes/src/test/java/com/vladsch/flexmark/ext/attributes/ComboExtAttributesSpecTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class ComboExtAttributesSpecTest extends RendererSpecTest {
5858
optionsMap.put("fenced-code-to-code", new MutableDataSet().set(AttributesExtension.FENCED_CODE_ADD_ATTRIBUTES, FencedCodeAddType.ADD_TO_CODE));
5959
optionsMap.put("custom", new MutableDataSet().set(CUSTOM_OPTION, (option, text) -> null));
6060
}
61+
6162
public ComboExtAttributesSpecTest(@NotNull SpecExample example) {
6263
super(example, optionsMap, OPTIONS);
6364
}

flexmark-ext-attributes/src/test/resources/ext_attributes_ast_spec.md

-3
Original file line numberDiff line numberDiff line change
@@ -2866,9 +2866,6 @@ Document[0, 35]
28662866
AttributeNode[17, 34] name:[17, 24, "caption"] sep:[24, 25, "="] valueOpen:[25, 26, "\""] value:[26, 33, "Caption"] valueClose:[33, 34, "\""]
28672867
````````````````````````````````
28682868
-->
2869-
2870-
2871-
28722869
```````````````````````````````` example(Fenced Code: 20) options(info-attributes, fenced-code-to-code)
28732870
```plantuml
28742871
```

flexmark-util/src/main/java/com/vladsch/flexmark/util/Pair.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.vladsch.flexmark.util;
22

3+
import java.util.Objects;
4+
35
public class Pair<K, V> implements Paired<K, V> {
46
public static <K1, V1> Pair<K1, V1> of(K1 first, V1 second) {
57
return new Pair<>(first, second);
@@ -49,8 +51,8 @@ public boolean equals(Object o) {
4951

5052
Pair<?, ?> pair = (Pair<?, ?>) o;
5153

52-
if (myFirst != null ? !myFirst.equals(pair.myFirst) : pair.myFirst != null) return false;
53-
return mySecond != null ? mySecond.equals(pair.mySecond) : pair.mySecond == null;
54+
if (!Objects.equals(myFirst, pair.myFirst)) return false;
55+
return Objects.equals(mySecond, pair.mySecond);
5456
}
5557

5658
@Override

flexmark-util/src/main/java/com/vladsch/flexmark/util/ast/Document.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Document(DataHolder options, BasedSequence chars) {
5656

5757
@NotNull
5858
@Override
59-
public <T> MutableDataSet remove(@NotNull DataKeyBase<T> key) {return dataSet.remove(key);}
59+
public MutableDataSet remove(@NotNull DataKeyBase<?> key) {return dataSet.remove(key);}
6060

6161
@Override
6262
@Nullable

flexmark-util/src/main/java/com/vladsch/flexmark/util/ast/Node.java

+11
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,17 @@ public static void segmentSpanChars(@NotNull StringBuilder out, @NotNull BasedSe
657657
segmentSpanChars(out, sequence.getStartOffset(), sequence.getEndOffset(), name, sequence.toString());
658658
}
659659

660+
public static void segmentSpanCharsToVisible(@NotNull StringBuilder out, @NotNull BasedSequence sequence, @NotNull String name) {
661+
if (sequence.isNotNull()) {
662+
if (sequence.length() <= 10) {
663+
segmentSpanChars(out, sequence.getStartOffset(), sequence.getEndOffset(), name, sequence.toVisibleWhitespaceString());
664+
} else {
665+
// give the first 5 and last 5
666+
segmentSpanChars(out, sequence.getStartOffset(), sequence.getEndOffset(), name, sequence.subSequence(0, 5).toVisibleWhitespaceString(), SPLICE, sequence.endSequence(sequence.length() - 5).toVisibleWhitespaceString());
667+
}
668+
}
669+
}
670+
660671
public static void delimitedSegmentSpan(
661672
@NotNull StringBuilder out,
662673
@NotNull BasedSequence openingSequence,

flexmark-util/src/main/java/com/vladsch/flexmark/util/data/MutableDataHolder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ default <T> T get(@NotNull DataKey<T> key) {
4747
* @param key data key to remove
4848
* @return mutable data holder for chained calls
4949
*/
50-
@NotNull <T> MutableDataHolder remove(@NotNull DataKeyBase<T> key);
50+
@NotNull MutableDataHolder remove(@NotNull DataKeyBase<?> key);
5151

5252
/**
5353
* Store the given value for the key

flexmark-util/src/main/java/com/vladsch/flexmark/util/data/MutableDataSet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public MutableDataHolder setIn(@NotNull MutableDataHolder dataHolder) {
6262

6363
@NotNull
6464
@Override
65-
public <T> MutableDataSet remove(@NotNull DataKeyBase<T> key) {
65+
public MutableDataSet remove(@NotNull DataKeyBase<?> key) {
6666
dataSet.remove(key);
6767
return this;
6868
}

flexmark/src/main/java/com/vladsch/flexmark/parser/core/HeadingParser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static class HeadingParsing extends Parsing {
2929
public HeadingParsing(DataHolder options) {
3030
super(options);
3131

32-
ATX_HEADING = Parser.HEADING_NO_ATX_SPACE.get(options) ? Pattern.compile("^#{1,6}(?:[ \t]*|$)") : Parser.HEADING_NO_EMPTY_HEADING_WITHOUT_SPACE.get(options) ? Pattern.compile("^#{1,6}[ \t]+") : Pattern.compile("^#{1,6}(?:[ \t]+|$)");
32+
ATX_HEADING = Parser.HEADING_NO_ATX_SPACE.get(options) ? Pattern.compile("^#{1,6}(?:[ \t]*|$)") : Parser.HEADING_NO_EMPTY_HEADING_WITHOUT_SPACE.get(options) ? Pattern.compile("^#{1,6}(?:[ \t]*(?=[^ \t#])|[ \t]+$)") : Pattern.compile("^#{1,6}(?:[ \t]+|$)");
3333
ATX_TRAILING = Parser.HEADING_NO_ATX_SPACE.get(options) ? Pattern.compile("[ \t]*#+[ \t]*$") : Pattern.compile("(^| |\t)[ \t]*#+[ \t]*$");
3434

3535
int minLength = Parser.HEADING_SETEXT_MARKER_LENGTH.get(options);

0 commit comments

Comments
 (0)