Sync. last work.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2019-11-09 11:43:22 +00:00
parent 9f9bcb08a0
commit d1320c4717
2 changed files with 53 additions and 2 deletions

View File

@ -91,6 +91,16 @@ GrafoscopioUtils class >> getContentsFrom: url withMessage: aString [
^ client contents. ^ client contents.
] ]
{ #category : #persistence }
GrafoscopioUtils class >> joinLinesFor: aCollection [
| joinedLines |
joinedLines := WriteStream on: ''.
aCollection do: [ :line | joinedLines nextPutAll: line; crlf ].
^ joinedLines contents
]
{ #category : #utilities } { #category : #utilities }
GrafoscopioUtils class >> perform: aString on: anObject [ GrafoscopioUtils class >> perform: aString on: anObject [

View File

@ -6,6 +6,7 @@ Class {
#superclass : #Object, #superclass : #Object,
#instVars : [ #instVars : [
'tocStyle', 'tocStyle',
'comments',
'header', 'header',
'tail', 'tail',
'body', 'body',
@ -30,14 +31,54 @@ Markdeep >> body: anObject [
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' } { #category : #'instance creation' }
Markdeep >> contents [ Markdeep >> contents [
| output | | output |
output := '' writeStream. output := '' writeStream.
output output
nextPutAll: self header; crlf; nextPutAll: self header; crlf;
nextPutAll: (self body); crlf; nextPutAll: self body; crlf;
nextPutAll: self tail. nextPutAll: self tail; crlf; crlf;
nextPutAll: self commentsSupport.
^ output contents. ^ output contents.
] ]