diff --git a/.github/workflows/currentDev.yml b/.github/workflows/currentDev.yml deleted file mode 100644 index 724cb31c..00000000 --- a/.github/workflows/currentDev.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: currentDev - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -on: - push: - branches: - - dev - pull_request: - branches: - - dev - workflow_dispatch: - -jobs: - build: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest ] - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v2 - - uses: hpi-swa/setup-smalltalkCI@v1 - id: smalltalkci - with: - smalltalk-image: Pharo64-10 - - run: smalltalkci -s ${{ steps.smalltalkci.outputs.smalltalk-image }} - shell: bash - timeout-minutes: 15 diff --git a/.github/workflows/currentAll.yml b/.github/workflows/tests-all.yml similarity index 88% rename from .github/workflows/currentAll.yml rename to .github/workflows/tests-all.yml index dbe42676..a7346bed 100644 --- a/.github/workflows/currentAll.yml +++ b/.github/workflows/tests-all.yml @@ -6,9 +6,9 @@ env: on: push: - branches: [ integration ] + branches: [ Pharo12 ] pull_request: - branches: [ integration ] + branches: [ Pharo12 ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -19,11 +19,11 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - smalltalk: [ Pharo64-10 ] + smalltalk: [ Pharo64-12 ] runs-on: ${{ matrix.os }} name: ${{ matrix.smalltalk }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup smalltalkCI uses: hpi-swa/setup-smalltalkCI@v1 with: diff --git a/.github/workflows/currentMaster.yml b/.github/workflows/tests.yml similarity index 81% rename from .github/workflows/currentMaster.yml rename to .github/workflows/tests.yml index 2de2b14a..36743be6 100644 --- a/.github/workflows/currentMaster.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: currentMaster +name: MicroDown tests env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -6,9 +6,11 @@ env: on: push: branches: + - dev - master pull_request: branches: + - dev - master workflow_dispatch: @@ -19,11 +21,11 @@ jobs: platform: [ubuntu-latest, macos-latest ] runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: hpi-swa/setup-smalltalkCI@v1 id: smalltalkci with: - smalltalk-image: Pharo64-10 + smalltalk-image: Pharo64-12 - run: smalltalkci -s ${{ steps.smalltalkci.outputs.smalltalk-image }} shell: bash timeout-minutes: 15 diff --git a/.project b/.project index 81083cc7..9afb7f91 100644 --- a/.project +++ b/.project @@ -1,3 +1,4 @@ { - 'srcDirectory' : 'src' -} \ No newline at end of file + 'srcDirectory' : 'src', + 'tags' : [ #system ] +} diff --git a/.smalltalk.All.ston b/.smalltalk.All.ston index 26d37933..34f22396 100644 --- a/.smalltalk.All.ston +++ b/.smalltalk.All.ston @@ -27,6 +27,8 @@ SmalltalkCISpec { #OutOfMemoryTest, #TraitFileOutTest, #PlatformResolverTest, + #SystemDependenciesTest, + #DAMessageSendAnalyzerTest, #ProcessSpecificTest ] } diff --git a/.smalltalk.Release.ston b/.smalltalk.Release.ston index 24aee56e..30de81e3 100644 --- a/.smalltalk.Release.ston +++ b/.smalltalk.Release.ston @@ -3,6 +3,7 @@ SmalltalkCISpec { #loading : [ SCIMetacelloLoadSpec { #baseline : 'Microdown', + #load : [ 'RichText', 'Tests' ], #onConflict : #useIncoming, #onUpgrade : #useIncoming, #ignoreImage : true, diff --git a/README.md b/README.md index 9c83926c..8d3afcd1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # Microdown Parser and Elements -I'm a parser for microdown implemented by S. Ducasse, L. Dargaud and G. Polito. The implementation is based on the work on markdown of K. Osterbye. -Microdown is a smaller markdown but it is more extensible. - -[![Microdown-Pharo-Integration](https://github.com/pillar-markup/Microdown/actions/workflows/currentAll.yml/badge.svg)](https://github.com/pillar-markup/Microdown/actions/workflows/currentAll.yml) -[![currentDev](https://github.com/pillar-markup/Microdown/actions/workflows/currentDev.yml/badge.svg)](https://github.com/pillar-markup/Microdown/actions/workflows/currentDev.yml) +I'm a parser for microdown implemented by S. Ducasse, L. Dargaud and G. Polito. The implementation is based on the work on markdown of K. Osterbye. Microdown is a smaller markdown but it is more extensible. ## Quick start ### Loading specific version @@ -145,4 +141,3 @@ The other packages in this repository are the extensions made to produce Pillar Such packages should be moved in the future to other location (probably pillar itself). - 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' 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" -