6
6
import com .vladsch .flexmark .test .util .ComboSpecTestCase ;
7
7
import com .vladsch .flexmark .test .util .TestUtils ;
8
8
import com .vladsch .flexmark .test .util .spec .SpecExample ;
9
+ import com .vladsch .flexmark .util .ast .KeepType ;
9
10
import com .vladsch .flexmark .util .data .DataHolder ;
10
11
import com .vladsch .flexmark .util .data .MutableDataSet ;
12
+ import com .vladsch .flexmark .util .format .options .*;
11
13
import org .jetbrains .annotations .NotNull ;
12
14
import org .jetbrains .annotations .Nullable ;
13
15
14
16
import java .util .HashMap ;
15
17
import java .util .Map ;
18
+ import java .util .regex .Pattern ;
16
19
17
20
public abstract class FormatterTranslationSpecTestBase extends ComboSpecTestCase {
18
21
static final boolean SKIP_IGNORED_TESTS = true ;
@@ -35,6 +38,97 @@ public abstract class FormatterTranslationSpecTestBase extends ComboSpecTestCase
35
38
optionsMap .put ("no-tailing-blanks" , new MutableDataSet ().set (Formatter .MAX_TRAILING_BLANK_LINES , 0 ));
36
39
optionsMap .put ("list-content-after-suffix" , new MutableDataSet ().set (Formatter .LISTS_ITEM_CONTENT_AFTER_SUFFIX , true ));
37
40
optionsMap .put ("margin" , new MutableDataSet ().set (TestUtils .CUSTOM_OPTION , (option , params ) -> TestUtils .customIntOption (option , params , FormatterTranslationSpecTestBase ::marginOption )));
41
+ optionsMap .put ("atx-space-as-is" , new MutableDataSet ().set (Formatter .SPACE_AFTER_ATX_MARKER , DiscretionaryText .AS_IS ));
42
+ optionsMap .put ("atx-space-add" , new MutableDataSet ().set (Formatter .SPACE_AFTER_ATX_MARKER , DiscretionaryText .ADD ));
43
+ optionsMap .put ("atx-space-remove" , new MutableDataSet ().set (Formatter .SPACE_AFTER_ATX_MARKER , DiscretionaryText .REMOVE ));
44
+ optionsMap .put ("heading-any" , new MutableDataSet ().set (Formatter .HEADING_STYLE , HeadingStyle .AS_IS ));
45
+ optionsMap .put ("heading-atx" , new MutableDataSet ().set (Formatter .HEADING_STYLE , HeadingStyle .ATX_PREFERRED ));
46
+ optionsMap .put ("heading-setext" , new MutableDataSet ().set (Formatter .HEADING_STYLE , HeadingStyle .SETEXT_PREFERRED ));
47
+ optionsMap .put ("setext-no-equalize" , new MutableDataSet ().set (Formatter .SETEXT_HEADING_EQUALIZE_MARKER , false ));
48
+ optionsMap .put ("atx-trailing-as-is" , new MutableDataSet ().set (Formatter .ATX_HEADING_TRAILING_MARKER , EqualizeTrailingMarker .AS_IS ));
49
+ optionsMap .put ("atx-trailing-add" , new MutableDataSet ().set (Formatter .ATX_HEADING_TRAILING_MARKER , EqualizeTrailingMarker .ADD ));
50
+ optionsMap .put ("atx-trailing-equalize" , new MutableDataSet ().set (Formatter .ATX_HEADING_TRAILING_MARKER , EqualizeTrailingMarker .EQUALIZE ));
51
+ optionsMap .put ("atx-trailing-remove" , new MutableDataSet ().set (Formatter .ATX_HEADING_TRAILING_MARKER , EqualizeTrailingMarker .REMOVE ));
52
+ optionsMap .put ("thematic-break" , new MutableDataSet ().set (Formatter .THEMATIC_BREAK , "*** ** * ** ***" ));
53
+ optionsMap .put ("no-block-quote-blank-lines" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_BLANK_LINES , false ));
54
+ optionsMap .put ("block-quote-compact" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_MARKERS , BlockQuoteMarker .ADD_COMPACT ));
55
+ optionsMap .put ("block-quote-compact-with-space" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_MARKERS , BlockQuoteMarker .ADD_COMPACT_WITH_SPACE ));
56
+ optionsMap .put ("block-quote-spaced" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_MARKERS , BlockQuoteMarker .ADD_SPACED ));
57
+ optionsMap .put ("block-quote-cont-as-first" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_AS_FIRST ));
58
+ optionsMap .put ("block-quote-cont-compact" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_COMPACT ));
59
+ optionsMap .put ("block-quote-cont-compact-with-space" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_COMPACT_WITH_SPACE ));
60
+ optionsMap .put ("block-quote-cont-spaced" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_SPACED ));
61
+ optionsMap .put ("block-quote-cont-remove" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .REMOVE ));
62
+ optionsMap .put ("indented-code-minimize" , new MutableDataSet ().set (Formatter .INDENTED_CODE_MINIMIZE_INDENT , true ));
63
+ optionsMap .put ("fenced-code-minimize" , new MutableDataSet ().set (Formatter .FENCED_CODE_MINIMIZE_INDENT , true ));
64
+ optionsMap .put ("fenced-code-match-closing" , new MutableDataSet ().set (Formatter .FENCED_CODE_MATCH_CLOSING_MARKER , true ));
65
+ optionsMap .put ("fenced-code-spaced-info" , new MutableDataSet ().set (Formatter .FENCED_CODE_SPACE_BEFORE_INFO , true ));
66
+ optionsMap .put ("fenced-code-marker-length" , new MutableDataSet ().set (Formatter .FENCED_CODE_MARKER_LENGTH , 6 ));
67
+ optionsMap .put ("fenced-code-marker-backtick" , new MutableDataSet ().set (Formatter .FENCED_CODE_MARKER_TYPE , CodeFenceMarker .BACK_TICK ));
68
+ optionsMap .put ("fenced-code-marker-tilde" , new MutableDataSet ().set (Formatter .FENCED_CODE_MARKER_TYPE , CodeFenceMarker .TILDE ));
69
+ optionsMap .put ("list-add-blank-line-before" , new MutableDataSet ().set (Formatter .LIST_ADD_BLANK_LINE_BEFORE , true ));
70
+ optionsMap .put ("list-no-renumber-items" , new MutableDataSet ().set (Formatter .LIST_RENUMBER_ITEMS , false ));
71
+ optionsMap .put ("list-reset-first-item" , new MutableDataSet ().set (Formatter .LIST_RESET_FIRST_ITEM_NUMBER , true ));
72
+ optionsMap .put ("list-bullet-dash" , new MutableDataSet ().set (Formatter .LIST_BULLET_MARKER , ListBulletMarker .DASH ));
73
+ optionsMap .put ("list-bullet-asterisk" , new MutableDataSet ().set (Formatter .LIST_BULLET_MARKER , ListBulletMarker .ASTERISK ));
74
+ optionsMap .put ("list-bullet-plus" , new MutableDataSet ().set (Formatter .LIST_BULLET_MARKER , ListBulletMarker .PLUS ));
75
+ optionsMap .put ("list-numbered-dot" , new MutableDataSet ().set (Formatter .LIST_NUMBERED_MARKER , ListNumberedMarker .DOT ));
76
+ optionsMap .put ("list-numbered-paren" , new MutableDataSet ().set (Formatter .LIST_NUMBERED_MARKER , ListNumberedMarker .PAREN ));
77
+ optionsMap .put ("list-spacing-loosen" , new MutableDataSet ().set (Formatter .LIST_SPACING , ListSpacing .LOOSEN ));
78
+ optionsMap .put ("list-spacing-tighten" , new MutableDataSet ().set (Formatter .LIST_SPACING , ListSpacing .TIGHTEN ));
79
+ optionsMap .put ("list-spacing-loose" , new MutableDataSet ().set (Formatter .LIST_SPACING , ListSpacing .LOOSE ));
80
+ optionsMap .put ("list-spacing-tight" , new MutableDataSet ().set (Formatter .LIST_SPACING , ListSpacing .TIGHT ));
81
+ optionsMap .put ("references-as-is" , new MutableDataSet ().set (Formatter .REFERENCE_PLACEMENT , ElementPlacement .AS_IS ));
82
+ optionsMap .put ("references-document-top" , new MutableDataSet ().set (Formatter .REFERENCE_PLACEMENT , ElementPlacement .DOCUMENT_TOP ));
83
+ optionsMap .put ("references-group-with-first" , new MutableDataSet ().set (Formatter .REFERENCE_PLACEMENT , ElementPlacement .GROUP_WITH_FIRST ));
84
+ optionsMap .put ("references-group-with-last" , new MutableDataSet ().set (Formatter .REFERENCE_PLACEMENT , ElementPlacement .GROUP_WITH_LAST ));
85
+ optionsMap .put ("references-document-bottom" , new MutableDataSet ().set (Formatter .REFERENCE_PLACEMENT , ElementPlacement .DOCUMENT_BOTTOM ));
86
+ optionsMap .put ("references-sort" , new MutableDataSet ().set (Formatter .REFERENCE_SORT , ElementPlacementSort .SORT ));
87
+ optionsMap .put ("references-sort-unused-last" , new MutableDataSet ().set (Formatter .REFERENCE_SORT , ElementPlacementSort .SORT_UNUSED_LAST ));
88
+ optionsMap .put ("references-sort-delete-unused" , new MutableDataSet ().set (Formatter .REFERENCE_SORT , ElementPlacementSort .SORT_DELETE_UNUSED ));
89
+ optionsMap .put ("references-delete-unused" , new MutableDataSet ().set (Formatter .REFERENCE_SORT , ElementPlacementSort .DELETE_UNUSED ));
90
+ optionsMap .put ("references-keep-last" , new MutableDataSet ().set (Parser .REFERENCES_KEEP , KeepType .LAST ));
91
+ optionsMap .put ("image-links-at-start" , new MutableDataSet ().set (Formatter .KEEP_IMAGE_LINKS_AT_START , true ));
92
+ optionsMap .put ("explicit-links-at-start" , new MutableDataSet ().set (Formatter .KEEP_EXPLICIT_LINKS_AT_START , true ));
93
+ optionsMap .put ("remove-empty-items" , new MutableDataSet ().set (Formatter .LIST_REMOVE_EMPTY_ITEMS , true ));
94
+ optionsMap .put ("no-hard-breaks" , new MutableDataSet ().set (Formatter .KEEP_HARD_LINE_BREAKS , false ));
95
+ optionsMap .put ("no-soft-breaks" , new MutableDataSet ().set (Formatter .KEEP_SOFT_LINE_BREAKS , false ));
96
+ optionsMap .put ("right-margin-30" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 30 ));
97
+ optionsMap .put ("right-margin-40" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 40 ));
98
+ optionsMap .put ("right-margin-50" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 50 ));
99
+ optionsMap .put ("right-margin-60" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 60 ));
100
+ optionsMap .put ("right-margin-70" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 70 ));
101
+ optionsMap .put ("right-margin-80" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 80 ));
102
+ optionsMap .put ("right-margin-90" , new MutableDataSet ().set (Formatter .RIGHT_MARGIN , 90 ));
103
+ optionsMap .put ("apply-escapers" , new MutableDataSet ().set (Formatter .APPLY_SPECIAL_LEAD_IN_HANDLERS , true ));
104
+ optionsMap .put ("no-apply-escapers" , new MutableDataSet ().set (Formatter .APPLY_SPECIAL_LEAD_IN_HANDLERS , false ));
105
+
106
+ optionsMap .put ("no-list-reset-first-item-number" , new MutableDataSet ().set (Formatter .LIST_RESET_FIRST_ITEM_NUMBER , false ));
107
+ optionsMap .put ("list-reset-first-item-number" , new MutableDataSet ().set (Formatter .LIST_RESET_FIRST_ITEM_NUMBER , true ));
108
+
109
+ optionsMap .put ("formatter-tags-enabled" , new MutableDataSet ().set (Formatter .FORMATTER_TAGS_ENABLED , true ));
110
+ optionsMap .put ("formatter-tags-accept-regexp" , new MutableDataSet ().set (Formatter .FORMATTER_TAGS_ACCEPT_REGEXP , true ));
111
+ optionsMap .put ("formatter-on-tag-alt" , new MutableDataSet ().set (Formatter .FORMATTER_ON_TAG , "@format:on" ));
112
+ optionsMap .put ("formatter-off-tag-alt" , new MutableDataSet ().set (Formatter .FORMATTER_OFF_TAG , "@format:off" ));
113
+ optionsMap .put ("formatter-on-tag-regex" , new MutableDataSet ().set (Formatter .FORMATTER_ON_TAG , "^@format:(?:yes|on|true)$" ).set (Formatter .FORMATTER_TAGS_ACCEPT_REGEXP , true ));
114
+ optionsMap .put ("formatter-off-tag-regex" , new MutableDataSet ().set (Formatter .FORMATTER_OFF_TAG , "^@format:(?:no|off|false)$" ).set (Formatter .FORMATTER_TAGS_ACCEPT_REGEXP , true ));
115
+
116
+ optionsMap .put ("continuation-indent-align-to-first" , new MutableDataSet ().set (Formatter .CONTINUATION_INDENT , ContinuationIndent .ALIGN_TO_FIRST ));
117
+ optionsMap .put ("continuation-indent-none" , new MutableDataSet ().set (Formatter .CONTINUATION_INDENT , ContinuationIndent .NONE ));
118
+ optionsMap .put ("continuation-indent-indent-1" , new MutableDataSet ().set (Formatter .CONTINUATION_INDENT , ContinuationIndent .INDENT_1 ));
119
+ optionsMap .put ("continuation-indent-indent-2" , new MutableDataSet ().set (Formatter .CONTINUATION_INDENT , ContinuationIndent .INDENT_2 ));
120
+ optionsMap .put ("continuation-indent-indent-3" , new MutableDataSet ().set (Formatter .CONTINUATION_INDENT , ContinuationIndent .INDENT_3 ));
121
+
122
+ optionsMap .put ("block-quote-continuation-markers-add-as-first" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_AS_FIRST ));
123
+ optionsMap .put ("block-quote-continuation-markers-add-compact" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_COMPACT ));
124
+ optionsMap .put ("block-quote-continuation-markers-add-compact-with-space" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_COMPACT_WITH_SPACE ));
125
+ optionsMap .put ("block-quote-continuation-markers-add-spaced" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .ADD_SPACED ));
126
+ optionsMap .put ("block-quote-continuation-markers-remove" , new MutableDataSet ().set (Formatter .BLOCK_QUOTE_CONTINUATION_MARKERS , BlockQuoteContinuationMarker .REMOVE ));
127
+
128
+ optionsMap .put ("list-align-numeric-none" , new MutableDataSet ().set (Formatter .LIST_ALIGN_NUMERIC , ElementAlignment .NONE ));
129
+ optionsMap .put ("list-align-numeric-left" , new MutableDataSet ().set (Formatter .LIST_ALIGN_NUMERIC , ElementAlignment .LEFT_ALIGN ));
130
+ optionsMap .put ("list-align-numeric-right" , new MutableDataSet ().set (Formatter .LIST_ALIGN_NUMERIC , ElementAlignment .RIGHT_ALIGN ));
131
+ optionsMap .put ("link-address-pattern" , new MutableDataSet ().set (Formatter .LINK_MARKER_COMMENT_PATTERN , Pattern .compile ("^\\ s*@IGNORE PREVIOUS:.*$" )));
38
132
}
39
133
static DataHolder marginOption (@ Nullable Integer params ) {
40
134
int value = params != null ? params : -1 ;
0 commit comments