Microdown icon indicating copy to clipboard operation
Microdown copied to clipboard

'{}' is not parse well

Open Ducasse opened this issue 1 year ago • 1 comments

| newDocument |
newDocument := parser parse: '{}'
newDocument first .

says that it is unparseable as a key...

| newDocument |
	newDocument := parser parse: '{
	
	}'
newDocument first .

Ducasse avatar Aug 06 '24 14:08 Ducasse

Should add

MicTextualMicrodownExporterTest >> testMetaDataEmpty

	| newDocument |
	newDocument := parser parse: '{}'.
	visitor visit: newDocument.

	self assert: visitor contents equals: '{}'.

Ducasse avatar Aug 06 '24 14:08 Ducasse

This is from nearly a year ago, and Microdown seems to be changing. Here is my translations of your comments above: "parser parse: '{}'" is the same as parser := MicrodownParser new. (parser parse: '{}'). The "first" is now (parser parse: '{}') children first. "Metadata: a Dictionary('unparsableContents'->nil )" which also says "unparalleled" (though slightly different).

Class MicRichTextComposer seems to be the one that was previously the one you mention: MicTextualMicrodownExporter. That implies that the test has become MicMetaDataBlockTest.

So, there is a MicMetaDataBlockTest>>testParse, with some code like: testParse

| source root metadata |
source := '{

"authors" : "S. Ducasse" , "title" : "Pharo by Example" }

header'....

So the thing needed is a similar test, where the {...} is empty, and should be tested for both {} and {....} where ... is ascii < 32.

If all of this is true, writing the actual test is simple. I assume it to be the case, but will not be done now, as it is evening time...

kasperosterbye avatar Jul 11 '25 17:07 kasperosterbye

As I guessed, I solved the issue, see #954.

It turns out that the { ... } is not working on: source := '{ "authors" : "S. Ducasse" , "title" : "Pharo by Example" }'.

The first line starting with "{", cannot have any arguments after it. This is however allowed: source := '{ "authors" : "S. Ducasse" , "title" : "Pharo by Example" }'. That is, ending with "}" works.

kasperosterbye avatar Jul 12 '25 15:07 kasperosterbye