From af22a292a46bd4508702e1fe3022bf3421227614 Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Tue, 3 Oct 2023 14:46:09 +0200 Subject: [PATCH] fix deprecated send --- .../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 | 122 +++++++++--------- .../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 +- 28 files changed, 316 insertions(+), 272 deletions(-) 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 e2b377bf..db9ff9d0 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,28 +396,28 @@ 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. self doVisitCode: aCodeBlock ] -{ #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| @@ -441,14 +443,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| @@ -463,7 +465,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 | @@ -476,7 +478,7 @@ MicRichTextComposer >> visitFootnote: aFootnote [ canvas << popText ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitHeader: aHeader [ | level | canvas newLineIfNotAlready. @@ -487,7 +489,7 @@ MicRichTextComposer >> visitHeader: aHeader [ canvas << (textStyler crAfterHeaderLevel: level) ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitHorizontalLine: anHorizontalLine [ canvas newLineIfNotAlready. @@ -495,7 +497,7 @@ MicRichTextComposer >> visitHorizontalLine: anHorizontalLine [ canvas newLine. ] -{ #category : #visiting } +{ #category : 'visiting' } MicRichTextComposer >> visitInputFile: inputFileBloc [ | inputRef includedText | inputRef := inputFileBloc reference. @@ -505,14 +507,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 | @@ -523,7 +525,7 @@ MicRichTextComposer >> visitLink: aLink [ canvas includeAttribute: attribute in: [ super visitLink: aLink ] ] -{ #category : #'visiting - document' } +{ #category : 'visiting - document' } MicRichTextComposer >> visitLink_old: aLink [ | attribute | @@ -534,7 +536,7 @@ MicRichTextComposer >> visitLink_old: 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." |text| @@ -756,7 +758,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' }