From 318946cb9311caed512bfff2af70732a6e1043e0 Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Fri, 10 Jun 2022 14:57:18 +0200 Subject: [PATCH 01/42] hacking a solution for the comment problem --- .../MacRawParagraphBlock.class.st | 15 +++++++++------ src/Microdown-Macrodown/MacrodownParser.class.st | 10 ++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Microdown-Macrodown/MacRawParagraphBlock.class.st b/src/Microdown-Macrodown/MacRawParagraphBlock.class.st index 765e568a..7ffcbae4 100644 --- a/src/Microdown-Macrodown/MacRawParagraphBlock.class.st +++ b/src/Microdown-Macrodown/MacRawParagraphBlock.class.st @@ -16,20 +16,23 @@ MacRawParagraphBlock class >> htmlTags [ { #category : #testing } MacRawParagraphBlock class >> matches: aString [ - ^ self startsWithHtmlTag: aString trimLeft + ^ self matches: aString trimLeft withAnyOf: self htmlTags ] { #category : #private } -MacRawParagraphBlock class >> startsWithHtmlTag: aString [ - | htmlTags | - +MacRawParagraphBlock class >> matches: aString withAnyOf: htmlTags [ + aString ifEmpty: [ ^ false ]. - - htmlTags := self htmlTags. ^ (aString first = $<) and: [ htmlTags includes: (aString readStream upToAnyOf: '> ') allButFirst ] ] +{ #category : #testing } +MacRawParagraphBlock class >> matchesComment: aString [ + + ^ self matches: aString withAnyOf: { self htmlTags first } +] + { #category : #visiting } MacRawParagraphBlock >> accept: aVisitor [ diff --git a/src/Microdown-Macrodown/MacrodownParser.class.st b/src/Microdown-Macrodown/MacrodownParser.class.st index 19e3bcf1..96807cd5 100644 --- a/src/Microdown-Macrodown/MacrodownParser.class.st +++ b/src/Microdown-Macrodown/MacrodownParser.class.st @@ -7,6 +7,16 @@ Class { #category : #'Microdown-Macrodown' } +{ #category : #public } +MacrodownParser >> blockStarterClassFrom: line [ + + self flag: #HACK. "This is a special case because it collides with environment" + (MacRawParagraphBlock matchesComment: line) + ifTrue: [ ^ self nonMatchedBlockClassFor: line ]. + + ^ super blockStarterClassFrom: line +] + { #category : #'node creation' } MacrodownParser >> elementBlockClasses [ From e7878356f552df3d90d580c45e3950e2eb5cc851 Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Fri, 10 Jun 2022 16:02:22 +0200 Subject: [PATCH 02/42] fixes --- src/Microdown-Macrodown/MacRawParagraphBlock.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microdown-Macrodown/MacRawParagraphBlock.class.st b/src/Microdown-Macrodown/MacRawParagraphBlock.class.st index 7ffcbae4..7fde0ec3 100644 --- a/src/Microdown-Macrodown/MacRawParagraphBlock.class.st +++ b/src/Microdown-Macrodown/MacRawParagraphBlock.class.st @@ -30,7 +30,9 @@ MacRawParagraphBlock class >> matches: aString withAnyOf: htmlTags [ { #category : #testing } MacRawParagraphBlock class >> matchesComment: aString [ - ^ self matches: aString withAnyOf: { self htmlTags first } + ^ self + matches: aString trimLeft + withAnyOf: { self htmlTags first } ] { #category : #visiting } From 6bb874f60b352f24efee1228495a31fe555b5b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Thu, 10 Nov 2022 10:18:17 +0100 Subject: [PATCH 03/42] Removing Document browser from the baseline --- src/BaselineOfMicrodown/BaselineOfMicrodown.class.st | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/BaselineOfMicrodown/BaselineOfMicrodown.class.st b/src/BaselineOfMicrodown/BaselineOfMicrodown.class.st index 61d49fa0..cfeafffa 100644 --- a/src/BaselineOfMicrodown/BaselineOfMicrodown.class.st +++ b/src/BaselineOfMicrodown/BaselineOfMicrodown.class.st @@ -32,7 +32,7 @@ BaselineOfMicrodown >> baseline: spec [ package: #'Microdown-MathFlaky-Tests' with: [ spec requires: #( #'Microdown-RichTextComposer-Tests' ) ]; - package: #'Microdown-RichTextPresenter' + "package: #'Microdown-RichTextPresenter' with: [ spec requires: #( #Microdown ) ]; package: #'Microdown-RichTextPresenter-Tests' with: [ spec requires: #( #'Microdown-RichTextPresenter' ) ]; @@ -40,7 +40,7 @@ BaselineOfMicrodown >> baseline: spec [ package: #'Microdown-DocumentBrowser' with: [ spec requires: #( #Microdown #'Microdown-RichTextPresenter') ]; package: #'Microdown-DocumentBrowser-Tests' - with: [ spec requires: #( #'Microdown-DocumentBrowser' ) ]; + with: [ spec requires: #( #'Microdown-DocumentBrowser' ) ];" package: #'Microdown-Transformer' with: [ spec requires: #( #Microdown ) ]; @@ -80,10 +80,12 @@ BaselineOfMicrodown >> baseline: spec [ group: 'Tests' with: #('Core' 'Microdown-Tests'); group: 'RichText' with: #('Core' 'Microdown-RichTextComposer' ); group: 'Extensions' with: #( + " #'Microdown-RichTextPresenter' #'Microdown-RichTextPresenter-Tests' #'Microdown-DocumentBrowser' - #'Microdown-DocumentBrowser-Tests' + #'Microdown-DocumentBrowser-Tests' + " #'Microdown-Evaluator' #'Microdown-Evaluator-Tests' #'Microdown-PrettyPrinter' From 9c4d93904d709a5d92fd46d03970d26b7d83eddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Sun, 13 Nov 2022 20:43:24 +0100 Subject: [PATCH 04/42] Fixes initialTextAttributes --- .../MicSmalltalkTextStyler.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st b/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st index 710233b0..7aeb1234 100644 --- a/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st +++ b/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st @@ -15,9 +15,9 @@ MicSmalltalkTextStyler class >> initialTextAttributesForPixelHeight: aNumber [ | dict | dict := super initialTextAttributesForPixelHeight: aNumber. dict at: #undefinedIdentifier put: (dict at: #instVar). - dict at: #undefinedKeyword put: (dict at: #keyword). - dict at: #undefinedBinary put: (dict at: #binary). - dict at: #undefinedUnary put: (dict at: #unary). + dict at: #undefinedKeyword put: (dict at: #patternKeyword). + dict at: #undefinedBinary put: (dict at: #patternBinary). + dict at: #undefinedUnary put: (dict at: #patternUnary). ^ dict ] From dde5a3da82ad170a6c31fe0b171fe48c9e2339fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Mon, 14 Nov 2022 09:03:25 +0100 Subject: [PATCH 05/42] Removing Microdown-DocumentBrowser and RichTextPresenter from MD. --- ...festMicrodownDocumentBrowserTests.class.st | 8 - ...MicDocumentBrowserLayoutModelTest.class.st | 152 ------- .../MicDocumentBrowserModelTest.class.st | 111 ----- .../MicGitHubAPITest.class.st | 78 ---- .../MicGitHubRessourceReferenceTest.class.st | 192 -------- ...ClassCommentResourceReferenceTest.class.st | 55 --- ...PharoCommentResourceReferenceTest.class.st | 39 -- ...ckageCommentResourceReferenceTest.class.st | 185 -------- .../MicSectionBlockTest.class.st | 147 ------ .../package.st | 1 - .../ManifestMicrodownDocumentBrowser.class.st | 20 - .../MicAbsoluteResourceReference.extension.st | 17 - .../MicAbstractBlock.extension.st | 25 -- .../MicDocumentBrowser.class.st | 425 ------------------ .../MicDocumentBrowserButtonBar.class.st | 36 -- .../MicDocumentBrowserLayoutModel.class.st | 132 ------ .../MicDocumentBrowserModel.class.st | 93 ---- .../MicFileResourceReference.extension.st | 8 - .../MicGitHubAPI.class.st | 81 ---- .../MicGitHubAPIRateError.class.st | 24 - .../MicGitHubRessourceReference.class.st | 182 -------- .../MicHeaderBlock.extension.st | 6 - .../MicIntermediateBlock.class.st | 26 -- ...haroClassCommentResourceReference.class.st | 69 --- .../MicPharoCommentResourceReference.class.st | 33 -- ...roPackageCommentResourceReference.class.st | 218 --------- .../MicSectionBlock.class.st | 147 ------ src/Microdown-DocumentBrowser/package.st | 1 - .../MicTextPresenterTest.class.st | 133 ------ .../MicrodownPresenterTest.class.st | 41 -- .../MicrodownSpecComponentForTest.class.st | 66 --- .../MicrodownSpecComponentTest.class.st | 16 - .../package.st | 1 - ...anifestMicrodownRichTextPresenter.class.st | 11 - .../MicElement.extension.st | 8 - .../MicMorphicTextAdapter.class.st | 91 ---- .../MicScrolledTextMorph.class.st | 27 -- .../MicTextPresenter.class.st | 333 -------------- .../MicrodownPresenter.class.st | 83 ---- .../SequenceableCollection.extension.st | 10 - .../Text.extension.st | 8 - src/Microdown-RichTextPresenter/package.st | 1 - 42 files changed, 3340 deletions(-) delete mode 100644 src/Microdown-DocumentBrowser-Tests/ManifestMicrodownDocumentBrowserTests.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserLayoutModelTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserModelTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicGitHubAPITest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicGitHubRessourceReferenceTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicPharoClassCommentResourceReferenceTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicPharoCommentResourceReferenceTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicPharoPackageCommentResourceReferenceTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/MicSectionBlockTest.class.st delete mode 100644 src/Microdown-DocumentBrowser-Tests/package.st delete mode 100644 src/Microdown-DocumentBrowser/ManifestMicrodownDocumentBrowser.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicAbsoluteResourceReference.extension.st delete mode 100644 src/Microdown-DocumentBrowser/MicAbstractBlock.extension.st delete mode 100644 src/Microdown-DocumentBrowser/MicDocumentBrowser.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicDocumentBrowserButtonBar.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicDocumentBrowserLayoutModel.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicDocumentBrowserModel.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicFileResourceReference.extension.st delete mode 100644 src/Microdown-DocumentBrowser/MicGitHubAPI.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicGitHubAPIRateError.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicGitHubRessourceReference.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicHeaderBlock.extension.st delete mode 100644 src/Microdown-DocumentBrowser/MicIntermediateBlock.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicPharoClassCommentResourceReference.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicPharoCommentResourceReference.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicPharoPackageCommentResourceReference.class.st delete mode 100644 src/Microdown-DocumentBrowser/MicSectionBlock.class.st delete mode 100644 src/Microdown-DocumentBrowser/package.st delete mode 100644 src/Microdown-RichTextPresenter-Tests/MicTextPresenterTest.class.st delete mode 100644 src/Microdown-RichTextPresenter-Tests/MicrodownPresenterTest.class.st delete mode 100644 src/Microdown-RichTextPresenter-Tests/MicrodownSpecComponentForTest.class.st delete mode 100644 src/Microdown-RichTextPresenter-Tests/MicrodownSpecComponentTest.class.st delete mode 100644 src/Microdown-RichTextPresenter-Tests/package.st delete mode 100644 src/Microdown-RichTextPresenter/ManifestMicrodownRichTextPresenter.class.st delete mode 100644 src/Microdown-RichTextPresenter/MicElement.extension.st delete mode 100644 src/Microdown-RichTextPresenter/MicMorphicTextAdapter.class.st delete mode 100644 src/Microdown-RichTextPresenter/MicScrolledTextMorph.class.st delete mode 100644 src/Microdown-RichTextPresenter/MicTextPresenter.class.st delete mode 100644 src/Microdown-RichTextPresenter/MicrodownPresenter.class.st delete mode 100644 src/Microdown-RichTextPresenter/SequenceableCollection.extension.st delete mode 100644 src/Microdown-RichTextPresenter/Text.extension.st delete mode 100644 src/Microdown-RichTextPresenter/package.st diff --git a/src/Microdown-DocumentBrowser-Tests/ManifestMicrodownDocumentBrowserTests.class.st b/src/Microdown-DocumentBrowser-Tests/ManifestMicrodownDocumentBrowserTests.class.st deleted file mode 100644 index 2aa104be..00000000 --- a/src/Microdown-DocumentBrowser-Tests/ManifestMicrodownDocumentBrowserTests.class.st +++ /dev/null @@ -1,8 +0,0 @@ -" -No description for this package available. Please add a description for this package here -" -Class { - #name : #ManifestMicrodownDocumentBrowserTests, - #superclass : #PackageManifest, - #category : #'Microdown-DocumentBrowser-Tests-Manifest' -} diff --git a/src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserLayoutModelTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserLayoutModelTest.class.st deleted file mode 100644 index 1aa39def..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserLayoutModelTest.class.st +++ /dev/null @@ -1,152 +0,0 @@ -" -A MicDocumentBrowserLayoutModelTest is a test class for testing the behavior of MicDocumentBrowserLayoutModel -" -Class { - #name : #MicDocumentBrowserLayoutModelTest, - #superclass : #TestCase, - #instVars : [ - 'model', - 'testDocumentList', - 'testRender', - 'testSource' - ], - #category : #'Microdown-DocumentBrowser-Tests-GUI' -} - -{ #category : #running } -MicDocumentBrowserLayoutModelTest >> setUp [ - super setUp. - - model := MicDocumentBrowserLayoutModel new. - testDocumentList := SpTextPresenter new text: 'list'. - testRender := SpTextPresenter new text: 'render'. - testSource := SpTextPresenter new text: 'source' -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testInitilize [ - self - assert: model showDocumentList; - deny: model showSource; - assert: model sourceMode equals: model sourceBotton -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testNoListAndNoSource [ - | layout | - model showDocumentList: false. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self assert: layout equals: testRender . -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testNoListAndSource [ - | layout | - model showDocumentList: false. - model showSource: true. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self - assert: layout class equals: SpPanedLayout ; - assert: layout children first equals: testRender; - assert: layout children second equals: testSource - -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testSourceBottom [ - | layout | - model showDocumentList: false. - model showSource: true. - model sourceMode: model sourceBotton. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self - assert: layout direction class equals: SpVerticalLayoutDirection; - assert: layout children first equals: testRender; - assert: layout children second equals: testSource - -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testSourceLeft [ - | layout | - model showDocumentList: false. - model showSource: true. - model sourceMode: model sourceLeft. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self - assert: layout direction class equals: SpHorizontalLayoutDirection ; - assert: layout children first equals: testSource; - assert: layout children second equals: testRender - -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testSourceRight [ - | layout | - model showDocumentList: false. - model showSource: true. - model sourceMode: model sourceRight. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self - assert: layout direction class equals: SpHorizontalLayoutDirection ; - assert: layout children first equals: testRender; - assert: layout children second equals: testSource - -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testSourceTop [ - | layout | - model showDocumentList: false. - model showSource: true. - model sourceMode: model sourceTop. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self - assert: layout direction class equals: SpVerticalLayoutDirection; - assert: layout children first equals: testSource; - assert: layout children second equals: testRender - -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testStandardLayout [ - | layout | - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self assert: layout children first equals: testDocumentList. - self assert: layout children second equals: testRender -] - -{ #category : #tests } -MicDocumentBrowserLayoutModelTest >> testStandardLayoutWithSource [ - | layout | - model showSource: true. - layout := model - layoutList: testDocumentList - rendering: testRender - source: testSource. - self assert: layout children first equals: testDocumentList. - self assert: layout children second class equals: SpPanedLayout. - self assert: layout children second children first equals: testRender. - self assert: layout children second children second equals: testSource -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserModelTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserModelTest.class.st deleted file mode 100644 index c75adf3b..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicDocumentBrowserModelTest.class.st +++ /dev/null @@ -1,111 +0,0 @@ -" -A MicDocumentBrowserModelTest is a test class for testing the behavior of MicDocumentBrowserModel. - -This comment has `comment://class/MicDocumentBrowserModelTest` as micResourceReference -" -Class { - #name : #MicDocumentBrowserModelTest, - #superclass : #TestCase, - #instVars : [ - 'model' - ], - #category : #'Microdown-DocumentBrowser-Tests-GUI' -} - -{ #category : #'as yet unclassified' } -MicDocumentBrowserModelTest class >> backupComment [ - ^ 'A MicDocumentBrowserModelTest is a test class for testing the behavior of MicDocumentBrowserModel. - -This comment has `comment://class/MicDocumentBrowserModelTest` as micResourceReference' -] - -{ #category : #'as yet unclassified' } -MicDocumentBrowserModelTest class >> myCommentRefernce [ - ^ 'comment://class/MicDocumentBrowserModelTest' asMicResourceReference -] - -{ #category : #running } -MicDocumentBrowserModelTest >> setUp [ - super setUp. - - model := MicDocumentBrowserModel new. -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testCanSave [ - model resourceReference: 'https://nowhere.atall' asMicResourceReference. - self deny: model canSave. -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testDocument [ - model resourceReference: self class myCommentRefernce. - self - assert: model document children first class equals: MicHeaderBlock. - model resourceReference: nil. - self - assert: model document isNil -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testInitilize [ - self - assert: model resourceReference equals: nil; - assert: model document equals: nil; - assert: model source equals: nil; - deny: model canSave; - deny: model isDirty -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testIsDirty [ - model resourceReference: self class myCommentRefernce. - self deny: model isDirty. - model source: 'Dummy source'. - self assert: model isDirty -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testResourceReference [ - model resourceReference: self class myCommentRefernce. - self - assert: model resourceReference uri equals: self class myCommentRefernce uri; - assert: model document children first class equals: MicHeaderBlock ; - assert: (model source first: 57) equals: 'A MicDocumentBrowserModelTest is a test class for testing'; - assert: model canSave; - deny: model isDirty -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testSave [ - [ - model resourceReference: self class myCommentRefernce. - model - source: 'Dummy source'; - save. - self - deny: model isDirty; - assert: (self class comment) equals: 'Dummy source' - ] - ensure: [ self class comment: self class backupComment ] - -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testSave_not [ - "Pick a resource which is read-only" - model resourceReference: 'pharo:///MicDocumentBrowserModelTest/backupComment' asMicResourceReference. - model source: 'Should not be written'. - self deny: model source equals: 'Should not be written' - -] - -{ #category : #tests } -MicDocumentBrowserModelTest >> testSource [ - model resourceReference: self class myCommentRefernce. - self - assert: (model source first: 57) equals: 'A MicDocumentBrowserModelTest is a test class for testing'. - model resourceReference: nil. - self - assert: model source isNil -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicGitHubAPITest.class.st b/src/Microdown-DocumentBrowser-Tests/MicGitHubAPITest.class.st deleted file mode 100644 index 0aac0ef5..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicGitHubAPITest.class.st +++ /dev/null @@ -1,78 +0,0 @@ -" -A MicGitHubAPITest is a test class for testing the behavior of MicGitHubAPI -" -Class { - #name : #MicGitHubAPITest, - #superclass : #TestCase, - #instVars : [ - 'api' - ], - #category : #'Microdown-DocumentBrowser-Tests-ResourceModel' -} - -{ #category : #'api - accessing' } -MicGitHubAPITest >> ensureApi: anInteger for: aFullBlockClosure [ - api class apiCallsRemaining >= anInteger - ifTrue: [ aFullBlockClosure value ] - ifFalse: [ self skip: 'Rate limit exhaused' ] -] - -{ #category : #running } -MicGitHubAPITest >> setUp [ - super setUp. - - api := MicGitHubAPI new. - MicGitHubAPI apiCallsRemaining = 60 - ifTrue: [ - [ api defaultBranch: 'pillar-markup' project: 'Microdown' ] - on: MicGitHubAPIRateError - do: [ 'Just reading the default branch will set the number of API calls remaining' ]] -] - -{ #category : #tests } -MicGitHubAPITest >> testGet [ - | url res | - self ensureApi: 1 for: [ - url := 'repos/pillar-markup/Microdown'. - res := api get: url. - self assert: (res at: 'full_name') equals: 'pillar-markup/Microdown'. - self assert: (res at: 'default_branch') equals: 'dev'] -] - -{ #category : #tests } -MicGitHubAPITest >> testIsCaching [ - | url res rate| - self ensureApi: 1 for: [ - url := 'repos/pillar-markup/Microdown'. - res := api get: url. - self assert: (api class cache includesKey: url). - rate := MicGitHubAPI apiCallsRemaining. - api get: url. - self assert: MicGitHubAPI apiCallsRemaining equals: rate - ]. -] - -{ #category : #tests } -MicGitHubAPITest >> testdefaultBranchProject [ - | branch | - self ensureApi: 1 for: [ - branch := api defaultBranch: 'pillar-markup' project: 'Microdown'. - self assert: branch equals: 'dev'] -] - -{ #category : #tests } -MicGitHubAPITest >> testdefaultBranchProject_Pharo [ - | branch | - self ensureApi: 1 for: [ - branch := api defaultBranch: 'pharo-project' project: 'pharo'. - self assert: (branch beginsWith: 'Pharo')] -] - -{ #category : #tests } -MicGitHubAPITest >> testdefaultBranchProject_defaultBranch [ - - | branch | - self ensureApi: 1 for: [ - branch := api defaultBranch: 'JohnDoe' project: 'Calculator'. - self assert: branch equals: 'main'] -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicGitHubRessourceReferenceTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicGitHubRessourceReferenceTest.class.st deleted file mode 100644 index ca44f87d..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicGitHubRessourceReferenceTest.class.st +++ /dev/null @@ -1,192 +0,0 @@ -" -A MicGitHubRessourceReferenceTest is a test class for testing the behavior of MicGitHubRessourceReference -" -Class { - #name : #MicGitHubRessourceReferenceTest, - #superclass : #TestCase, - #category : #'Microdown-DocumentBrowser-Tests-ResourceModel' -} - -{ #category : #'api - accessing' } -MicGitHubRessourceReferenceTest >> ensureApi: anInteger for: aFullBlockClosure [ - MicGitHubAPI apiCallsRemaining >= anInteger - ifTrue: [ aFullBlockClosure value ] - ifFalse: [ self skip: 'Rate limit exhaused' ] -] - -{ #category : #'test data' } -MicGitHubRessourceReferenceTest >> sampleTreeResponse [ - - ^ { - ('sha' -> '3d2ff94661d6a0399e3f4ea0ea5dc36a45971bf2'). - ('tree' -> { - { - ('mode' -> '040000'). - ('path' -> 'images'). - ('sha' -> 'b1dc21dabca4c774fec51c52b8b5f576cf53ff08'). - ('type' -> 'tree'). - ('url' - -> - 'https://api.github.com/repos/pillar-markup/Microdown/git/trees/b1dc21dabca4c774fec51c52b8b5f576cf53ff08') } - asDictionary. - { - ('mode' -> '100644'). - ('path' -> 'other.md'). - ('sha' -> '1b37a7800cfdfd2692662bfd6e743b5a33faef46'). - ('size' -> 97). - ('type' -> 'blob'). - ('url' - -> - 'https://api.github.com/repos/pillar-markup/Microdown/git/blobs/1b37a7800cfdfd2692662bfd6e743b5a33faef46') } - asDictionary. - { - ('mode' -> '100644'). - ('path' -> 'readme.md'). - ('sha' -> '0d0a4c4fbe085e75d0cc3b69b5f520b9c4b4c288'). - ('size' -> 439). - ('type' -> 'blob'). - ('url' - -> - 'https://api.github.com/repos/pillar-markup/Microdown/git/blobs/0d0a4c4fbe085e75d0cc3b69b5f520b9c4b4c288') } - asDictionary. - { - ('mode' -> '040000'). - ('path' -> 'subfolder'). - ('sha' -> 'b490118847905baf156093fba34ce8381304f252'). - ('type' -> 'tree'). - ('url' - -> - 'https://api.github.com/repos/pillar-markup/Microdown/git/trees/b490118847905baf156093fba34ce8381304f252') } - asDictionary. - { - ('mode' -> '100644'). - ('path' -> 'toplevel.png'). - ('sha' -> 'e301bdce18877ad507b6080d4122eda9fc05461a'). - ('size' -> 442). - ('type' -> 'blob'). - ('url' - -> - 'https://api.github.com/repos/pillar-markup/Microdown/git/blobs/e301bdce18877ad507b6080d4122eda9fc05461a') } - asDictionary }). - ('truncated' -> false). - ('url' - -> - 'https://api.github.com/repos/pillar-markup/Microdown/git/trees/3d2ff94661d6a0399e3f4ea0ea5dc36a45971bf2') } - asDictionary -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testContents [ - |uri ref contents| - self ensureApi: 4 for: [ "need one for default branch, and one for each level of directory" - uri := 'github://pillar-markup/Microdown/doc/testMicrodown/readme.md'. - ref := MicResourceReference fromUri: uri. - contents := ref contents. - self - assert: (contents beginsWith: '# Test documents' )] -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testExtractFolderReferencesFrom [ - - | uri ref response folders expectedRaw | - - uri := 'github://pillar-markup/Microdown:testBranch/doc/testMicrodown'. - ref := MicResourceReference fromUri: uri. - response := self sampleTreeResponse. - folders := ref extractFolderReferencesFrom: response. - self assert: folders size equals: 2. - expectedRaw := 'https://raw.githubusercontent.com/pillar-markup/Microdown/testBranch/doc/testMicrodown'. - self assert: (folders - allSatisfy: [:folder | - folder pathStringForRawAccess beginsWith: expectedRaw]) - -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testExtractMicrodownDocReferencesFrom [ - - | uri ref response documents expectedRaw | - uri := 'github://pillar-markup/Microdown:testBranch/doc/testMicrodown'. - ref := MicResourceReference fromUri: uri. - response := self sampleTreeResponse. - documents := ref extractMicrodownDocReferencesFrom: response. - self assert: documents size equals: 2. - expectedRaw := 'https://raw.githubusercontent.com/pillar-markup/Microdown/testBranch/doc/testMicrodown'. - self assert: (documents - allSatisfy: [ :doc | - doc fullName beginsWith: expectedRaw ]) - -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testGithubTreesApiRequest [ - |uri ref| - uri := 'github://JohnDoe/Calculator:devBranch/path/to/docs'. - ref := MicResourceReference fromUri: uri. - self - assert: ref githubTreesApiRequest - equals: 'repos/johndoe/Calculator/git/trees/devBranch'. -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testLoadChildren [ - |uri ref children| - self ensureApi: 3 for: [ - uri := 'github://pillar-markup/Microdown/doc/testMicrodown'. - ref := MicResourceReference fromUri: uri. - children := ref loadChildren. - self - assert: children size - equals: 4. - self assert: (children allSatisfy: [:child | child isKindOf: MicAbsoluteResourceReference ])] -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testUri [ - |uri ref| - uri := 'github://JohnDoe/Calculator:devBranch/path/to/docs'. - ref := MicResourceReference fromUri: uri. - self assert: ref class equals: MicGitHubRessourceReference. - self assert: ref user equals: 'johndoe'. - self assert: ref project equals: 'Calculator'. - self assert: ref branch equals: 'devBranch'. - self assert: ref docFolder equals: { 'path'. 'to'. 'docs' } -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testUri_defaultBranch [ - |uri ref| - self ensureApi: 1 for: [ "needs one api callto establish default branch" - uri := 'github://JohnDoe/Calculator'. - ref := MicResourceReference fromUri: uri. - - self assert: ref branch equals: 'main'] -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testUri_defaultBranch_Pharo [ - |uri ref| - self ensureApi: 1 for: [ "needs one api callto establish default branch" - uri := 'github://pharo-project/pharo'. - ref := MicResourceReference fromUri: uri. - - self assert: (ref branch beginsWith: 'Pharo')] -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testUri_defaultBranch_Pharo_withDoc [ - |uri ref| - uri := 'github://pharo-project/pharo:dummyBranch/path/to/docs'. - ref := MicResourceReference fromUri: uri. - self assert: ref docFolder equals: { 'path'. 'to'. 'docs' } -] - -{ #category : #tests } -MicGitHubRessourceReferenceTest >> testUri_defaultPath [ - |uri ref| - uri := 'github://JohnDoe/Calculator:devBranch'. - ref := MicResourceReference fromUri: uri. - - self assert: ref docFolder equals: #() -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicPharoClassCommentResourceReferenceTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicPharoClassCommentResourceReferenceTest.class.st deleted file mode 100644 index 0aa7ee5e..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicPharoClassCommentResourceReferenceTest.class.st +++ /dev/null @@ -1,55 +0,0 @@ -" -This class contains tests -" -Class { - #name : #MicPharoClassCommentResourceReferenceTest, - #superclass : #TestCase, - #instVars : [ - 'savedComment' - ], - #category : #'Microdown-DocumentBrowser-Tests-ResourceModel' -} - -{ #category : #running } -MicPharoClassCommentResourceReferenceTest >> setUp [ - super setUp. - savedComment := self class comment. -] - -{ #category : #running } -MicPharoClassCommentResourceReferenceTest >> tearDown [ - self class comment: savedComment. - super tearDown -] - -{ #category : #tests } -MicPharoClassCommentResourceReferenceTest >> testClassComment [ - | ref | - ref := 'comment://class/Microdown' asMicResourceReference. - self assert: ref contents equals: Microdown comment -] - -{ #category : #tests } -MicPharoClassCommentResourceReferenceTest >> testClassCommentWrite [ - | ref myName | - myName := self class name. - ref := ('comment://class/', myName) asMicResourceReference. - ref contents: 'Writing to comment'. - self assert: self class comment equals: 'Writing to comment' -] - -{ #category : #tests } -MicPharoClassCommentResourceReferenceTest >> testSetup [ - | ref | - ref := 'comment://class/Microdown' asMicResourceReference. - self assert: ref class equals: MicPharoClassCommentResourceReference. - self assert: ref classReference equals: Microdown -] - -{ #category : #tests } -MicPharoClassCommentResourceReferenceTest >> testSetup_metaClass [ - | ref | - ref := 'comment://class/Microdown/class' asMicResourceReference. - self assert: ref class equals: MicPharoClassCommentResourceReference. - self assert: ref classReference equals: Microdown class -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicPharoCommentResourceReferenceTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicPharoCommentResourceReferenceTest.class.st deleted file mode 100644 index 65291a37..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicPharoCommentResourceReferenceTest.class.st +++ /dev/null @@ -1,39 +0,0 @@ -Class { - #name : #MicPharoCommentResourceReferenceTest, - #superclass : #TestCase, - #category : #'Microdown-DocumentBrowser-Tests-ResourceModel' -} - -{ #category : #tests } -MicPharoCommentResourceReferenceTest >> testNewFromUri [ - | ref | - ref := 'comment://class/Microdown' asMicResourceReference. - self assert: ref class equals: MicPharoClassCommentResourceReference. - -] - -{ #category : #tests } -MicPharoCommentResourceReferenceTest >> testNewFromUri_hostError [ - self - should: [ 'comment://foo/Microdown' asMicResourceReference ] - raise: MicResourceReferenceError - - -] - -{ #category : #tests } -MicPharoCommentResourceReferenceTest >> testNewFromUri_packageComment [ - | ref | - ref := 'comment://package/Microdown' asMicResourceReference. - self assert: ref class equals: MicPharoPackageCommentResourceReference. - -] - -{ #category : #tests } -MicPharoCommentResourceReferenceTest >> testNoBinaryReading [ - self - should: [ 'comment://class/Microdown' asMicResourceReference loadImage ] - raise: MicResourceReferenceError - - -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicPharoPackageCommentResourceReferenceTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicPharoPackageCommentResourceReferenceTest.class.st deleted file mode 100644 index 8ab4102f..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicPharoPackageCommentResourceReferenceTest.class.st +++ /dev/null @@ -1,185 +0,0 @@ -Class { - #name : #MicPharoPackageCommentResourceReferenceTest, - #superclass : #TestCase, - #instVars : [ - 'savedComment' - ], - #category : #'Microdown-DocumentBrowser-Tests-ResourceModel' -} - -{ #category : #running } -MicPharoPackageCommentResourceReferenceTest >> setUp [ - super setUp. - savedComment := self class package packageComment. -] - -{ #category : #running } -MicPharoPackageCommentResourceReferenceTest >> tearDown [ - self class package packageComment: savedComment. - super tearDown -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testCategoryName [ - | ref | - ref := 'comment://package/Microdown' asMicResourceReference. - self assert: ref categoryName equals: 'Microdown'. - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testContents [ - | ref | - ref := 'comment://package/Microdown' asMicResourceReference. - self assert: ref contents equals: 'Microdown' asPackage packageComment. - self assert: ref contents notEmpty - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testIsPackage [ - self assert: 'comment://package/Microdown' asMicResourceReference isPackage. - self assert: 'comment://package/Microdown-RichTextComposer' asMicResourceReference isPackage. - self deny: 'comment://package/Microdown-Core' asMicResourceReference isPackage. - self deny: 'comment://package/Microup' asMicResourceReference isPackage. - - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testIsTag [ - self deny: 'comment://package/Microdown' asMicResourceReference isTag . - self - assert: 'comment://package/Microdown-Core' asMicResourceReference isTag . - self - assert: 'comment://package/Microdown-RichTextComposer-Table-Support' asMicResourceReference isTag. - self - deny: 'comment://package/Calypso-SystemPlugins-ClassScripts' asMicResourceReference isTag -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testKind [ - self - assert: 'comment://package/Microdown*' asMicResourceReference kind - equals: #prefix. - self - assert: 'comment://package/Microdown' asMicResourceReference kind - equals: #package. - self - assert: 'comment://package/Microdown-Core' asMicResourceReference kind - equals: #tag. - self - assert: 'comment://package/Microdown-RichTextComposer-Table-Support' asMicResourceReference kind - equals: #tag. - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testLoadDirectory [ - | ref dir | - ref := 'comment://package/Microdown' asMicResourceReference. - dir := ref loadChildren. - self assert: dir notEmpty. - self assert: (dir allSatisfy: [ :r |r class = MicPharoPackageCommentResourceReference ] ). - self assert: (dir first uri segments first beginsWith: 'Microdown') -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testLoadDirectory_emptyPrefix [ - | dir prefixes | - dir := 'comment://package/' asMicResourceReference loadChildren. - self assert: (dir size between: 100 and: 200). - "check that four known prefises are in the found set." - prefixes := dir collect: [ :ref | ref uri segments first ]. - self assert: (#(AST Collections Refactoring Iceberg) \ prefixes) isEmpty. - self assert: (prefixes allSatisfy: [:prefix | (prefix occurrencesOf: $-) = 0]) -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testLoadDirectory_package [ - | ref dir | - ref := 'comment://package/Microdown?kind=package' asMicResourceReference. - dir := ref loadChildren. - "Expect Extension and Manifest tags removed" - self assert: dir size equals: ('Microdown' asPackage classTags size - 2). - self assert: (dir allSatisfy: [ :r |r class = MicPharoPackageCommentResourceReference ] ). - self assert: (dir first uri segments first beginsWith: 'Microdown-'). - self assert: (dir allSatisfy: [:r | r kind = #tag]) - - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testLoadDirectory_prefix [ - | ref dir | - ref := 'comment://package/Microdown-DocumentBrowser' asMicResourceReference. - dir := ref loadChildren. - self assert: dir size equals: 3. -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testLoadDirectory_withTag [ - | ref dir | - ref := 'comment://package/Microdown-DocumentBrowser-Tests-ResourceModel' asMicResourceReference. - dir := ref loadChildren. - self assert: dir notEmpty. - self assert: (dir allSatisfy: [ :r |r class = MicPharoClassCommentResourceReference ] ). - self assert: (dir anySatisfy: [:aRef | aRef uri segments first = self class name]) -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testNewFromUri [ - | ref | - ref := 'comment://package/Microdown' asMicResourceReference. - self assert: ref class equals: MicPharoPackageCommentResourceReference. - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testPackageCommentWrite [ - | ref myName | - myName := self class package name. - ref := ('comment://package/', myName) asMicResourceReference. - ref contents: 'Writing to comment'. - self assert: self class package packageComment equals: 'Writing to comment' -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testPackageComment_NotThere [ - self assert: 'comment://package/Microdownnnnn' asMicResourceReference contents equals: '' - -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testParentPackage [ - self - assert: 'comment://package/Microdown' asMicResourceReference parentPackage - equals: 'Microdown' asPackage. - self - assert: 'comment://package/Microdown-Core' asMicResourceReference parentPackage - equals: 'Microdown' asPackage. - self - assert: 'comment://package/Microdown-RichTextComposer-Table-Support' asMicResourceReference parentPackage - equals: 'Microdown-RichTextComposer' asPackage. - self - assert: 'comment://package/Calypso-SystemPlugins-ClassScripts' asMicResourceReference parentPackage - equals: nil -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testReduceCategoryNameToLevel [ - | dummy | - dummy := MicPharoPackageCommentResourceReference new. - self assert: (dummy reduceCategoryName: '' toLevel: -1) equals: ''. - self assert: (dummy reduceCategoryName: 'aaa-bbb-ccc' toLevel: 0) equals: 'aaa'. - self assert: (dummy reduceCategoryName: 'aaa-bbb-ccc' toLevel: 1) equals: 'aaa-bbb'. - self assert: (dummy reduceCategoryName: 'aaa-bbb-ccc' toLevel: 2) equals: 'aaa-bbb-ccc' -] - -{ #category : #tests } -MicPharoPackageCommentResourceReferenceTest >> testSetup [ - | ref | - ref := 'comment://package/Microdown' asMicResourceReference. - self assert: ref class equals: MicPharoPackageCommentResourceReference. - self assert: ref categoryName equals: 'Microdown' -] diff --git a/src/Microdown-DocumentBrowser-Tests/MicSectionBlockTest.class.st b/src/Microdown-DocumentBrowser-Tests/MicSectionBlockTest.class.st deleted file mode 100644 index 1a7e26d5..00000000 --- a/src/Microdown-DocumentBrowser-Tests/MicSectionBlockTest.class.st +++ /dev/null @@ -1,147 +0,0 @@ -Class { - #name : #MicSectionBlockTest, - #superclass : #TestCase, - #category : #'Microdown-DocumentBrowser-Tests-BlockModel' -} - -{ #category : #tests } -MicSectionBlockTest >> testEmpty [ - "An empty document should not break sectioning" - | doc sec | - doc := Microdown parse: ''. - sec := MicSectionBlock fromRoot: doc. - self assert: sec class equals: MicSectionBlock. - self assert: sec header isNil. - self assert: sec body children isEmpty. - self assert: sec subsections children isEmpty -] - -{ #category : #tests } -MicSectionBlockTest >> testNoHeader [ - | doc sec | - doc := Microdown parse: 'This is **just** - -a few lines'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header equals: nil. - self assert: sec body children size equals: 2. - self assert: sec subsections children isEmpty -] - -{ #category : #tests } -MicSectionBlockTest >> testOneHeader [ - "With one header, only one section is created and become the root" - | doc sec | - doc := Microdown parse: -'# Header1 -This is **just** - -a few lines'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header children first text equals: 'Header1'. - self assert: sec body children size equals: 2. - self assert: sec subsections children isEmpty -] - -{ #category : #tests } -MicSectionBlockTest >> testOneHeaderWithInitialBody [ - "With one header, but body, a level 0 section is created and become the root" - | doc sec | - doc := Microdown parse: -'stuff here -# Header1 -This is **just** - -a few lines'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec level equals: 0. - self assert: sec header isNil. - self assert: sec body children first text equals: 'stuff here'. - self assert: sec subsections children size equals: 1 -] - -{ #category : #tests } -MicSectionBlockTest >> testOneHeaderWithSubHeader [ - "With one top header, only one section is created and become the root, subsections as its subsections" - | doc sec | - doc := Microdown parse: -'# Header1 -## sub1 -## sub2'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header children first text equals: 'Header1'. - self assert: sec subsections children size equals: 2 -] - -{ #category : #tests } -MicSectionBlockTest >> testSubHeaders [ - "Check more complex mixture of sections" - | doc sec header1 | - doc := Microdown parse: -'# Header1 -### subOfHeader1 -## sub2OfHeader1 -# Header2 -'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header isNil. - self assert: sec subsections children size equals: 2. - header1 := sec subsections children first. - self assert: header1 level equals: 1. - self assert: header1 subsections children size equals: 2. - self assert: header1 subsections children first level equals: 3. - self assert: header1 subsections children second level equals: 2. -] - -{ #category : #tests } -MicSectionBlockTest >> testTwoHeaders [ - "With several headers, the top section has empty header" - | doc sec | - doc := Microdown parse: -'# Header1 -This is **just** - -a few lines -# Header2'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header equals: nil. - self assert: sec body children isEmpty. - self assert: sec subsections children size equals: 2. - self assert: sec subsections children second header children first text equals: 'Header2'. -] - -{ #category : #tests } -MicSectionBlockTest >> testTwoHeadersAtDeeperLevel [ - "With several headers, the top section has empty header" - | doc sec | - doc := Microdown parse: -'## Header1 -This is **just** - -a few lines -## Header2'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header equals: nil. - self assert: sec body children isEmpty. - self assert: sec subsections children size equals: 2. - self assert: sec subsections children second header children first text equals: 'Header2'. -] - -{ #category : #tests } -MicSectionBlockTest >> testTwoHeadersWithInitialBody [ - "With several headers, the top section has empty header" - | doc sec | - doc := Microdown parse: -'Some stuff goes here -# Header1 -This is **just** - -a few lines -# Header2'. - sec := MicSectionBlock fromRoot: doc. - self assert: sec header equals: nil. - self assert: sec body children size equals: 1. - self assert: sec body children first text equals: 'Some stuff goes here'. - self assert: sec subsections children size equals: 2. - self assert: sec subsections children second header children first text equals: 'Header2'. -] diff --git a/src/Microdown-DocumentBrowser-Tests/package.st b/src/Microdown-DocumentBrowser-Tests/package.st deleted file mode 100644 index 3193df6b..00000000 --- a/src/Microdown-DocumentBrowser-Tests/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'Microdown-DocumentBrowser-Tests' } diff --git a/src/Microdown-DocumentBrowser/ManifestMicrodownDocumentBrowser.class.st b/src/Microdown-DocumentBrowser/ManifestMicrodownDocumentBrowser.class.st deleted file mode 100644 index a60a5d7f..00000000 --- a/src/Microdown-DocumentBrowser/ManifestMicrodownDocumentBrowser.class.st +++ /dev/null @@ -1,20 +0,0 @@ -" -I implement a browser and editor for Microdown documents. -See comment in `MicDocumentBrowser`. - -I implement two new kind of Microdown resource references: `MicPharoCommentResourceReference` and `MicGitHubRessourceReference`. - -And I extend the MicFileResourceReference with icons for use in the documnt browser. - -The classes in tag 'Model' are unused at the moment, but implement hierarchical structure over microdown documents and are just kept for reference for the time being (the issue is that some documents might be large, and it would be nice to browse a large document by sections in the tree view, but then what to do when trying to edit this large document). -" -Class { - #name : #ManifestMicrodownDocumentBrowser, - #superclass : #PackageManifest, - #category : #'Microdown-DocumentBrowser-Manifest' -} - -{ #category : #'code-critics' } -ManifestMicrodownDocumentBrowser class >> ruleBadMessageRule2V1FalsePositive [ - ^ #(#(#(#RGPackageDefinition #(#'Microdown-DocumentBrowser')) #'2022-07-13T10:42:18.082534+02:00') ) -] diff --git a/src/Microdown-DocumentBrowser/MicAbsoluteResourceReference.extension.st b/src/Microdown-DocumentBrowser/MicAbsoluteResourceReference.extension.st deleted file mode 100644 index ab4f2774..00000000 --- a/src/Microdown-DocumentBrowser/MicAbsoluteResourceReference.extension.st +++ /dev/null @@ -1,17 +0,0 @@ -Extension { #name : #MicAbsoluteResourceReference } - -{ #category : #'*Microdown-DocumentBrowser' } -MicAbsoluteResourceReference >> browserIcon [ - ^ self iconNamed: #book -] - -{ #category : #'*Microdown-DocumentBrowser' } -MicAbsoluteResourceReference >> browserTitle [ - | title slashes | - title := self uriString. - slashes := title allRangesOfSubstring: '/'. - slashes size <= 3 ifTrue: [ ^ title ]. - ^ '...', (title - copyFrom: (slashes at: (slashes size - 2)) first - to: title size) -] diff --git a/src/Microdown-DocumentBrowser/MicAbstractBlock.extension.st b/src/Microdown-DocumentBrowser/MicAbstractBlock.extension.st deleted file mode 100644 index 8fdf19e2..00000000 --- a/src/Microdown-DocumentBrowser/MicAbstractBlock.extension.st +++ /dev/null @@ -1,25 +0,0 @@ -Extension { #name : #MicAbstractBlock } - -{ #category : #'*Microdown-DocumentBrowser' } -MicAbstractBlock >> canSave [ - "Called by the document browser. Polymorphic with MicResourceReferences" - ^ false -] - -{ #category : #'*Microdown-DocumentBrowser' } -MicAbstractBlock >> contents [ - "polymorphic with MicResourceReference - returns the source code of me - here generated" - ^ 'You cannot edit subsections of a document. -Select the whole document for editing' -] - -{ #category : #'*Microdown-DocumentBrowser' } -MicAbstractBlock >> isHeader [ - ^ false -] - -{ #category : #'*Microdown-DocumentBrowser' } -MicAbstractBlock >> loadMicrodown [ - "polymorphic with resource references" - ^ self -] diff --git a/src/Microdown-DocumentBrowser/MicDocumentBrowser.class.st b/src/Microdown-DocumentBrowser/MicDocumentBrowser.class.st deleted file mode 100644 index d78577f1..00000000 --- a/src/Microdown-DocumentBrowser/MicDocumentBrowser.class.st +++ /dev/null @@ -1,425 +0,0 @@ -" -I am a browser of collections of microdown documents. - -I am work in progress, but reasonable functional. - -I open by `MicDocumentBrowser class >> #open`, or a specific document using: `MicDocumentBrowser class >> #openDocument:` which takes a `MicAbsoluteResourceReference` or a `String URI` as argument. - -Editing is done using the little edit flag in the lower right corner - there is currently no keyboard shortcut for this. -I can save some documents, but not all. I can save documents on files, and package/class comments. In particular I **cannot** save to github or the web. Saving is done on the save button when it is not greyed out. - -I open with some documents being loaded, those are currently defined in `MicDocumentBrowser >>#defaultDocumentRoots`. - -The roots loaded at the moment is: -- all class and package comments in the Microdown project (read and write) -- all docs found on github relating to Microdown (read-only as one do not write to github) -- all doc(s) folders found in iceberg workspace (read and write). This will be the th doc-folders of projects known by iceberg. -## Auto saving -Moving to an other document or closing the browser will save changes made in source - -## Preventing cyclic events -In order to prevent cycles in the events, all methods called through gui actions are garding some parts of their actions with a check on the variable `disabledEvents'. -" -Class { - #name : #MicDocumentBrowser, - #superclass : #SpPresenter, - #instVars : [ - 'spButtonBar', - 'spDocumentList', - 'spRendering', - 'spSource', - 'saveButton', - 'documentRoots', - 'documentModel', - 'layoutModel', - 'disableEvents', - 'browserApp' - ], - #classVars : [ - 'Browser' - ], - #category : #'Microdown-DocumentBrowser-GUI' -} - -{ #category : #'services menu' } -MicDocumentBrowser class >> fileReaderServicesForFile: fullName suffix: suffix [ - - suffix = 'md' ifFalse:[^ #() ]. - ^ { self serviceOpenMicrodownDocument } -] - -{ #category : #'services menu' } -MicDocumentBrowser class >> itemsForDirectory: aFileDirectory [ - - - ^ { self serviceOpenMicrodownDirectory } -] - -{ #category : #'instance creation' } -MicDocumentBrowser class >> open [ - "I ensure the browser to be open. If no browser exist, I instantiate one" -