Sync. last work.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2019-11-09 11:43:22 +00:00 committed by SantiagoBragagnolo
parent de109452da
commit f0fe17ec3f
2 changed files with 53 additions and 2 deletions

View File

@ -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 [

View File

@ -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: '<!-- Hypothesis -->
<script src="https://hypothes.is/embed.js" async></script>'.
^ 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.
]