diff --git a/src/Grafoscopio-Utils/GrafoscopioUtils.class.st b/src/Grafoscopio-Utils/GrafoscopioUtils.class.st index e162ed0..68de372 100644 --- a/src/Grafoscopio-Utils/GrafoscopioUtils.class.st +++ b/src/Grafoscopio-Utils/GrafoscopioUtils.class.st @@ -91,6 +91,16 @@ GrafoscopioUtils class >> getContentsFrom: url withMessage: aString [ ^ client contents. ] +{ #category : #persistence } +GrafoscopioUtils class >> joinLinesFor: aCollection [ + + | joinedLines | + + joinedLines := WriteStream on: ''. + aCollection do: [ :line | joinedLines nextPutAll: line; crlf ]. + ^ joinedLines contents +] + { #category : #utilities } GrafoscopioUtils class >> perform: aString on: anObject [ diff --git a/src/Grafoscopio-Utils/Markdeep.class.st b/src/Grafoscopio-Utils/Markdeep.class.st index e5f0fa2..10d69f6 100644 --- a/src/Grafoscopio-Utils/Markdeep.class.st +++ b/src/Grafoscopio-Utils/Markdeep.class.st @@ -6,6 +6,7 @@ Class { #superclass : #Object, #instVars : [ 'tocStyle', + 'comments', 'header', 'tail', 'body', @@ -30,14 +31,54 @@ Markdeep >> body: anObject [ body := anObject ] +{ #category : #accessing } +Markdeep >> comments [ + ^ comments ifNil: [ ^ comments := true ] +] + +{ #category : #accessing } +Markdeep >> comments: aBoolean [ + "I tell if comments are enabled by default or not." + comments := aBoolean +] + +{ #category : #utilities } +Markdeep >> commentsProvider [ + "I return the url of the default service that provides annotation support. + I am used to add such support in the contents of the Markdeep page." + ^ 'https://hypothes.is' +] + +{ #category : #utilities } +Markdeep >> commentsProviderStrings [ + "I associate a comments service provider with the string that is required to be added + to the document to enable such provider." + | providers | + providers := Dictionary new. + providers at: 'https://hypothes.is' put: ' +'. + ^ providers + + +] + +{ #category : #utilities } +Markdeep >> commentsSupport [ + "I enable comments of the page." + + self comments ifFalse: [ ^ self ]. + ^ self commentsProviderStrings at: self commentsProvider +] + { #category : #'instance creation' } Markdeep >> contents [ | output | output := '' writeStream. output nextPutAll: self header; crlf; - nextPutAll: (self body); crlf; - nextPutAll: self tail. + nextPutAll: self body; crlf; + nextPutAll: self tail; crlf; crlf; + nextPutAll: self commentsSupport. ^ output contents. ]