From eeaf28127baf45968a267b7fe7a18a709f8dd9c1 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 25 May 2024 20:56:50 -0500 Subject: [PATCH] Adding Markdeep export to GraphiQL snippets. --- src/MiniDocs/GtGQLSnippet.extension.st | 43 +++++++++++++++++++++- src/MiniDocs/LeTextualSnippet.extension.st | 24 ++++++++---- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/MiniDocs/GtGQLSnippet.extension.st b/src/MiniDocs/GtGQLSnippet.extension.st index 04acc2c..4e436b7 100644 --- a/src/MiniDocs/GtGQLSnippet.extension.st +++ b/src/MiniDocs/GtGQLSnippet.extension.st @@ -1,5 +1,46 @@ Extension { #name : #GtGQLSnippet } +{ #category : #'*MiniDocs' } +GtGQLSnippet >> asMarkdeep [ + | output | + output := WriteStream on: ''. + output + nextPutAll: self metadataDiv; + nextPutAll: self markdeepCustomOpener; + nextPutAll: self asMarkdownString; + nextPut: Character lf; + nextPutAll: self markdeepCustomCloser; + nextPut: Character lf; + nextPutAll: ''; + nextPut: Character lf; + nextPut: Character lf. + ^ output contents withInternetLineEndings +] + +{ #category : #'*MiniDocs' } +GtGQLSnippet >> markdeepCustomCloser [ + ^ self markdeepCustomOpener +] + +{ #category : #'*MiniDocs' } +GtGQLSnippet >> markdeepCustomOpener [ + ^ '* * *' +] + +{ #category : #'*MiniDocs' } +GtGQLSnippet >> metadataDiv [ + "PENDING: Shared among several snippets. Should be abstracted further?" + | output | + output := WriteStream on: ''. + output + nextPutAll: '
'; + nextPut: Character lf. + ^ output contents withInternetLineEndings. + +] + { #category : #'*MiniDocs' } GtGQLSnippet >> metadataUpdate [ | createEmailSanitized editEmailSanitized | @@ -7,7 +48,7 @@ GtGQLSnippet >> metadataUpdate [ editEmailSanitized := self editEmail asString withoutXMLTagDelimiters. ^ OrderedDictionary new at: 'id' put: self uidString; - at: 'parent' put: self parent uuid; + at: 'parent' put: self parent uid asString36; at: 'created' put: self createTime asString; at: 'modified' put: self latestEditTime asString; at: 'creator' put: createEmailSanitized; diff --git a/src/MiniDocs/LeTextualSnippet.extension.st b/src/MiniDocs/LeTextualSnippet.extension.st index dc850f4..55850e5 100644 --- a/src/MiniDocs/LeTextualSnippet.extension.st +++ b/src/MiniDocs/LeTextualSnippet.extension.st @@ -2,16 +2,11 @@ Extension { #name : #LeTextualSnippet } { #category : #'*MiniDocs' } LeTextualSnippet >> asMarkdeep [ - "Inspired by Alpine.js and Assembler CSS 'x-' properties, we are going to use - 'st-' properties as a way to extend divs metadata regarding its contents." - + | output | output := WriteStream on: ''. output - nextPutAll: '
'; - nextPut: Character lf; + nextPutAll: self metadataDiv; nextPutAll: self markdeepCustomOpener; nextPutAll: self contentAsStringAnnotated; nextPut: Character lf; @@ -112,6 +107,21 @@ LeTextualSnippet >> metadata [ ^ self metadataUpdate ] +{ #category : #'*MiniDocs' } +LeTextualSnippet >> metadataDiv [ + "Inspired by Alpine.js and Assembler CSS 'x-' properties, we are going to use + 'st-' properties as a way to extend divs metadata regarding its contents." + "PENDING: this is repeated in several snippets. Can be abstracted up in a common object of the class hierarchy?" + | output | + output := WriteStream on: ''. + output + nextPutAll: '
'; + nextPut: Character lf. + ^ output contents withInternetLineEndings. +] + { #category : #'*MiniDocs' } LeTextualSnippet >> metadataUpdate [ | createEmailSanitized editEmailSanitized |