From d1320c47172c86f749b7d248d01285434cca38ba Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 9 Nov 2019 11:43:22 +0000 Subject: [PATCH] Sync. last work. --- .../GrafoscopioUtils.class.st | 10 +++++ .../Grafoscopio-Utils/Markdeep.class.st | 45 ++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st b/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st index e162ed0..68de372 100644 --- a/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st +++ b/repository/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/repository/Grafoscopio-Utils/Markdeep.class.st b/repository/Grafoscopio-Utils/Markdeep.class.st index e5f0fa2..10d69f6 100644 --- a/repository/Grafoscopio-Utils/Markdeep.class.st +++ b/repository/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. ]