@gmb/bitmark-parser-generator 3.31.1 → 3.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -6
- package/README.md +58 -0
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/cjs/BitmarkParserGenerator.js +6 -6
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/BaseBuilder.js +8 -8
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +5 -5
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/breakscaping/Breakscape.js +13 -16
- package/dist/cjs/breakscaping/Breakscape.js.map +1 -1
- package/dist/cjs/config/raw/bits.js +38 -0
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/groups.js +20 -0
- package/dist/cjs/config/raw/groups.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +21 -0
- package/dist/cjs/config/raw/properties.js.map +1 -1
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generated/parser/text/text-peggy-parser.js +407 -237
- package/dist/cjs/generated/parser/text/text-peggy-parser.js.map +1 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +4 -4
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +7 -2
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/generator/text/TextGenerator.js +20 -9
- package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +8 -0
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +4 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +8 -0
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/TextMarkType.js +11 -0
- package/dist/cjs/model/enum/TextMarkType.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +4 -4
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +4 -4
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +8 -8
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +3 -3
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +16 -13
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +7 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +6 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +12 -12
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +4 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +2 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/text/TextParser.js +1 -1
- package/dist/cjs/parser/text/TextParser.js.map +1 -1
- package/dist/cjs/utils/BitUtils.js +3 -1
- package/dist/cjs/utils/BitUtils.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +6 -6
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +8 -8
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +5 -5
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/breakscaping/Breakscape.js +13 -16
- package/dist/esm/breakscaping/Breakscape.js.map +1 -1
- package/dist/esm/config/raw/bits.js +38 -0
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/groups.js +20 -0
- package/dist/esm/config/raw/groups.js.map +1 -1
- package/dist/esm/config/raw/properties.js +21 -0
- package/dist/esm/config/raw/properties.js.map +1 -1
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generated/parser/text/text-peggy-parser.js +407 -237
- package/dist/esm/generated/parser/text/text-peggy-parser.js.map +1 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +4 -4
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +7 -2
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/generator/text/TextGenerator.js +20 -9
- package/dist/esm/generator/text/TextGenerator.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +8 -0
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +4 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +8 -0
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/TextMarkType.js +11 -0
- package/dist/esm/model/enum/TextMarkType.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +4 -4
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +4 -4
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +8 -8
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +3 -3
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +16 -13
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +7 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +6 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +12 -12
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +4 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +2 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/text/TextParser.js +1 -1
- package/dist/esm/parser/text/TextParser.js.map +1 -1
- package/dist/esm/utils/BitUtils.js +3 -1
- package/dist/esm/utils/BitUtils.js.map +1 -1
- package/dist/types/ast/Builder.d.ts +4 -0
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/breakscaping/Breakscape.d.ts +1 -27
- package/dist/types/breakscaping/Breakscape.d.ts.map +1 -1
- package/dist/types/config/raw/bits.d.ts.map +1 -1
- package/dist/types/config/raw/groups.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- package/dist/types/generated/parser/text/text-peggy-parser.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +3 -3
- package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +16 -0
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +4 -0
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/ast/TextNodes.d.ts +4 -0
- package/dist/types/model/ast/TextNodes.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +8 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +12 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +16 -0
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +8 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/enum/TextMarkType.d.ts +22 -0
- package/dist/types/model/enum/TextMarkType.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +4 -0
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/text/TextParser.d.ts +2 -2
- package/dist/types/parser/text/TextParser.d.ts.map +1 -1
- package/dist/types/utils/BitUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
Proprietary
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
3
|
+
© 2023-25 Get More Brain Ltd
|
package/README.md
CHANGED
|
@@ -139,6 +139,64 @@ bpg.convert(ast, { output: "./output.bitmark" });
|
|
|
139
139
|
bpg.convert(ast, { output: "./output.json", outputFormat: 'json' });
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
+
### Breakscaping
|
|
143
|
+
|
|
144
|
+
A text can be breakscaped programmatically for inclusion in bitmark.
|
|
145
|
+
|
|
146
|
+
NOTE: It is recommended the bit builder documented above in Programmatic Bitmark Creation is used rather than
|
|
147
|
+
hand-coding bitmark creation, because it guarantees the bitmark will be valid, and all breakscaping will be correct.
|
|
148
|
+
|
|
149
|
+
When breakscaping a text for inclusion in bitmark, the breakscaping applied depends on where that text appears in the
|
|
150
|
+
bitmark. The following four text locations require different breakscaping:
|
|
151
|
+
|
|
152
|
+
| Bit Format | Text Location |
|
|
153
|
+
|----------|-------------|
|
|
154
|
+
| bitmark++ | body |
|
|
155
|
+
| bitmark++ | tag |
|
|
156
|
+
| text (not bitmark++) | body |
|
|
157
|
+
| text (not bitmark++) | tag |
|
|
158
|
+
|
|
159
|
+
Also, if a plain text divider `==== text ====` is used, then text after the divider must be breakscaped using
|
|
160
|
+
`text:body` even if the bit is `bitmark++`.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { BitmarkParserGenerator, BodyTextFormat, TextLocation, InputType } from 'bitmark-parser-generator';
|
|
164
|
+
|
|
165
|
+
const bpg = new BitmarkParserGenerator();
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
const breakscaped = bpg.breakscapeText("This is the [!text] to be breakscaped", {
|
|
169
|
+
inputFormat: InputType.string, // or "string"
|
|
170
|
+
textFormat: BodyTextFormat.bitmarkPlusPlus, // or "bitmark++"
|
|
171
|
+
textLocation: TextLocation.body, // or "body"
|
|
172
|
+
});
|
|
173
|
+
// breakscaped = "This is the [^!text] to be breakscaped"
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
const breakscaped = bpg.breakscapeText("This is the [!text] to be breakscaped", {
|
|
177
|
+
inputFormat: InputType.string, // or "string"
|
|
178
|
+
textFormat: BodyTextFormat.bitmarkPlusPlus, // or "bitmark++"
|
|
179
|
+
textLocation: TextLocation.tag, // or "tag"
|
|
180
|
+
});
|
|
181
|
+
// breakscaped = "This is the [!text^] to be breakscaped"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
### Info
|
|
187
|
+
|
|
188
|
+
Information about the supported bits can be retreived via the info API
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
import { BitmarkParserGenerator } from 'bitmark-parser-generator';
|
|
192
|
+
|
|
193
|
+
const bpg = new BitmarkParserGenerator();
|
|
194
|
+
|
|
195
|
+
// Write supported bit info to the console
|
|
196
|
+
const info = bpg.info();
|
|
197
|
+
console.log(JSON.stringify(info, null, 2));
|
|
198
|
+
```
|
|
199
|
+
|
|
142
200
|
|
|
143
201
|
### Upgrade
|
|
144
202
|
|