From 0b894ad8a2d6d584a21e097da79af79e9ba06ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Thu, 18 Jan 2024 22:09:17 +0100 Subject: [PATCH] Fixing MicRichTextComposer --- ...estMicrodownRichTextComposerTests.class.st | 8 +- .../MicCenterAlignmentBlockTest.class.st | 10 +- .../MicCodeSemanticActionTest.class.st | 54 ++++--- .../MicDynamicTextStylerTest.class.st | 36 +++-- .../MicMockBaselineOf.class.st | 8 +- ...icParsesAndRendersAllCommentsTest.class.st | 16 +- ...chTextCodeBlockStylerDummyForTest.class.st | 12 +- .../MicRichTextCodeBlockStylerTest.class.st | 18 ++- .../MicRichTextComposerTest.class.st | 149 +++++++++--------- ...icRichTextFormatConfigurationTest.class.st | 40 ++--- .../MicRichTextLinkPresenterTest.class.st | 20 +-- .../MicRightAlignmentBlockTest.class.st | 10 +- .../MicTemplatingTest.class.st | 10 +- .../package.st | 2 +- .../Form.extension.st | 4 +- ...ManifestMicrodownRichTextComposer.class.st | 8 +- .../MicCenterAlignmentBlock.class.st | 12 +- .../MicDocumentHierarchyBuilder.class.st | 37 ++--- .../MicDynamicTextStyler.class.st | 50 +++--- .../MicRichTextBrush.class.st | 22 +-- .../MicRichTextCanvas.class.st | 38 ++--- .../MicRichTextCodeBlockStyler.class.st | 16 +- ...MicRichTextCodeBlockStylerDefault.class.st | 19 ++- ...RichTextCodeBlockStylerFullMethod.class.st | 12 +- ...chTextCodeBlockStylerUnstyledText.class.st | 12 +- .../MicRichTextComposer.class.st | 120 +++++++------- .../MicRichTextDoIt.class.st | 10 +- .../MicRichTextFormatConfiguration.class.st | 16 +- .../MicRichTextIndentBrush.class.st | 10 +- .../MicRichTextLinkPresenter.class.st | 20 +-- .../MicRichTextTable.class.st | 18 ++- .../MicRichTextTableDataSource.class.st | 28 ++-- .../MicRightAlignmentBlock.class.st | 12 +- .../MicScalingTextAnchor.class.st | 20 +-- .../MicSemanticAction.class.st | 30 ++-- .../MicSmalltalkTextStyler.class.st | 18 ++- .../MicTextStyler.class.st | 32 ++-- .../MicrodownParser.extension.st | 4 +- .../MicrodownVisitor.extension.st | 8 +- .../OrderedCollection.extension.st | 4 +- .../Text.extension.st | 4 +- src/Microdown-RichTextComposer/package.st | 2 +- 42 files changed, 524 insertions(+), 455 deletions(-) diff --git a/src/Microdown-RichTextComposer-Tests/ManifestMicrodownRichTextComposerTests.class.st b/src/Microdown-RichTextComposer-Tests/ManifestMicrodownRichTextComposerTests.class.st index 084c955d..d30aef89 100644 --- a/src/Microdown-RichTextComposer-Tests/ManifestMicrodownRichTextComposerTests.class.st +++ b/src/Microdown-RichTextComposer-Tests/ManifestMicrodownRichTextComposerTests.class.st @@ -2,7 +2,9 @@ Some specific microdown rich text integration tests. " Class { - #name : #ManifestMicrodownRichTextComposerTests, - #superclass : #PackageManifest, - #category : #'Microdown-RichTextComposer-Tests-Manifest' + #name : 'ManifestMicrodownRichTextComposerTests', + #superclass : 'PackageManifest', + #category : 'Microdown-RichTextComposer-Tests-Manifest', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Manifest' } diff --git a/src/Microdown-RichTextComposer-Tests/MicCenterAlignmentBlockTest.class.st b/src/Microdown-RichTextComposer-Tests/MicCenterAlignmentBlockTest.class.st index 83de140f..76b363d2 100644 --- a/src/Microdown-RichTextComposer-Tests/MicCenterAlignmentBlockTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicCenterAlignmentBlockTest.class.st @@ -2,12 +2,14 @@ A MicCenterAllignmentBlockTest is a test class for testing the behavior of MicCenterAllignmentBlock " Class { - #name : #MicCenterAlignmentBlockTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-BlockExtensions' + #name : 'MicCenterAlignmentBlockTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-BlockExtensions', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'BlockExtensions' } -{ #category : #tests } +{ #category : 'tests' } MicCenterAlignmentBlockTest >> testCenter [ | src doc center | src := ' diff --git a/src/Microdown-RichTextComposer-Tests/MicCodeSemanticActionTest.class.st b/src/Microdown-RichTextComposer-Tests/MicCodeSemanticActionTest.class.st index 3f36c9e6..a41961f0 100644 --- a/src/Microdown-RichTextComposer-Tests/MicCodeSemanticActionTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicCodeSemanticActionTest.class.st @@ -1,23 +1,25 @@ Class { - #name : #MicCodeSemanticActionTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicCodeSemanticActionTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> semanticActionClass [ ^ MicSemanticAction ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testArrayShouldNotBreak [ self deny: (self semanticActionClass fromTokens: #( 1 #+ 2 #* 3 )) hasEntity. self deny: (self semanticActionClass fromTokens: #( 1 #+ 2 #* )) hasEntity ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testChevronWithBrokenArguments [ self assert: (self semanticActionClass fromTokens: #( Point #>> 2 )) entity isNil. @@ -27,7 +29,7 @@ MicCodeSemanticActionTest >> testChevronWithBrokenArguments [ self assert: (self semanticActionClass fromTokens: #( Point #>> Point )) entity isNil ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testChevronWithBrokenReceiver [ self assert: (self semanticActionClass fromTokens: #( 1 #>> 2 )) entity isNil. @@ -40,19 +42,19 @@ MicCodeSemanticActionTest >> testChevronWithBrokenReceiver [ self assert: (self semanticActionClass fromTokens: #( ClassThatDoesNotExist class #>> 2 )) entity isNil ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testDoubleDollars [ self deny: (self semanticActionClass from: '$$') hasEntity ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testEmptyString [ self deny: (self semanticActionClass from: '') hasEntity ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testGlobalAccess [ self assert: (self semanticActionClass fromTokens: #( Transcript )) hasEntity @@ -60,31 +62,31 @@ MicCodeSemanticActionTest >> testGlobalAccess [ used by the browse invocation when clicking on it. " ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testMoreSpaces [ self deny: (self semanticActionClass from: ' ') hasEntity ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testOneSpace [ self deny: (self semanticActionClass from: ' ') hasEntity ] -{ #category : #'tests - metaclass' } +{ #category : 'tests - metaclass' } MicCodeSemanticActionTest >> testReferenceToABrokenMetaClass [ self assert: (self semanticActionClass from: 'Point2 class') entity isNil ] -{ #category : #'tests - metaclass' } +{ #category : 'tests - metaclass' } MicCodeSemanticActionTest >> testReferenceToABrokenMetaClass2 [ self assert: (self semanticActionClass from: 'Point grgrgr') entity isNil ] -{ #category : #'tests - class' } +{ #category : 'tests - class' } MicCodeSemanticActionTest >> testReferenceToAClass [ self @@ -92,7 +94,7 @@ MicCodeSemanticActionTest >> testReferenceToAClass [ equals: Point ] -{ #category : #'tests - metaclass' } +{ #category : 'tests - metaclass' } MicCodeSemanticActionTest >> testReferenceToAMetaClass [ self @@ -100,7 +102,7 @@ MicCodeSemanticActionTest >> testReferenceToAMetaClass [ equals: Point class ] -{ #category : #'tests - methods' } +{ #category : 'tests - methods' } MicCodeSemanticActionTest >> testReferenceToAMethod [ self @@ -108,31 +110,31 @@ MicCodeSemanticActionTest >> testReferenceToAMethod [ equals: 'Point>>#setX:setY:' ] -{ #category : #'tests - methods' } +{ #category : 'tests - methods' } MicCodeSemanticActionTest >> testReferenceToANonExistingMethod [ self assert: (self semanticActionClass from: 'Point >> 12+3 ') entity isNil ] -{ #category : #'tests - methods' } +{ #category : 'tests - methods' } MicCodeSemanticActionTest >> testReferenceToANonExistingMethodBecauseOfBogusClass [ self assert: (self semanticActionClass from: 'Point222 >> #setX:setY:') entity isNil ] -{ #category : #'tests - methods' } +{ #category : 'tests - methods' } MicCodeSemanticActionTest >> testReferenceToANonExistingMethodBecauseOfNoSymbol [ self assert: (self semanticActionClass from: 'Point >> setX:setY2:') entity isNil ] -{ #category : #'tests - package' } +{ #category : 'tests - package' } MicCodeSemanticActionTest >> testReferenceToANonExistingPackage [ self assert: (self semanticActionClass from: #Pillar) entity isNil ] -{ #category : #'tests - package' } +{ #category : 'tests - package' } MicCodeSemanticActionTest >> testReferenceToAPackage [ self @@ -140,13 +142,13 @@ MicCodeSemanticActionTest >> testReferenceToAPackage [ equals: 'Microdown' ] -{ #category : #'tests - class' } +{ #category : 'tests - class' } MicCodeSemanticActionTest >> testReferenceToNonExistingClass [ self deny: (self semanticActionClass from: 'Point22') hasEntity ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testScannerShouldNotFail [ self deny: (self semanticActionClass from: 'half"baked') hasEntity. @@ -155,7 +157,7 @@ MicCodeSemanticActionTest >> testScannerShouldNotFail [ self deny: (self semanticActionClass from: 16rFFFD asCharacter asString) hasEntity. ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testTwoBogusElements [ self assert: @@ -166,7 +168,7 @@ MicCodeSemanticActionTest >> testTwoBogusElements [ (self semanticActionClass fromTokens: #( Point #foo )) entity isNil ] -{ #category : #'test - bogus entry' } +{ #category : 'test - bogus entry' } MicCodeSemanticActionTest >> testTwoSpaces [ self deny: (self semanticActionClass from: ' ') hasEntity diff --git a/src/Microdown-RichTextComposer-Tests/MicDynamicTextStylerTest.class.st b/src/Microdown-RichTextComposer-Tests/MicDynamicTextStylerTest.class.st index 3e8d2d41..8f274b14 100644 --- a/src/Microdown-RichTextComposer-Tests/MicDynamicTextStylerTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicDynamicTextStylerTest.class.st @@ -2,12 +2,14 @@ A MicDynamicTextStylerTest is a test class for testing the behavior of MicDynamicTextStyler " Class { - #name : #MicDynamicTextStylerTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicDynamicTextStylerTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testBodyFont [ | styler | styler := MicDynamicTextStyler new. @@ -17,7 +19,7 @@ MicDynamicTextStylerTest >> testBodyFont [ self assert: styler bodyFont pointSize equals: 72. ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testBulletForLevel [ | styler | styler := MicDynamicTextStyler new. @@ -27,17 +29,17 @@ MicDynamicTextStylerTest >> testBulletForLevel [ self assert: (styler bulletForLevel: 4) equals: 'a' asText. ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testBullets [ "I am not needed as I am tested by testCounterForAtLevel, but being here marks counters: as tested" ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testCodeBackgroundColor [ ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testCounterForAtLevel [ | styler | styler := MicDynamicTextStyler new. @@ -48,12 +50,12 @@ MicDynamicTextStylerTest >> testCounterForAtLevel [ self assert: (styler counterFor: 5 atLevel: 5) equals: 'e)' asText. ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testCounters [ "I am not needed as I am tested by testCounterForAtLevel, but being here marks counters: as tested" ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testCrAfterHeader [ | styler | styler := MicDynamicTextStyler new. @@ -64,7 +66,7 @@ MicDynamicTextStylerTest >> testCrAfterHeader [ ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testHeaderFontForLevel [ | styler | styler := MicDynamicTextStyler new. @@ -73,7 +75,7 @@ MicDynamicTextStylerTest >> testHeaderFontForLevel [ self assert: (styler headerLevelFont: 1) font pointSize equals: 72. ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongFormat [ | styler | styler := MicDynamicTextStyler new. @@ -82,7 +84,7 @@ MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongFormat [ ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongLevel [ | styler | styler := MicDynamicTextStyler new. @@ -90,7 +92,7 @@ MicDynamicTextStylerTest >> testHeaderFontForLevel_wrongLevel [ self assert: styler errors isNotEmpty ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testInterblockSpacing [ | styler | styler := MicDynamicTextStyler new. @@ -101,7 +103,7 @@ MicDynamicTextStylerTest >> testInterblockSpacing [ self assert: styler interBlockSpacing equals: (String cr, String cr) asText ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testKeepCRFromInput [ | styler textSample| styler := MicDynamicTextStyler new. @@ -112,7 +114,7 @@ MicDynamicTextStylerTest >> testKeepCRFromInput [ ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testMonospaceBackgroundColor [ | styler | styler := MicDynamicTextStyler new. @@ -124,7 +126,7 @@ MicDynamicTextStylerTest >> testMonospaceBackgroundColor [ ] -{ #category : #tests } +{ #category : 'tests' } MicDynamicTextStylerTest >> testNewLineIfNotAlready [ | styler | styler := MicDynamicTextStyler new. diff --git a/src/Microdown-RichTextComposer-Tests/MicMockBaselineOf.class.st b/src/Microdown-RichTextComposer-Tests/MicMockBaselineOf.class.st index 98d634de..91077731 100644 --- a/src/Microdown-RichTextComposer-Tests/MicMockBaselineOf.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicMockBaselineOf.class.st @@ -1,5 +1,7 @@ Class { - #name : #MicMockBaselineOf, - #superclass : #BaselineOf, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicMockBaselineOf', + #superclass : 'BaselineOf', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } diff --git a/src/Microdown-RichTextComposer-Tests/MicParsesAndRendersAllCommentsTest.class.st b/src/Microdown-RichTextComposer-Tests/MicParsesAndRendersAllCommentsTest.class.st index b1a300c9..b389cc07 100644 --- a/src/Microdown-RichTextComposer-Tests/MicParsesAndRendersAllCommentsTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicParsesAndRendersAllCommentsTest.class.st @@ -2,19 +2,21 @@ I test that rendering no class comments make microdown parser or renderer fail " Class { - #name : #MicParsesAndRendersAllCommentsTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicParsesAndRendersAllCommentsTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #tests } +{ #category : 'tests' } MicParsesAndRendersAllCommentsTest >> testCommentFromChunkReadStream [ "Test that we do not break on empty annotated blocks" Microdown asRichText: ChunkReadStream comment. Microdown asRichText: '!!' ] -{ #category : #tests } +{ #category : 'tests' } MicParsesAndRendersAllCommentsTest >> testCommentFromConfigurationCommandLineHandler [ Microdown asRichText: ConfigurationCommandLineHandler comment. "Command line handler for dealing with Metacello configurations from the command line @@ -51,14 +53,14 @@ Examples: " ] -{ #category : #tests } +{ #category : 'tests' } MicParsesAndRendersAllCommentsTest >> testCommentFromFluidBuilder [ "Test that we do not break on empty code blocks" Microdown asRichText: '``` ```' ] -{ #category : #tests } +{ #category : 'tests' } MicParsesAndRendersAllCommentsTest >> testSmokeSignalAndChoke [ | difficultClasses | "this test disables error handling and tries to render all class comments in the system" diff --git a/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerDummyForTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerDummyForTest.class.st index 10288ee1..8ce4e09a 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerDummyForTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerDummyForTest.class.st @@ -1,15 +1,17 @@ Class { - #name : #MicRichTextCodeBlockStylerDummyForTest, - #superclass : #MicRichTextCodeBlockStyler, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicRichTextCodeBlockStylerDummyForTest', + #superclass : 'MicRichTextCodeBlockStyler', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerDummyForTest class >> styleTags [ ^ #(dummyForTest) ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerDummyForTest >> style: sString [ ^ '§dummy§' asText ] diff --git a/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerTest.class.st index dd5ff3d6..0b140fb3 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRichTextCodeBlockStylerTest.class.st @@ -2,17 +2,19 @@ A MicRichTextCodeBlockStylerTest is a test class for testing the behavior of MicRichTextCodeBlockStyler " Class { - #name : #MicRichTextCodeBlockStylerTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicRichTextCodeBlockStylerTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerTest >> stylerFor: aLanguage [ ^ MicRichTextCodeBlockStyler stylerFor: aLanguage ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextCodeBlockStylerTest >> testDefaultStylerIsFound [ | defaultStyler | @@ -20,7 +22,7 @@ MicRichTextCodeBlockStylerTest >> testDefaultStylerIsFound [ self assert: defaultStyler class equals: MicRichTextCodeBlockStylerDefault ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextCodeBlockStylerTest >> testStylerForMethod [ | code richText blueLocation textColor | @@ -41,7 +43,7 @@ styledTextFor: aString asFest'. self assert: textColor color red equals: 0. ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextCodeBlockStylerTest >> testStylerForSmalltalk [ | code richText blueLocation textColor | @@ -60,7 +62,7 @@ green isColored: yellow self assert: textColor color red equals: 0. ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextCodeBlockStylerTest >> testStylersForText [ | defaultStyler | diff --git a/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st index 472b2d6f..7c009f48 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRichTextComposerTest.class.st @@ -1,168 +1,170 @@ Class { - #name : #MicRichTextComposerTest, - #superclass : #TestCase, + #name : 'MicRichTextComposerTest', + #superclass : 'TestCase', #instVars : [ 'sample', 'parser', 'composer', 'offlineStatus' ], - #category : #'Microdown-RichTextComposer-Tests-Composer' + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } MicRichTextComposerTest class >> sampleMicrodownForInputTest [ ^ '# TestHeader body for testing' ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> assertWriting: aPRDocument include: expectedAttribute [ self assert: ((self runsOf: aPRDocument) includes: {expectedAttribute}) ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> boldFormat [ ^ TextEmphasis bold ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> composer [ composer ifNotNil: [ ^ composer ]. ^ composer := self composerClass new ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> composerClass [ ^ MicRichTextComposer ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> externalLink: aLink [ ^ TextAction new actOnClickBlock: [WebBrowser openOn: aLink] ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> figure: aFigureLink [ | url | url := aFigureLink. ^ TextAnchor new anchoredMorph: (ZnEasy getPng: url) ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> headerLevel1 [ ^ self composer textStyler headerLevelFont: 1 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> headerLevel2 [ ^ self composer textStyler headerLevelFont: 2 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> headerLevel3 [ ^ self composer textStyler headerLevelFont: 3 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> headerLevel4 [ ^ self composer textStyler headerLevelFont: 4 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> headerLevel5 [ ^ self composer textStyler headerLevelFont: 5 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> headerLevel6 [ ^ self composer textStyler headerLevelFont: 6 ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> italicFormat [ ^ TextEmphasis italic ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> microElementsFrom: aString [ ^ sample documentFrom: aString. ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> monospaceFormat [ ^ TextBackgroundColor color: Smalltalk ui theme settings windowColor ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> normalFormat [ ^ TextEmphasis normal ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> richTextFor: aDocument [ ^ self composer visit: aDocument ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> richTextForString: aString [ ^ self composer asRichText: aString ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> runsOf: aDocument [ ^ (self richTextFor: aDocument) runs ] -{ #category : #running } +{ #category : 'running' } MicRichTextComposerTest >> setUp [ super setUp. sample := MicMicrodownSnippetFactory new. parser := Microdown new. offlineStatus := Microdown offline. Microdown offline: false. - MicRichTextComposer initialize. + ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> strikethroughtFormat [ ^ TextEmphasis struckOut ] -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextComposerTest >> stringOf: aPRDocument [ ^ (self richTextFor: aPRDocument) string ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> subscriptFormat [ ^ TextColor red ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> superscriptFormat [ ^ TextColor blue ] -{ #category : #running } +{ #category : 'running' } MicRichTextComposerTest >> tearDown [ Microdown offline: offlineStatus. super tearDown. ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testBackslashLast [ | source richText | source := 'I am a text which ends in \'. @@ -170,7 +172,7 @@ MicRichTextComposerTest >> testBackslashLast [ self assert: richText asString trim equals: source ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testBackslashNoBreak [ "This test is related to issue: https://github.com/pillar-markup/Microdown/issues/107" | source richText | @@ -187,13 +189,13 @@ Subclasses may change the definition of names by redefining isCurrentALetter.'. self assert: true "I did not fail" ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> testBoldFormat [ self assertWriting: (self microElementsFrom: sample boldFormatSample) include: self boldFormat ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> testCenter [ | src doc| src := ' @@ -204,7 +206,7 @@ This is centered self assertWriting: doc include: TextAlignment centered ] -{ #category : #'tests - codeBlock' } +{ #category : 'tests - codeBlock' } MicRichTextComposerTest >> testCodeBlock [ | source runs richText | @@ -223,7 +225,7 @@ line 2 line 2' ] -{ #category : #'tests - codeBlock' } +{ #category : 'tests - codeBlock' } MicRichTextComposerTest >> testCodeBlockStylerExplicitLanguage [ | source richText expected | @@ -238,7 +240,7 @@ line 2 self assert: richText asString trim equals: expected ] -{ #category : #'tests - codeBlock' } +{ #category : 'tests - codeBlock' } MicRichTextComposerTest >> testCodeBlockStylerShortHand [ | source richText expected | @@ -253,7 +255,7 @@ line 2 self assert: richText asString trim equals: expected ] -{ #category : #'tests - codeBlock' } +{ #category : 'tests - codeBlock' } MicRichTextComposerTest >> testCodeBlockWithCaption [ | source runs richText | @@ -275,7 +277,7 @@ line 2 an Array(Text(Roger Rabbit))' ] -{ #category : #'tests - codeBlock' } +{ #category : 'tests - codeBlock' } MicRichTextComposerTest >> testCodeBlockWithTabbedCode [ | source richText | @@ -290,7 +292,7 @@ MicRichTextComposerTest >> testCodeBlockWithTabbedCode [ 8' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testEnvironment_unknownShouldNotFail [ | src | src := ' @@ -301,7 +303,7 @@ stuff Microdown asRichText: src ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testExternaLink [ | source richText obj1 | @@ -312,7 +314,7 @@ MicRichTextComposerTest >> testExternaLink [ self assert: obj1 class name equals: #TextAction ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testFigureCaptionMissingRemote [ | source richText| @@ -323,7 +325,7 @@ MicRichTextComposerTest >> testFigureCaptionMissingRemote [ self assert: richText asTextMorph height < 100 "No image embedded" ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testFigureCaptionRemote [ | source richText | @@ -334,7 +336,7 @@ MicRichTextComposerTest >> testFigureCaptionRemote [ self assert: richText asTextMorph height > 100 "It is high because of the embedded image" ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testFigureNoCaptionRemote [ | source richText | @@ -345,7 +347,7 @@ MicRichTextComposerTest >> testFigureNoCaptionRemote [ self assert: richText asTextMorph height > 100 "It is high because of the embedded image" ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> testHeaderLevel1 [ self @@ -353,7 +355,7 @@ MicRichTextComposerTest >> testHeaderLevel1 [ include: self headerLevel1 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> testHeaderLevel2 [ self @@ -361,7 +363,7 @@ MicRichTextComposerTest >> testHeaderLevel2 [ include: self headerLevel2 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> testHeaderLevel3 [ self @@ -369,7 +371,7 @@ MicRichTextComposerTest >> testHeaderLevel3 [ include: self headerLevel3 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> testHeaderLevel4 [ self @@ -377,7 +379,7 @@ MicRichTextComposerTest >> testHeaderLevel4 [ include: self headerLevel4 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> testHeaderLevel5 [ self @@ -385,7 +387,7 @@ MicRichTextComposerTest >> testHeaderLevel5 [ include: self headerLevel5 ] -{ #category : #'tests - header' } +{ #category : 'tests - header' } MicRichTextComposerTest >> testHeaderLevel6 [ self @@ -393,7 +395,7 @@ MicRichTextComposerTest >> testHeaderLevel6 [ include: self headerLevel6 ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testInputfile [ | source result | @@ -403,7 +405,7 @@ MicRichTextComposerTest >> testInputfile [ self assert: (result includesSubstring: 'body for test') ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testItalicFormat [ | source runs richText | @@ -416,7 +418,7 @@ MicRichTextComposerTest >> testItalicFormat [ self deny: ((runs at: 6 "the h in have") includes: self italicFormat ). ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testLatexMathStyleEmpty [ | source richText | @@ -425,7 +427,7 @@ MicRichTextComposerTest >> testLatexMathStyleEmpty [ self assert: richText asString trim equals: 'foobar' . ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testListAreCorrectlyNumbered [ | source richText | @@ -441,7 +443,7 @@ MicRichTextComposerTest >> testListAreCorrectlyNumbered [ ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testMathEnvironmentError [ | source richText | source := 'foo @@ -455,7 +457,7 @@ $$ $$ - LATEX ERROR - $$' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testNestedList [ "I just need to be here and succeed to override an existing test which is obsolete" | silly | @@ -463,7 +465,7 @@ MicRichTextComposerTest >> testNestedList [ self assert: silly equals: silly ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testNestedMixedList [ | source richText runs | @@ -483,7 +485,7 @@ MicRichTextComposerTest >> testNestedMixedList [ ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testNestedMixedListNoEmptyLinesEfterSubLists [ | source output | @@ -500,7 +502,7 @@ MicRichTextComposerTest >> testNestedMixedListNoEmptyLinesEfterSubLists [ ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testNestedUnorderdList [ | source richText | @@ -518,7 +520,7 @@ MicRichTextComposerTest >> testNestedUnorderdList [ ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testNewDictionaryAPI [ | dict | @@ -526,7 +528,7 @@ MicRichTextComposerTest >> testNewDictionaryAPI [ self assert: (dict at: #a) equals: 1 ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testNoNSuperfluousNewLines [ | source richText expected | @@ -540,7 +542,7 @@ And this is just an other paragraph'. self assert: richText asString equals: expected ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testNosuperfluousNewLines [ | source richText expected | @@ -550,7 +552,7 @@ MicRichTextComposerTest >> testNosuperfluousNewLines [ self assert: richText asString equals: expected ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testOrderedList [ | source richText runs | @@ -568,7 +570,7 @@ MicRichTextComposerTest >> testOrderedList [ ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testOrderedNestedList [ | source richText | source := ' @@ -582,7 +584,7 @@ MicRichTextComposerTest >> testOrderedNestedList [ ] -{ #category : #'tests - paragraph' } +{ #category : 'tests - paragraph' } MicRichTextComposerTest >> testParagraphNotFormat [ | runs richText | @@ -594,7 +596,7 @@ barwith a space'). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testQuoteBlock [ | src richText | "Quote blocks have not been implemented" @@ -604,14 +606,14 @@ MicRichTextComposerTest >> testQuoteBlock [ self deny: (richText asString findString: 'foo') equals: 0 ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testRaw [ | text | text := Microdown asRichText: '{{**not bold**}}'. self assert: text asString trim equals: '**not bold**'. ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testRawNewLinesPreserved [ | text | text := Microdown asRichText: '{{**not @@ -620,7 +622,7 @@ bold**}}'. bold**'. ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> testRightAlignment [ | src doc| src := ' @@ -631,7 +633,7 @@ This is righted self assertWriting: doc include: TextAlignment rightFlush ] -{ #category : #'skipped tests' } +{ #category : 'skipped tests' } MicRichTextComposerTest >> testStrikethroughFormat [ | source runs richText | source := 'This have been ~deleted~'. @@ -643,11 +645,10 @@ MicRichTextComposerTest >> testStrikethroughFormat [ self deny: ((runs at: 6 "the h in have") includes: self strikethroughtFormat ). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextComposerTest >> testStylerForMethod [ | code source richText blueLocation textColor | - self composerClass initialize. code := ' codeStylerFor: aString @@ -669,7 +670,7 @@ styledTextFor: aString asFest'. self assert: textColor color red equals: 0. ] -{ #category : #'tests - list' } +{ #category : 'tests - list' } MicRichTextComposerTest >> testUnorderedList [ | source richText runs | @@ -685,7 +686,7 @@ MicRichTextComposerTest >> testUnorderedList [ self assert: (runs at: 29) first amount equals: 2. ] -{ #category : #'tests - format' } +{ #category : 'tests - format' } MicRichTextComposerTest >> underlineFormat [ ^ TextEmphasis underlined ] diff --git a/src/Microdown-RichTextComposer-Tests/MicRichTextFormatConfigurationTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRichTextFormatConfigurationTest.class.st index 8daace63..eb63d587 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRichTextFormatConfigurationTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRichTextFormatConfigurationTest.class.st @@ -2,17 +2,19 @@ A MicRichTextFormatConfigurationTest is a test class for testing the behavior of MicRichTextFormatConfiguration " Class { - #name : #MicRichTextFormatConfigurationTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicRichTextFormatConfigurationTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #helpers } +{ #category : 'helpers' } MicRichTextFormatConfigurationTest >> fontString [ ^ TextStyle defaultFont familyName,';72' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testBodyFont [ | richText | richText := Microdown asRichText: ' @@ -24,7 +26,7 @@ foo bar' copyReplaceAll: '$font$' with: self fontString). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testBullets [ | src richText | src := '{!richtext|bullets=◊»!} @@ -35,7 +37,7 @@ MicRichTextFormatConfigurationTest >> testBullets [ self assert: (richText asString includesSubstring: '» bbb') ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testChangingSameStyler [ | src richText | "Test that the same styler is changed" @@ -55,7 +57,7 @@ Header 2 last line' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testCounters [ | src richText | src := '{!richtext|counters=A1!} @@ -66,7 +68,7 @@ MicRichTextFormatConfigurationTest >> testCounters [ self assert: (richText asString includesSubstring: '1. bbb') ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testHeader1 [ | src richText | src := '{!richtext|headerFont1=$font$!} @@ -76,7 +78,7 @@ MicRichTextFormatConfigurationTest >> testHeader1 [ self assert: (richText asMorph height > 100). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testHeader2 [ | src richText | src := '{!richtext|headerFont2=$font$!} @@ -86,7 +88,7 @@ MicRichTextFormatConfigurationTest >> testHeader2 [ self assert: (richText asMorph height > 100). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testHeader3 [ | src richText | src := '{!richtext|headerFont3=$font$!} @@ -96,7 +98,7 @@ MicRichTextFormatConfigurationTest >> testHeader3 [ self assert: (richText asMorph height > 100). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testHeader4 [ | src richText | src := '{!richtext|headerFont4=$font$!} @@ -106,7 +108,7 @@ MicRichTextFormatConfigurationTest >> testHeader4 [ self assert: (richText asMorph height > 100). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testHeader5 [ | src richText | src := '{!richtext|headerFont5=$font$!} @@ -116,7 +118,7 @@ MicRichTextFormatConfigurationTest >> testHeader5 [ self assert: (richText asMorph height > 100). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testHeader6 [ | src richText | src := '{!richtext|headerFont6=$font$!} @@ -126,7 +128,7 @@ MicRichTextFormatConfigurationTest >> testHeader6 [ self assert: (richText asMorph height > 100). ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testIllegalArgument [ | src richText | src := '{!richtext|foo=bar!}'. @@ -134,7 +136,7 @@ MicRichTextFormatConfigurationTest >> testIllegalArgument [ self assert: richText asString equals: 'richtext annotation - unknown argument: foo' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testInterBlockSpacing [ | src richText | src := '{!richtext|interBlockSpacing=0!}fooo @@ -146,7 +148,7 @@ boo'. self assert: (richText asString lines size) equals: 3 ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testInterBlockSpacing_three [ | src richText | src := '{!richtext|interBlockSpacing=3!}fooo @@ -158,7 +160,7 @@ boo'. self assert: (richText asString lines size) equals: 7 ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testNewLineIfNotAlready [ | src richText | "newLineIfNotAlready mostely makes sense if interBlockSpacing is 0" @@ -172,7 +174,7 @@ bar'. bar' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextFormatConfigurationTest >> testSpaceAfterHeader [ | src richText | src := '{!richtext|crAfterHeader=2;2;1;1!} diff --git a/src/Microdown-RichTextComposer-Tests/MicRichTextLinkPresenterTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRichTextLinkPresenterTest.class.st index a4fedbb9..1938fb87 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRichTextLinkPresenterTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRichTextLinkPresenterTest.class.st @@ -2,21 +2,23 @@ A MicRichTextLinkPresenterTest is a test class for testing the behavior of MicRichTextLinkPresenter " Class { - #name : #MicRichTextLinkPresenterTest, - #superclass : #TestCase, + #name : 'MicRichTextLinkPresenterTest', + #superclass : 'TestCase', #instVars : [ 'linkPresenter' ], - #category : #'Microdown-RichTextComposer-Tests-Composer' + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #running } +{ #category : 'running' } MicRichTextLinkPresenterTest >> setUp [ super setUp. linkPresenter := MicRichTextLinkPresenter new. ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextLinkPresenterTest >> testGuessKindOf [ "Testing default" | ref file | @@ -26,7 +28,7 @@ MicRichTextLinkPresenterTest >> testGuessKindOf [ self assert: (linkPresenter guessKindOf: ref) equals: 'md' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextLinkPresenterTest >> testGuessKindOf_html [ "Testing default" | ref file | @@ -36,7 +38,7 @@ MicRichTextLinkPresenterTest >> testGuessKindOf_html [ self assert: (linkPresenter guessKindOf: ref) equals: 'html' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextLinkPresenterTest >> testGuessKindOf_html_with_comment [ "Testing default" | ref file | @@ -48,7 +50,7 @@ MicRichTextLinkPresenterTest >> testGuessKindOf_html_with_comment [ self assert: (linkPresenter guessKindOf: ref) equals: 'html' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextLinkPresenterTest >> testGuessKindOf_withExtension [ "Testing default" | ref file | @@ -57,7 +59,7 @@ MicRichTextLinkPresenterTest >> testGuessKindOf_withExtension [ self assert: (linkPresenter guessKindOf: ref) equals: 'foo' ] -{ #category : #tests } +{ #category : 'tests' } MicRichTextLinkPresenterTest >> testPragmaForKind [ "Testing default" diff --git a/src/Microdown-RichTextComposer-Tests/MicRightAlignmentBlockTest.class.st b/src/Microdown-RichTextComposer-Tests/MicRightAlignmentBlockTest.class.st index cc591aab..3fdb680a 100644 --- a/src/Microdown-RichTextComposer-Tests/MicRightAlignmentBlockTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicRightAlignmentBlockTest.class.st @@ -2,12 +2,14 @@ A MicRightAllignmentBlockTest is a test class for testing the behavior of MicRightAllignmentBlock " Class { - #name : #MicRightAlignmentBlockTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-BlockExtensions' + #name : 'MicRightAlignmentBlockTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-BlockExtensions', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'BlockExtensions' } -{ #category : #tests } +{ #category : 'tests' } MicRightAlignmentBlockTest >> testRightAlignment [ | src doc center | src := ' diff --git a/src/Microdown-RichTextComposer-Tests/MicTemplatingTest.class.st b/src/Microdown-RichTextComposer-Tests/MicTemplatingTest.class.st index 0128685d..e5e650b4 100644 --- a/src/Microdown-RichTextComposer-Tests/MicTemplatingTest.class.st +++ b/src/Microdown-RichTextComposer-Tests/MicTemplatingTest.class.st @@ -1,10 +1,12 @@ Class { - #name : #MicTemplatingTest, - #superclass : #TestCase, - #category : #'Microdown-RichTextComposer-Tests-Composer' + #name : 'MicTemplatingTest', + #superclass : 'TestCase', + #category : 'Microdown-RichTextComposer-Tests-Composer', + #package : 'Microdown-RichTextComposer-Tests', + #tag : 'Composer' } -{ #category : #tests } +{ #category : 'tests' } MicTemplatingTest >> testBaselineWithoutBaselineMethodShouldNotBreak [ diff --git a/src/Microdown-RichTextComposer-Tests/package.st b/src/Microdown-RichTextComposer-Tests/package.st index 15cd0f58..26637086 100644 --- a/src/Microdown-RichTextComposer-Tests/package.st +++ b/src/Microdown-RichTextComposer-Tests/package.st @@ -1 +1 @@ -Package { #name : #'Microdown-RichTextComposer-Tests' } +Package { #name : 'Microdown-RichTextComposer-Tests' } diff --git a/src/Microdown-RichTextComposer/Form.extension.st b/src/Microdown-RichTextComposer/Form.extension.st index d6807c73..d7fbbdbb 100644 --- a/src/Microdown-RichTextComposer/Form.extension.st +++ b/src/Microdown-RichTextComposer/Form.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Form } +Extension { #name : 'Form' } -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } Form >> asText [ "I return a text with myself embedded - Similar to Morph>>asText" ^ (String value: 1) asText addAttribute: (TextAnchor new anchoredMorph: self) diff --git a/src/Microdown-RichTextComposer/ManifestMicrodownRichTextComposer.class.st b/src/Microdown-RichTextComposer/ManifestMicrodownRichTextComposer.class.st index 8c604588..246c21cf 100644 --- a/src/Microdown-RichTextComposer/ManifestMicrodownRichTextComposer.class.st +++ b/src/Microdown-RichTextComposer/ManifestMicrodownRichTextComposer.class.st @@ -4,7 +4,9 @@ I am used to render class and package comments based on Microdown markup. The key class is `MicRichTextComposer` " Class { - #name : #ManifestMicrodownRichTextComposer, - #superclass : #PackageManifest, - #category : #'Microdown-RichTextComposer-Manifest' + #name : 'ManifestMicrodownRichTextComposer', + #superclass : 'PackageManifest', + #category : 'Microdown-RichTextComposer-Manifest', + #package : 'Microdown-RichTextComposer', + #tag : 'Manifest' } diff --git a/src/Microdown-RichTextComposer/MicCenterAlignmentBlock.class.st b/src/Microdown-RichTextComposer/MicCenterAlignmentBlock.class.st index 209d622c..207076bf 100644 --- a/src/Microdown-RichTextComposer/MicCenterAlignmentBlock.class.st +++ b/src/Microdown-RichTextComposer/MicCenterAlignmentBlock.class.st @@ -4,17 +4,19 @@ I implement a centering environment which can be rendered using RichText. !> " Class { - #name : #MicCenterAlignmentBlock, - #superclass : #MicEnvironmentBlock, - #category : #'Microdown-RichTextComposer-BlockExtensions' + #name : 'MicCenterAlignmentBlock', + #superclass : 'MicEnvironmentBlock', + #category : 'Microdown-RichTextComposer-BlockExtensions', + #package : 'Microdown-RichTextComposer', + #tag : 'BlockExtensions' } -{ #category : #accessing } +{ #category : 'accessing' } MicCenterAlignmentBlock class >> tag [ ^ #center ] -{ #category : #visiting } +{ #category : 'visiting' } MicCenterAlignmentBlock >> accept: aVisitor [ ^ aVisitor visitCenter: self ] diff --git a/src/Microdown-RichTextComposer/MicDocumentHierarchyBuilder.class.st b/src/Microdown-RichTextComposer/MicDocumentHierarchyBuilder.class.st index 4e70f426..47c613c8 100644 --- a/src/Microdown-RichTextComposer/MicDocumentHierarchyBuilder.class.st +++ b/src/Microdown-RichTextComposer/MicDocumentHierarchyBuilder.class.st @@ -16,8 +16,8 @@ SpDocumentHierarchyBuilder new ``` " Class { - #name : #MicDocumentHierarchyBuilder, - #superclass : #Object, + #name : 'MicDocumentHierarchyBuilder', + #superclass : 'Object', #instVars : [ 'topClass', 'flattenTree', @@ -26,10 +26,11 @@ Class { 'class', 'fromClass' ], - #category : #'Microdown-RichTextComposer' + #category : 'Microdown-RichTextComposer', + #package : 'Microdown-RichTextComposer' } -{ #category : #private } +{ #category : 'private' } MicDocumentHierarchyBuilder >> addLevel: level from: aClass [ "'├ ─ ╰ │'" | path | @@ -61,7 +62,7 @@ MicDocumentHierarchyBuilder >> addLevel: level from: aClass [ from: each ] ] -{ #category : #private } +{ #category : 'private' } MicDocumentHierarchyBuilder >> addLevel: level from: aClass to: stream [ "'├ ─ ╰ │'" | path | @@ -90,14 +91,14 @@ MicDocumentHierarchyBuilder >> addLevel: level from: aClass to: stream [ to: stream ] ] -{ #category : #private } +{ #category : 'private' } MicDocumentHierarchyBuilder >> applyFilterTo: aCollection [ filterBlock ifNil: [ ^ aCollection ]. ^ aCollection select: filterBlock ] -{ #category : #building } +{ #category : 'building' } MicDocumentHierarchyBuilder >> buildFor: aClass [ self fillTreeOf: aClass. @@ -106,7 +107,7 @@ MicDocumentHierarchyBuilder >> buildFor: aClass [ from: self fromClass ] -{ #category : #building } +{ #category : 'building' } MicDocumentHierarchyBuilder >> buildStringFor: aClass [ self fillTreeOf: aClass. @@ -117,13 +118,13 @@ MicDocumentHierarchyBuilder >> buildStringFor: aClass [ to: (ZnNewLineWriterStream on: stream) ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicDocumentHierarchyBuilder >> builder: aBuilder [ builder := aBuilder ] -{ #category : #private } +{ #category : 'private' } MicDocumentHierarchyBuilder >> fillTreeOf: aClass [ class := aClass. @@ -134,7 +135,7 @@ MicDocumentHierarchyBuilder >> fillTreeOf: aClass [ ^ flattenTree ] -{ #category : #private } +{ #category : 'private' } MicDocumentHierarchyBuilder >> fillTreeWithSubclassesOf: aClass [ flattenTree at: aClass put: (self applyFilterTo: aClass subclasses). @@ -142,7 +143,7 @@ MicDocumentHierarchyBuilder >> fillTreeWithSubclassesOf: aClass [ self fillTreeWithSubclassesOf: each ] ] -{ #category : #private } +{ #category : 'private' } MicDocumentHierarchyBuilder >> fillTreeWithSuperclassesOf: aClass [ | superclasses | @@ -156,25 +157,25 @@ MicDocumentHierarchyBuilder >> fillTreeWithSuperclassesOf: aClass [ ] -{ #category : #accessing } +{ #category : 'accessing' } MicDocumentHierarchyBuilder >> filter: aBlock [ filterBlock := aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } MicDocumentHierarchyBuilder >> fromClass [ ^ fromClass ifNil: [ SpAbstractPresenter ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicDocumentHierarchyBuilder >> fromClass: aClass [ fromClass := aClass ] -{ #category : #testing } +{ #category : 'testing' } MicDocumentHierarchyBuilder >> isPassingThrough: aClass topLevel: aTopClass [ | superclasses | @@ -185,13 +186,13 @@ MicDocumentHierarchyBuilder >> isPassingThrough: aClass topLevel: aTopClass [ ^ false ] -{ #category : #accessing } +{ #category : 'accessing' } MicDocumentHierarchyBuilder >> topClass [ ^ topClass ifNil: [ self fromClass superclass ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicDocumentHierarchyBuilder >> topClass: aClass [ topClass := aClass diff --git a/src/Microdown-RichTextComposer/MicDynamicTextStyler.class.st b/src/Microdown-RichTextComposer/MicDynamicTextStyler.class.st index d147b788..1c0b7682 100644 --- a/src/Microdown-RichTextComposer/MicDynamicTextStyler.class.st +++ b/src/Microdown-RichTextComposer/MicDynamicTextStyler.class.st @@ -39,8 +39,8 @@ and very small body - back to first " Class { - #name : #MicDynamicTextStyler, - #superclass : #MicTextStyler, + #name : 'MicDynamicTextStyler', + #superclass : 'MicTextStyler', #instVars : [ 'bullets', 'counters', @@ -52,20 +52,22 @@ Class { 'keepCRFromInput', 'errors' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> addError: error [ errors add: error ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> bodyFont [ ^ bodyFont ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> bodyFont: fontSpec [ |list| list := (fontSpec splitOn: $;). @@ -76,19 +78,19 @@ MicDynamicTextStyler >> bodyFont: fontSpec [ pointSize: list second asNumber ] -{ #category : #initialization } +{ #category : 'initialization' } MicDynamicTextStyler >> bulletForLevel: level [ "outer level is 1, second level is 2, " ^ ( bullets at: ( (level - 1) % bullets size ) +1 ) asText. ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> bullets: anObject [ bullets := anObject ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> counterFor: counter atLevel: level [ | kind | "outer level is 1, second level is 2, " @@ -101,13 +103,13 @@ MicDynamicTextStyler >> counterFor: counter atLevel: level [ ifTrue: [ ^ ($A asInteger + (counter - 1)) asCharacter asText , ')' ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> counters: counterTypes [ "counter types are 1 (number), a (small letters), A (capital letters)" counters := counterTypes ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> crAfterHeader: spacingSpec [ "spacingSpec is a series of numbers 2;2;1;1 - which is the number of new lines to be added after headers of level1, level2 etc. 1's at the end can be omitted (2;2;1;1 is the same as 2;2)" @@ -117,22 +119,22 @@ MicDynamicTextStyler >> crAfterHeader: spacingSpec [ spacings doWithIndex: [ :elem :index |crAfterHeader at: index put: elem ] ] -{ #category : #initialization } +{ #category : 'initialization' } MicDynamicTextStyler >> crAfterHeaderLevel: level [ ^ String cr repeat: (crAfterHeader at: level) ] -{ #category : #initialization } +{ #category : 'initialization' } MicDynamicTextStyler >> crAfterHeaders [ ^ crAfterHeader ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> errors [ ^ errors ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> headerFont: fontString forLevel: level [ |list font| (level between: 1 and: 6) @@ -148,7 +150,7 @@ MicDynamicTextStyler >> headerFont: fontString forLevel: level [ put: (TextFontReference toFont:font) ] -{ #category : #initialization } +{ #category : 'initialization' } MicDynamicTextStyler >> initialize [ self computeHeaderFonts. "super rely on lazy initilization" errors := OrderedCollection new. @@ -162,40 +164,40 @@ MicDynamicTextStyler >> initialize [ keepCRFromInput := true. ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> interBlockSpacing [ ^ interBlockSpacing ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> interBlockSpacing: spacingSpec [ "I can put a number of cr between blocks. " interBlockSpacing := ((String cr) repeat: (spacingSpec asNumber)) asText ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> keepCRFromInput: aBooleanText [ "if aBooleanText is 'false', set keepCRFromInput to false. This will merge lines in text blocks to a single line" keepCRFromInput := aBooleanText ~= 'false' ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> monospaceBackgroundColor [ ^ monospaceBackgroundColor ] -{ #category : #accessing } +{ #category : 'accessing' } MicDynamicTextStyler >> monospaceBackgroundColor: colorString [ monospaceBackgroundColor := Color fromString: colorString ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> newLineIfNotAlready [ ^ newLineIfNotAlready ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> newLineIfNotAlready: spacingSpec [ "add extra newline or tab indentation of the following line" "spacingSpec is (cr|tab|space)* with ; as seperator - for example 'cr;tab'" @@ -210,7 +212,7 @@ MicDynamicTextStyler >> newLineIfNotAlready: spacingSpec [ newLineIfNotAlready := spacing asText ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicDynamicTextStyler >> postTextTreatment: aText [ "my primary purpose is to replace newLines with space in some styles" keepCRFromInput ifTrue: [ ^ aText ]. diff --git a/src/Microdown-RichTextComposer/MicRichTextBrush.class.st b/src/Microdown-RichTextComposer/MicRichTextBrush.class.st index a34a4d09..b09562a0 100644 --- a/src/Microdown-RichTextComposer/MicRichTextBrush.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextBrush.class.st @@ -4,49 +4,51 @@ I am a brush in the canvas-brush pattern. I represent one kind of `TextAttribute` to be added to a `Text`. " Class { - #name : #MicRichTextBrush, - #superclass : #Object, + #name : 'MicRichTextBrush', + #superclass : 'Object', #instVars : [ 'canvas', 'attribute' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicRichTextBrush class >> on: canvas [ ^self new canvas: canvas ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicRichTextBrush class >> on: canvas attribute: attr [ ^self new canvas: canvas; attribute: attr ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextBrush >> attribute [ ^ attribute ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextBrush >> attribute: anObject [ attribute := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextBrush >> canvas [ ^ canvas ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextBrush >> canvas: anObject [ canvas := anObject ] -{ #category : #paint } +{ #category : 'paint' } MicRichTextBrush >> paint: aText [ aText addAttribute: attribute ] diff --git a/src/Microdown-RichTextComposer/MicRichTextCanvas.class.st b/src/Microdown-RichTextComposer/MicRichTextCanvas.class.st index f7dc3195..3a855b27 100644 --- a/src/Microdown-RichTextComposer/MicRichTextCanvas.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextCanvas.class.st @@ -4,8 +4,8 @@ As texts can have multiple annotations, I have a stack of brushes to paint a tex My only method for adding text to my stream is `<<`. " Class { - #name : #MicRichTextCanvas, - #superclass : #Object, + #name : 'MicRichTextCanvas', + #superclass : 'Object', #instVars : [ 'out', 'brushes', @@ -13,10 +13,12 @@ Class { 'crAtEnd', 'textStyler' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> << aText [ |text| aText ifEmpty: [ ^ self ]. @@ -30,30 +32,30 @@ MicRichTextCanvas >> << aText [ text ifNotEmpty: [crAtEnd := text last = Character cr]. ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> contents [ ^ out contents ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> cr [ self newLine ] -{ #category : #testing } +{ #category : 'testing' } MicRichTextCanvas >> hasFontDefinitions: aText [ "Answer the fontfor characters in the run beginning at characterIndex." ^ (aText runs flattened asSet select: [ :attr | attr isKindOf: TextFontReference ]) isNotEmpty. ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> includeAttribute: attr in: aBlock [ brushes addLast: (MicRichTextBrush on: self attribute: attr). aBlock value. brushes removeLast ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> includeBrush: aBrush in: aBlock [ "Add for the course of aBlock, a brush (aBrush) to the currently used brushes." brushes addLast: aBrush. @@ -61,7 +63,7 @@ MicRichTextCanvas >> includeBrush: aBrush in: aBlock [ brushes removeLast ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> indentIn: aBlock [ nesting := nesting + 1. aBlock value. @@ -70,7 +72,7 @@ MicRichTextCanvas >> indentIn: aBlock [ ] -{ #category : #initialization } +{ #category : 'initialization' } MicRichTextCanvas >> initialize [ super initialize. out := WriteStream on: '' asText. @@ -79,41 +81,41 @@ MicRichTextCanvas >> initialize [ crAtEnd := true. "Prevent newlines in beginning" ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCanvas >> nesting [ ^ nesting ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> newLine [ self newLineBody. crAtEnd := true ] -{ #category : #private } +{ #category : 'private' } MicRichTextCanvas >> newLineBody [ self << self textStyler newLineBody ] -{ #category : #public } +{ #category : 'public' } MicRichTextCanvas >> newLineIfNotAlready [ crAtEnd ifFalse: [ self << self textStyler newLineIfNotAlready ]. crAtEnd := true ] -{ #category : #private } +{ #category : 'private' } MicRichTextCanvas >> tab [ self << String tab asText ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCanvas >> textStyler [ ^ textStyler ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCanvas >> textStyler: anObject [ textStyler := anObject diff --git a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStyler.class.st b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStyler.class.st index da95ae17..bdee9b4a 100644 --- a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStyler.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStyler.class.st @@ -11,12 +11,14 @@ I will find a subclass matching `languageTag`. My subclasses identify tags it they will handle. " Class { - #name : #MicRichTextCodeBlockStyler, - #superclass : #Object, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextCodeBlockStyler', + #superclass : 'Object', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #documentation } +{ #category : 'documentation' } MicRichTextCodeBlockStyler class >> buildMicroDownUsing: aBuilder withComment: aComment [ super buildMicroDownUsing: aBuilder withComment: aComment. "Only add this list here, not in my subclasses" @@ -31,12 +33,12 @@ MicRichTextCodeBlockStyler class >> buildMicroDownUsing: aBuilder withComment: ]] ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStyler class >> styleTags [ ^ #() ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStyler class >> stylerFor: languageName [ ^ (self allSubclasses detect: [ :cl | (cl styleTags collect: #asLowercase) includes: languageName asLowercase ] @@ -44,7 +46,7 @@ MicRichTextCodeBlockStyler class >> stylerFor: languageName [ ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStyler >> style: sourceString [ ^ self subclassResponsibility ] diff --git a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerDefault.class.st b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerDefault.class.st index 41859658..a52743f9 100644 --- a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerDefault.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerDefault.class.st @@ -2,20 +2,23 @@ I am a class for formating codeblocks containing smalltalk code fragments " Class { - #name : #MicRichTextCodeBlockStylerDefault, - #superclass : #MicRichTextCodeBlockStyler, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextCodeBlockStylerDefault', + #superclass : 'MicRichTextCodeBlockStyler', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerDefault class >> styleTags [ ^ #(default pharo smalltalk) ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerDefault >> style: sourceString [ "I style a set of smalltalk expressions" - ^ MicSmalltalkTextStyler new - isForWorkspace: true; - styledTextFor: sourceString asText + + ^ MicSmalltalkTextStyler new + isScripting: true; + styledTextFor: sourceString asText ] diff --git a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerFullMethod.class.st b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerFullMethod.class.st index e2d070dc..28686a74 100644 --- a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerFullMethod.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerFullMethod.class.st @@ -2,17 +2,19 @@ I am a class for formating codeblocks containing smalltalk methods " Class { - #name : #MicRichTextCodeBlockStylerFullMethod, - #superclass : #MicRichTextCodeBlockStyler, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextCodeBlockStylerFullMethod', + #superclass : 'MicRichTextCodeBlockStyler', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerFullMethod class >> styleTags [ ^ #(method) ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerFullMethod >> style: sourceString [ | source styler ast | diff --git a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerUnstyledText.class.st b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerUnstyledText.class.st index d46131a4..be2fdc89 100644 --- a/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerUnstyledText.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextCodeBlockStylerUnstyledText.class.st @@ -2,17 +2,19 @@ I am a class for formating codeblocks containing plain text " Class { - #name : #MicRichTextCodeBlockStylerUnstyledText, - #superclass : #MicRichTextCodeBlockStyler, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextCodeBlockStylerUnstyledText', + #superclass : 'MicRichTextCodeBlockStyler', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerUnstyledText class >> styleTags [ ^ #(text) ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextCodeBlockStylerUnstyledText >> style: aString [ ^ aString asText diff --git a/src/Microdown-RichTextComposer/MicRichTextComposer.class.st b/src/Microdown-RichTextComposer/MicRichTextComposer.class.st index df79c5fa..0c9b987a 100644 --- a/src/Microdown-RichTextComposer/MicRichTextComposer.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextComposer.class.st @@ -71,24 +71,26 @@ Monospaced text (e.g., `Point`, `Point class`, `Point>>#setX:setY:`, or `#'Pill " Class { - #name : #MicRichTextComposer, - #superclass : #MicrodownVisitor, + #name : 'MicRichTextComposer', + #superclass : 'MicrodownVisitor', #instVars : [ 'canvas', 'textStyler', 'codeStylerClass' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #public } +{ #category : 'public' } MicRichTextComposer class >> asRichText: aStringOrDoc [ ^ self new asRichText: aStringOrDoc ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown1 [ ^ self asRichText: '### Emphasis and lists @@ -108,7 +110,7 @@ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 1. For the moment numbered lists always start with 1, and count upwards' ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown2 [ ^ self asRichText: @@ -140,7 +142,7 @@ textStyler: aString ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown3 [ ^ self asRichText: @@ -156,7 +158,7 @@ Here are direct links to classes and method And this is another line' ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown4 [ ^ self asRichText: @@ -173,7 +175,7 @@ Images can be used as anchors: ' ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown5 [ ^ self asRichText: @@ -187,7 +189,7 @@ MicRichTextComposer class >> exampleMicrodown5 [ ' ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown6 [ ^ self asRichText: @@ -202,7 +204,7 @@ Cool eh? ' ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown7 [ @@ -211,7 +213,7 @@ MicRichTextComposer class >> exampleMicrodown7 [ It is possible to use the icons in the image: ![Object class](pharo:///Object/iconNamed:/info)' ] -{ #category : #examples } +{ #category : 'examples' } MicRichTextComposer class >> exampleMicrodown8 [ ^ self asRichText: @@ -222,7 +224,7 @@ this is just _first_ line and this is the second line' ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> anchorFor: anImageOrMorph of: aNode [ aNode arguments at: #width ifPresent: [ :width | @@ -244,7 +246,7 @@ MicRichTextComposer >> anchorFor: anImageOrMorph of: aNode [ ^ TextAnchor new anchoredMorph: anImageOrMorph ] -{ #category : #public } +{ #category : 'public' } MicRichTextComposer >> asRichText: aStringOrDoc [ @@ -253,13 +255,13 @@ MicRichTextComposer >> asRichText: aStringOrDoc [ ifFalse: [ aStringOrDoc ]) ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextComposer >> codeStylerClass [ ^ codeStylerClass ] -{ #category : #private } +{ #category : 'private' } MicRichTextComposer >> doVisitCode: aCodeBlock [ self @@ -267,7 +269,7 @@ MicRichTextComposer >> doVisitCode: aCodeBlock [ code: aCodeBlock body ] -{ #category : #private } +{ #category : 'private' } MicRichTextComposer >> doVisitCode: aCodeBlock code: aStringOrText [ canvas indentIn: [ @@ -285,14 +287,14 @@ MicRichTextComposer >> doVisitCode: aCodeBlock code: aStringOrText [ canvas << textStyler interBlockSpacing ] -{ #category : #initialization } +{ #category : 'initialization' } MicRichTextComposer >> initialize [ super initialize. codeStylerClass := MicRichTextCodeBlockStyler. self textStyler: MicTextStyler new. ] -{ #category : #private } +{ #category : 'private' } MicRichTextComposer >> latexFor: aString onError: aBlock [ "Return a Text containing an image with the latex formula. @@ -310,13 +312,13 @@ MicRichTextComposer >> latexFor: aString onError: aBlock [ do: [^ aBlock value] ] -{ #category : #private } +{ #category : 'private' } MicRichTextComposer >> level [ "level is the logical indention level of lists. Outer list is indented 1, next is indented 3, etc." ^(canvas nesting // 2) +1 ] -{ #category : #private } +{ #category : 'private' } MicRichTextComposer >> renderTableCell: aCell [ "a cell is an array of nodes. Each element should be rendered and concatenated" ^ aCell inject: Text new into: [ :txt :part | @@ -324,20 +326,20 @@ MicRichTextComposer >> renderTableCell: aCell [ ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextComposer >> textStyler [ ^ textStyler ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextComposer >> textStyler: aTextStyler [ textStyler := aTextStyler. canvas ifNotNil: [ canvas textStyler: aTextStyler ] ] -{ #category : #private } +{ #category : 'private' } MicRichTextComposer >> textWithImage: anImage usingAnchor: anchor [ "return a text with an image embedded" | text | @@ -350,19 +352,19 @@ MicRichTextComposer >> textWithImage: anImage usingAnchor: anchor [ ^ ' ' asText , text, ' ' asText ] -{ #category : #initialization } +{ #category : 'initialization' } MicRichTextComposer >> theme [ ^ Smalltalk ui theme ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextComposer >> todo [ ^ 'there is too much hspace after a section when it is followed by a paragraph. This also because people will not want to to not let a newline between the header and paragraph when writing the text.' ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visit: aDocument [ canvas := MicRichTextCanvas new @@ -372,21 +374,21 @@ MicRichTextComposer >> visit: aDocument [ ^ canvas contents trim ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitAnnotatedParagraph: anAnnotatedParagraph [ "Do nothing - You are supposed to use specialized annotations" self error: 'You are not supposed to be here - did you misspell an annotation type?' ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitAnnotation: aMicAnnotationBlock [ "Environment is an abstract class, and if we end here it is because of error" canvas << ('>>> Annotation ''' , aMicAnnotationBlock name , ''' is not defined <<<') asText ] -{ #category : #'visiting - format' } +{ #category : 'visiting - format' } MicRichTextComposer >> visitBold: anObject [ canvas includeAttribute: TextEmphasis bold @@ -394,14 +396,14 @@ MicRichTextComposer >> visitBold: anObject [ ] -{ #category : #'visiting - extensions' } +{ #category : 'visiting - extensions' } MicRichTextComposer >> visitCenter: aMicCenterBlock [ canvas includeAttribute: TextAlignment centered in: [ super visitChildrenOf: aMicCenterBlock ] ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitCode: aCodeBlock [ canvas newLineIfNotAlready. @@ -419,14 +421,14 @@ MicRichTextComposer >> visitCode: aCodeBlock [ canvas << textStyler interBlockSpacing ] -{ #category : #'visiting - format' } +{ #category : 'visiting - format' } MicRichTextComposer >> visitColumn: columnBlock [ "I do nothing - handled by columns" ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitColumns: columnsBlock [ "I render the using MicRichTable which is dedicated to this. I insert the table as an image (form)" | columns columnsBlocks totalWidth| @@ -452,14 +454,14 @@ MicRichTextComposer >> visitColumns: columnsBlock [ << textStyler interBlockSpacing ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitEnvironment: aMicEnvironmentBlock [ "Environment is an abstract class, and if we end here it is because of error" canvas << ('>>> Environment ''' , aMicEnvironmentBlock environmentName , ''' is not defined <<<') asText ] -{ #category : #'visiting - inline elements' } +{ #category : 'visiting - inline elements' } MicRichTextComposer >> visitFigure: aFigure [ | image anchor | @@ -474,7 +476,7 @@ MicRichTextComposer >> visitFigure: aFigure [ do: [ :error | canvas << ('>>> ' , error printString , ' <<<') ] ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitFootnote: aFootnote [ "Adds support for footnotes by use of BalloonMorph (because it is silly and retro)" | popAction popText | @@ -487,7 +489,7 @@ MicRichTextComposer >> visitFootnote: aFootnote [ canvas << popText ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitHeader: aHeader [ | level | canvas newLineIfNotAlready. @@ -498,7 +500,7 @@ MicRichTextComposer >> visitHeader: aHeader [ canvas << (textStyler crAfterHeaderLevel: level) ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitHorizontalLine: anHorizontalLine [ canvas newLineIfNotAlready. @@ -506,7 +508,7 @@ MicRichTextComposer >> visitHorizontalLine: anHorizontalLine [ canvas newLine. ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitInputFile: inputFileBloc [ | inputRef includedText | inputRef := inputFileBloc reference. @@ -516,14 +518,14 @@ MicRichTextComposer >> visitInputFile: inputFileBloc [ canvas << (textStyler postTextTreatment: includedText ) ] -{ #category : #'visiting - format' } +{ #category : 'visiting - format' } MicRichTextComposer >> visitItalic: anObject [ canvas includeAttribute: TextEmphasis italic in: [ super visitItalic: anObject ] ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitLink: aLink [ | attribute | @@ -534,7 +536,7 @@ MicRichTextComposer >> visitLink: aLink [ canvas includeAttribute: attribute in: [ super visitLink: aLink ] ] -{ #category : #'visiting - list' } +{ #category : 'visiting - list' } MicRichTextComposer >> visitListItem: anItem [ | bullet | "The depth counter and bullet type in `visitOrderedList` and `visitUnorderedList`" @@ -548,7 +550,7 @@ MicRichTextComposer >> visitListItem: anItem [ ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitMath: aMicMathEnvironment [ | aString | @@ -557,7 +559,7 @@ MicRichTextComposer >> visitMath: aMicMathEnvironment [ canvas << (self latexFor: aString onError: ['$$ - LATEX ERROR - $$' asText] ) ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitMathInline: aMicMathInline [ | aString | aString := aMicMathInline substring . @@ -565,7 +567,7 @@ MicRichTextComposer >> visitMathInline: aMicMathInline [ canvas << (self latexFor: aString onError: [ '$ - LATEX ERROR - $' asText ]) ] -{ #category : #'visiting - inline elements' } +{ #category : 'visiting - inline elements' } MicRichTextComposer >> visitMonospace: anObject [ "Notice - I add a highlight to the backgorund rather than mono-spaced." | backgroundColor sem | @@ -583,7 +585,7 @@ MicRichTextComposer >> visitMonospace: anObject [ ifFalse: [ super visitMonospace: anObject]]. ] -{ #category : #'visiting - list' } +{ #category : 'visiting - list' } MicRichTextComposer >> visitOrderedList: aList [ "here we annotate items with their kind and the depth" | counter | @@ -601,7 +603,7 @@ MicRichTextComposer >> visitOrderedList: aList [ aList nestedLevel = 1 ifTrue: [ canvas << textStyler interBlockSpacing] ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitParagraph: anObject [ canvas newLineIfNotAlready. @@ -609,14 +611,14 @@ MicRichTextComposer >> visitParagraph: anObject [ canvas << textStyler interBlockSpacing ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitParameters: anObject [ "do nothing for now" ^ self ] -{ #category : #'visiting - extensions' } +{ #category : 'visiting - extensions' } MicRichTextComposer >> visitPharoEvaluator: aScriptBlock [ "I execute the body. I handle four types of results: Text - inserted verbatim @@ -651,7 +653,7 @@ MicRichTextComposer >> visitPharoEvaluator: aScriptBlock [ canvas newLineIfNotAlready ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitQuote: aQuote [ "I should have a fancier implementation, but for now this should work and be recognized as a quote" canvas newLineIfNotAlready. @@ -660,13 +662,13 @@ MicRichTextComposer >> visitQuote: aQuote [ canvas newLine ] -{ #category : #'visiting - inline elements' } +{ #category : 'visiting - inline elements' } MicRichTextComposer >> visitRaw: aRawFormat [ canvas << aRawFormat substring asText. ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitRichTextFormatConfiguration: config [ self textStyler class = MicDynamicTextStyler ifFalse: [ self textStyler: MicDynamicTextStyler new ]. @@ -676,14 +678,14 @@ MicRichTextComposer >> visitRichTextFormatConfiguration: config [ canvas << (errors joinUsing: String cr) ] ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitRightAlignment: aMicRightAlignmentBlock [ canvas includeAttribute: TextAlignment rightFlush in: [ self visitChildrenOf: aMicRightAlignmentBlock ] ] -{ #category : #'visiting - extensions' } +{ #category : 'visiting - extensions' } MicRichTextComposer >> visitScript: aScriptBlock [ " I execute the body. I handle four types of results: Text - inserted verbatim @@ -713,7 +715,7 @@ MicRichTextComposer >> visitScript: aScriptBlock [ ] -{ #category : #'visiting - format' } +{ #category : 'visiting - format' } MicRichTextComposer >> visitStrike: anObject [ canvas @@ -721,7 +723,7 @@ MicRichTextComposer >> visitStrike: anObject [ in: [ super visitStrike: anObject ] ] -{ #category : #'visiting - format' } +{ #category : 'visiting - format' } MicRichTextComposer >> visitTable: tableBlock [ "I render the using MicRichTable which is dedicated to this. I insert the table as an image (form)" | headers rows table anchoredTable renderedRows | @@ -748,7 +750,7 @@ MicRichTextComposer >> visitTable: tableBlock [ ] -{ #category : #'visiting - format' } +{ #category : 'visiting - format' } MicRichTextComposer >> visitText: anInlineBlock [ "we should set attribute because it would override link and others." @@ -758,7 +760,7 @@ MicRichTextComposer >> visitText: anInlineBlock [ canvas << (textStyler postTextTreatment: text) ] -{ #category : #'visiting - list' } +{ #category : 'visiting - list' } MicRichTextComposer >> visitUnorderedList: aList [ canvas newLineIfNotAlready. canvas diff --git a/src/Microdown-RichTextComposer/MicRichTextDoIt.class.st b/src/Microdown-RichTextComposer/MicRichTextDoIt.class.st index 3f30bb62..efba5be0 100644 --- a/src/Microdown-RichTextComposer/MicRichTextDoIt.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextDoIt.class.st @@ -2,12 +2,14 @@ An extension of TextDoIt attribute to be used to display executable code (in the evaluator). " Class { - #name : #MicRichTextDoIt, - #superclass : #TextDoIt, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextDoIt', + #superclass : 'TextDoIt', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #scanning } +{ #category : 'scanning' } MicRichTextDoIt >> emphasizeScanner: scanner [ "Skip emphasis" ] diff --git a/src/Microdown-RichTextComposer/MicRichTextFormatConfiguration.class.st b/src/Microdown-RichTextComposer/MicRichTextFormatConfiguration.class.st index f858889e..a4b45adb 100644 --- a/src/Microdown-RichTextComposer/MicRichTextFormatConfiguration.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextFormatConfiguration.class.st @@ -17,22 +17,24 @@ I support the following arguments: {!richtext|bullets=◊»!} - spaceAfterHeader " Class { - #name : #MicRichTextFormatConfiguration, - #superclass : #MicAnnotationBlock, - #category : #'Microdown-RichTextComposer-BlockExtensions' + #name : 'MicRichTextFormatConfiguration', + #superclass : 'MicAnnotationBlock', + #category : 'Microdown-RichTextComposer-BlockExtensions', + #package : 'Microdown-RichTextComposer', + #tag : 'BlockExtensions' } -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextFormatConfiguration class >> tag [ ^ #richtext ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextFormatConfiguration >> accept: visitor [ visitor visitRichTextFormatConfiguration: self ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextFormatConfiguration >> adjustStyler: styler [ | setters | setters := self setterDictionaryFor: styler. @@ -43,7 +45,7 @@ MicRichTextFormatConfiguration >> adjustStyler: styler [ ]. ] -{ #category : #private } +{ #category : 'private' } MicRichTextFormatConfiguration >> setterDictionaryFor: styler [ ^ { 'bullets' -> [ :a | styler bullets: a]. diff --git a/src/Microdown-RichTextComposer/MicRichTextIndentBrush.class.st b/src/Microdown-RichTextComposer/MicRichTextIndentBrush.class.st index e1062c13..0eb7c0ee 100644 --- a/src/Microdown-RichTextComposer/MicRichTextIndentBrush.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextIndentBrush.class.st @@ -2,12 +2,14 @@ I am a Brush that paints the `TextIndent` on a `Text`. The actual value of the indent is picked up from the canvas. " Class { - #name : #MicRichTextIndentBrush, - #superclass : #MicRichTextBrush, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextIndentBrush', + #superclass : 'MicRichTextBrush', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #paint } +{ #category : 'paint' } MicRichTextIndentBrush >> paint: aText [ canvas nesting isZero ifFalse: [ aText addAttribute: (TextIndent tabs: canvas nesting) ] diff --git a/src/Microdown-RichTextComposer/MicRichTextLinkPresenter.class.st b/src/Microdown-RichTextComposer/MicRichTextLinkPresenter.class.st index e1a8b993..5a2a1294 100644 --- a/src/Microdown-RichTextComposer/MicRichTextLinkPresenter.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextLinkPresenter.class.st @@ -18,12 +18,14 @@ A link to the microdown Relative references must be resolved before invoking this presenter. " Class { - #name : #MicRichTextLinkPresenter, - #superclass : #Object, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicRichTextLinkPresenter', + #superclass : 'Object', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #opening } +{ #category : 'opening' } MicRichTextLinkPresenter >> guessKindOf: aMicAbsoluteResourceReference [ |kind| kind := aMicAbsoluteResourceReference path copyAfterLast: $. . @@ -35,7 +37,7 @@ MicRichTextLinkPresenter >> guessKindOf: aMicAbsoluteResourceReference [ ] -{ #category : #opening } +{ #category : 'opening' } MicRichTextLinkPresenter >> openFormOn: aMicResourceReference [ |image window | image := aMicResourceReference loadImage. @@ -48,7 +50,7 @@ MicRichTextLinkPresenter >> openFormOn: aMicResourceReference [ open. ] -{ #category : #opening } +{ #category : 'opening' } MicRichTextLinkPresenter >> openLink: anAbsoluteResourceReference [ | kind | anAbsoluteResourceReference isRelative @@ -65,12 +67,12 @@ MicRichTextLinkPresenter >> openLink: anAbsoluteResourceReference [ ] -{ #category : #opening } +{ #category : 'opening' } MicRichTextLinkPresenter >> openWebLink: aHtmlResource [ WebBrowser openOn: aHtmlResource uri ] -{ #category : #opening } +{ #category : 'opening' } MicRichTextLinkPresenter >> pragmaForKind: kind [ | implementation | implementation := (Pragma allNamed: #richtextlinkpresenter:) @@ -78,7 +80,7 @@ MicRichTextLinkPresenter >> pragmaForKind: kind [ ^ implementation ] -{ #category : #opening } +{ #category : 'opening' } MicRichTextLinkPresenter >> resolveKind: kind andOpen: aMicHTTPResourceReference [ "I will check if there is an implementation which would like to handle this kind. If so, handle it, if not return false" diff --git a/src/Microdown-RichTextComposer/MicRichTextTable.class.st b/src/Microdown-RichTextComposer/MicRichTextTable.class.st index e5a8b893..1e084bd8 100644 --- a/src/Microdown-RichTextComposer/MicRichTextTable.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextTable.class.st @@ -2,18 +2,20 @@ I am a Morphic table used by `MicRichTextComposer>>visitTable:` to render tables. I serve no other purpose. " Class { - #name : #MicRichTextTable, - #superclass : #FTTableMorph, - #category : #'Microdown-RichTextComposer-Table-Support' + #name : 'MicRichTextTable', + #superclass : 'FTTableMorph', + #category : 'Microdown-RichTextComposer-Table-Support', + #package : 'Microdown-RichTextComposer', + #tag : 'Table-Support' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicRichTextTable class >> headers: headers rows: rows [ "headers is an array of column names, and rows are an array of array of string" ^ self new headers: headers rows: rows ] -{ #category : #adding } +{ #category : 'adding' } MicRichTextTable >> addHeaders: headers with: renderedRows [ |totalWidth totalHeight | totalWidth := 0. @@ -32,7 +34,7 @@ MicRichTextTable >> addHeaders: headers with: renderedRows [ self extent: (totalWidth + (headers size * 5)) @ (totalHeight+(renderedRows size +1 *5) ) ] -{ #category : #initialization } +{ #category : 'initialization' } MicRichTextTable >> headers: headers rows: rows [ self addHeaders: headers with: rows ; @@ -42,7 +44,7 @@ MicRichTextTable >> headers: headers rows: rows [ ] -{ #category : #rendering } +{ #category : 'rendering' } MicRichTextTable >> renderCell: aCell [ "a cell is an array of nodes. Each element should be rendered and concatenated" ^ aCell inject: Text new into: [ :txt :part | @@ -50,7 +52,7 @@ MicRichTextTable >> renderCell: aCell [ ] ] -{ #category : #private } +{ #category : 'private' } MicRichTextTable >> resizeAllSubviews [ "This method is just like its super, except it prevents the vertical scroll bar to appear" self resizeContainer. diff --git a/src/Microdown-RichTextComposer/MicRichTextTableDataSource.class.st b/src/Microdown-RichTextComposer/MicRichTextTableDataSource.class.st index 51ab29fa..9541b53b 100644 --- a/src/Microdown-RichTextComposer/MicRichTextTableDataSource.class.st +++ b/src/Microdown-RichTextComposer/MicRichTextTableDataSource.class.st @@ -3,21 +3,23 @@ I am a morphic table datasource for rendering tables inside rich text. I serve only that one purpose. " Class { - #name : #MicRichTextTableDataSource, - #superclass : #FTSimpleDataSource, + #name : 'MicRichTextTableDataSource', + #superclass : 'FTSimpleDataSource', #instVars : [ 'colNames', 'rows' ], - #category : #'Microdown-RichTextComposer-Table-Support' + #category : 'Microdown-RichTextComposer-Table-Support', + #package : 'Microdown-RichTextComposer', + #tag : 'Table-Support' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicRichTextTableDataSource class >> headers: headers rows: theRows [ ^ self new headers: headers rows: theRows ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextTableDataSource >> basicHeaderCellFor: column [ | cell | column id ifNil: [ ^ nil ]. @@ -30,7 +32,7 @@ MicRichTextTableDataSource >> basicHeaderCellFor: column [ ^ cell ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextTableDataSource >> cellColumn: column row: rowIndex [ "Answer a morph with the cell view. I will probably return a FTCellMorph." | cell | @@ -40,47 +42,47 @@ MicRichTextTableDataSource >> cellColumn: column row: rowIndex [ yourself ] -{ #category : #private } +{ #category : 'private' } MicRichTextTableDataSource >> elementAt: rowIndex [ "I am a really important method for a DataSource. I take an index and I return an object that should be displayed in the table for the index." rows at: rowIndex ] -{ #category : #initialization } +{ #category : 'initialization' } MicRichTextTableDataSource >> headers: headers rows: theRows [ rows := theRows. colNames := Dictionary new. 1 to: headers size do: [ :index | colNames at: (headers at: index) put: index ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextTableDataSource >> numberOfRows [ "I return the number of elements I can display in the table when I am call." ^ rows size ] -{ #category : #accessing } +{ #category : 'accessing' } MicRichTextTableDataSource >> rowHeight: rowIndex [ ^ (rows at: rowIndex ) max: [ :cell | cell asTextMorph height ] ] -{ #category : #sorting } +{ #category : 'sorting' } MicRichTextTableDataSource >> sortElements: aSortFunction [ "This method should sort the elements of the datasource using the sort function as parameter." ^ self ] -{ #category : #sorting } +{ #category : 'sorting' } MicRichTextTableDataSource >> unsortElements [ "This method should return the elements in their initial state." ^ self ] -{ #category : #private } +{ #category : 'private' } MicRichTextTableDataSource >> widthOfText: txt [ |width| width := ((txt fontAt: 1) widthOfStringOrText: txt). diff --git a/src/Microdown-RichTextComposer/MicRightAlignmentBlock.class.st b/src/Microdown-RichTextComposer/MicRightAlignmentBlock.class.st index dd19144b..65c44c68 100644 --- a/src/Microdown-RichTextComposer/MicRightAlignmentBlock.class.st +++ b/src/Microdown-RichTextComposer/MicRightAlignmentBlock.class.st @@ -4,17 +4,19 @@ I implement a right allignment block for RichText !> " Class { - #name : #MicRightAlignmentBlock, - #superclass : #MicEnvironmentBlock, - #category : #'Microdown-RichTextComposer-BlockExtensions' + #name : 'MicRightAlignmentBlock', + #superclass : 'MicEnvironmentBlock', + #category : 'Microdown-RichTextComposer-BlockExtensions', + #package : 'Microdown-RichTextComposer', + #tag : 'BlockExtensions' } -{ #category : #accessing } +{ #category : 'accessing' } MicRightAlignmentBlock class >> tag [ ^ #right ] -{ #category : #visiting } +{ #category : 'visiting' } MicRightAlignmentBlock >> accept: aVisitor [ ^ aVisitor visitRightAlignment: self ] diff --git a/src/Microdown-RichTextComposer/MicScalingTextAnchor.class.st b/src/Microdown-RichTextComposer/MicScalingTextAnchor.class.st index a531c163..6982bb74 100644 --- a/src/Microdown-RichTextComposer/MicScalingTextAnchor.class.st +++ b/src/Microdown-RichTextComposer/MicScalingTextAnchor.class.st @@ -11,47 +11,49 @@ optionally one can freeze the height of the embedded image. This is mostly usefu New width is given by targetWidth: - this is not a user function, but is called by the scaling mechanism. " Class { - #name : #MicScalingTextAnchor, - #superclass : #TextAnchor, + #name : 'MicScalingTextAnchor', + #superclass : 'TextAnchor', #instVars : [ 'original', 'scale', 'freezeHeight' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #accessing } +{ #category : 'accessing' } MicScalingTextAnchor >> freezeHeight [ ^ freezeHeight ] -{ #category : #accessing } +{ #category : 'accessing' } MicScalingTextAnchor >> freezeHeight: anObject [ freezeHeight := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } MicScalingTextAnchor >> original [ ^ original ] -{ #category : #accessing } +{ #category : 'accessing' } MicScalingTextAnchor >> original: aForm [ original := aForm. anchoredMorph := aForm ] -{ #category : #accessing } +{ #category : 'accessing' } MicScalingTextAnchor >> scale: percentOrNil [ scale := percentOrNil ] -{ #category : #accessing } +{ #category : 'accessing' } MicScalingTextAnchor >> targetWidth: rightMargin [ | newWidth newHeight | diff --git a/src/Microdown-RichTextComposer/MicSemanticAction.class.st b/src/Microdown-RichTextComposer/MicSemanticAction.class.st index 425f115f..63237749 100644 --- a/src/Microdown-RichTextComposer/MicSemanticAction.class.st +++ b/src/Microdown-RichTextComposer/MicSemanticAction.class.st @@ -20,16 +20,18 @@ The following entities can be referenced. " Class { - #name : #MicSemanticAction, - #superclass : #Object, + #name : 'MicSemanticAction', + #superclass : 'Object', #instVars : [ 'entity', 'tokens' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction class >> from: aString [ | contents | @@ -37,12 +39,12 @@ MicSemanticAction class >> from: aString [ ^ self fromTokens: (contents collect: [ :e | e value ]) ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction class >> fromTokens: anArray [ ^ self new fromTokens: anArray; yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction >> computeEntity [ "Try to guess what the text is: Point @@ -75,12 +77,12 @@ MicSemanticAction >> computeEntity [ ifFalse: [ ^ self ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } MicSemanticAction >> entity [ ^ entity ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction >> fromTokens: anArray [ anArray ifEmpty: [ ^ self]. @@ -88,7 +90,7 @@ MicSemanticAction >> fromTokens: anArray [ self computeEntity. ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction >> getClassOrNil [ self class environment @@ -99,7 +101,7 @@ MicSemanticAction >> getClassOrNil [ ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction >> getCompiledMethodFrom: start [ " @@ -116,7 +118,7 @@ MicSemanticAction >> getCompiledMethodFrom: start [ ifAbsent: [ entity := nil ] ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction >> getMetaClassOrNil [ self class environment @@ -130,19 +132,19 @@ MicSemanticAction >> getMetaClassOrNil [ ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSemanticAction >> getPackageOrNil [ entity := RPackageOrganizer default packageNamed: tokens first asString ifAbsent: [ nil ]. ^ entity ] -{ #category : #testing } +{ #category : 'testing' } MicSemanticAction >> hasEntity [ ^ entity isNotNil ] -{ #category : #accessing } +{ #category : 'accessing' } MicSemanticAction >> tokens: aCol [ tokens := aCol diff --git a/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st b/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st index dda8671e..d3d5e053 100644 --- a/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st +++ b/src/Microdown-RichTextComposer/MicSmalltalkTextStyler.class.st @@ -3,12 +3,14 @@ I am a smalltalk code styler which renders undefined variables and methods same I am used to render smalltalk codeblocks. " Class { - #name : #MicSmalltalkTextStyler, - #superclass : #SHRBTextStyler, - #category : #'Microdown-RichTextComposer-Composer' + #name : 'MicSmalltalkTextStyler', + #superclass : 'SHRBTextStyler', + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #'class initialization' } +{ #category : 'class initialization' } MicSmalltalkTextStyler class >> initialize [ "I have my own set of class side variables. I should not, but alas, so it is" @@ -18,7 +20,7 @@ MicSmalltalkTextStyler class >> initialize [ formatIncompleteIdentifiers := false ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } MicSmalltalkTextStyler class >> new [ "I need to stay in sync with my superclass, so I initilize on each instantiation. Performance says a few micro seconds, so OK" self styleTable = SHRBTextStyler styleTable "style table was changed" @@ -26,7 +28,7 @@ MicSmalltalkTextStyler class >> new [ ^ super new ] -{ #category : #private } +{ #category : 'private' } MicSmalltalkTextStyler >> attributesFor: aSymbol [ | symbol | @@ -38,14 +40,14 @@ MicSmalltalkTextStyler >> attributesFor: aSymbol [ ^ super attributesFor: symbol ] -{ #category : #private } +{ #category : 'private' } MicSmalltalkTextStyler >> resolveStyleFor: aVariableNode [ "This circumvent an error in my super" aVariableNode isUndeclaredVariable ifTrue: [ ^#undefinedIdentifier ]. ^ super resolveStyleFor: aVariableNode ] -{ #category : #styling } +{ #category : 'styling' } MicSmalltalkTextStyler >> styledTextFor: aText [ aText ifEmpty: [ ^ aText ]. ^self privateStyle: aText diff --git a/src/Microdown-RichTextComposer/MicTextStyler.class.st b/src/Microdown-RichTextComposer/MicTextStyler.class.st index 5c49b9fb..692bca30 100644 --- a/src/Microdown-RichTextComposer/MicTextStyler.class.st +++ b/src/Microdown-RichTextComposer/MicTextStyler.class.st @@ -6,26 +6,28 @@ I control heading sizes and bullets. I am defining all these in methods, so to override and do something different, make a subclass of me and set `MicRichTextComposer` to use your new subclass (using `MicRichTextComposer>>textStyler:`). " Class { - #name : #MicTextStyler, - #superclass : #Object, + #name : 'MicTextStyler', + #superclass : 'Object', #instVars : [ 'headerFonts' ], - #category : #'Microdown-RichTextComposer-Composer' + #category : 'Microdown-RichTextComposer-Composer', + #package : 'Microdown-RichTextComposer', + #tag : 'Composer' } -{ #category : #'presenter styles' } +{ #category : 'presenter styles' } MicTextStyler >> bodyFont [ ^ nil ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicTextStyler >> bulletForLevel: level [ "first level is 1, then 2, then 3..." ^ ('•-' at: (level-1 % 2)+1) asText ] -{ #category : #private } +{ #category : 'private' } MicTextStyler >> computeHeaderFonts [ headerFonts := Array new: self headerFontSizes size. @@ -39,7 +41,7 @@ MicTextStyler >> computeHeaderFonts [ ] ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicTextStyler >> counterFor: counter atLevel: level [ | kind | "first level is 1" @@ -52,49 +54,49 @@ MicTextStyler >> counterFor: counter atLevel: level [ ifTrue: [ ^ ($a asInteger + (counter - 1)) asCharacter asText , ')' ] ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicTextStyler >> crAfterHeaderLevel: level [ "I return Text to make space after a header" ^ String cr asText ] -{ #category : #public } +{ #category : 'public' } MicTextStyler >> headerFontSizes [ ^ #(28 24 18 14 12 10) ] -{ #category : #private } +{ #category : 'private' } MicTextStyler >> headerLevelFont: level [ "I return a font annotation to be used with Attributes" headerFonts ifNil: [ self computeHeaderFonts ]. ^ headerFonts at: (level min: 6) ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicTextStyler >> interBlockSpacing [ "I return the space to be put between blocks, first cr to end block, second to make empty line" ^ (String cr, String cr) asText ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicTextStyler >> monospaceBackgroundColor [ ^ Smalltalk ui theme settings windowColor ] -{ #category : #'canvas styles' } +{ #category : 'canvas styles' } MicTextStyler >> newLineBody [ "return a newline" ^ String cr asText ] -{ #category : #'canvas styles' } +{ #category : 'canvas styles' } MicTextStyler >> newLineIfNotAlready [ "return a newline if there is not already one" "Intended to be overridden to add extra newline or tab indentation of the following line" ^ String cr asText ] -{ #category : #'composer styles' } +{ #category : 'composer styles' } MicTextStyler >> postTextTreatment: aText [ "my primary purpose is to replace newLines with space in some styles" "((1 to: aText size) diff --git a/src/Microdown-RichTextComposer/MicrodownParser.extension.st b/src/Microdown-RichTextComposer/MicrodownParser.extension.st index d8b271d9..ca23a5a9 100644 --- a/src/Microdown-RichTextComposer/MicrodownParser.extension.st +++ b/src/Microdown-RichTextComposer/MicrodownParser.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #MicrodownParser } +Extension { #name : 'MicrodownParser' } -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } MicrodownParser class >> convertToRichText: aString [ ^ MicRichTextComposer new visit: (self new parse: aString) ] diff --git a/src/Microdown-RichTextComposer/MicrodownVisitor.extension.st b/src/Microdown-RichTextComposer/MicrodownVisitor.extension.st index 9d73589e..31f3061c 100644 --- a/src/Microdown-RichTextComposer/MicrodownVisitor.extension.st +++ b/src/Microdown-RichTextComposer/MicrodownVisitor.extension.st @@ -1,16 +1,16 @@ -Extension { #name : #MicrodownVisitor } +Extension { #name : 'MicrodownVisitor' } -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } MicrodownVisitor >> visitCenter: aMicCenterBlock [ self visitEnvironment: aMicCenterBlock ] -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } MicrodownVisitor >> visitRichTextFormatConfiguration: config [ self visitAnnotation: config ] -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } MicrodownVisitor >> visitRightAlignment: aMicRightAlignmentBlock [ self visitEnvironment: aMicRightAlignmentBlock ] diff --git a/src/Microdown-RichTextComposer/OrderedCollection.extension.st b/src/Microdown-RichTextComposer/OrderedCollection.extension.st index 2817d005..a7b075d1 100644 --- a/src/Microdown-RichTextComposer/OrderedCollection.extension.st +++ b/src/Microdown-RichTextComposer/OrderedCollection.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #OrderedCollection } +Extension { #name : 'OrderedCollection' } -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } OrderedCollection >> truncateTo: smallSize [ "return myself or a copy shortened to smallSize." diff --git a/src/Microdown-RichTextComposer/Text.extension.st b/src/Microdown-RichTextComposer/Text.extension.st index d06274fe..78d9d514 100644 --- a/src/Microdown-RichTextComposer/Text.extension.st +++ b/src/Microdown-RichTextComposer/Text.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Text } +Extension { #name : 'Text' } -{ #category : #'*Microdown-RichTextComposer' } +{ #category : '*Microdown-RichTextComposer' } Text >> trim [ | left right | left := 1. diff --git a/src/Microdown-RichTextComposer/package.st b/src/Microdown-RichTextComposer/package.st index 910bd168..a329ebc3 100644 --- a/src/Microdown-RichTextComposer/package.st +++ b/src/Microdown-RichTextComposer/package.st @@ -1 +1 @@ -Package { #name : #'Microdown-RichTextComposer' } +Package { #name : 'Microdown-RichTextComposer' }