From 887cdb0743da362ee593f98b1dc118dbd59bfcf5 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Thu, 19 Nov 2020 19:02:37 -0500 Subject: [PATCH] Renaming to support new HedgeDoc rebranding and improving Markdown metada. --- .../{CodiMD.class.st => HedgeDoc.class.st} | 36 +++++++++---------- .../Grafoscopio-Utils/Markdown.class.st | 8 +++-- repository/Grafoscopio-Utils/Pandoc.class.st | 4 +-- 3 files changed, 26 insertions(+), 22 deletions(-) rename repository/Grafoscopio-Utils/{CodiMD.class.st => HedgeDoc.class.st} (77%) diff --git a/repository/Grafoscopio-Utils/CodiMD.class.st b/repository/Grafoscopio-Utils/HedgeDoc.class.st similarity index 77% rename from repository/Grafoscopio-Utils/CodiMD.class.st rename to repository/Grafoscopio-Utils/HedgeDoc.class.st index 108e451..341cd2b 100644 --- a/repository/Grafoscopio-Utils/CodiMD.class.st +++ b/repository/Grafoscopio-Utils/HedgeDoc.class.st @@ -6,7 +6,7 @@ so one document can start online (as a CodiMD pad) and continue as a Grafoscopio notebook or viceversa. " Class { - #name : #CodiMD, + #name : #HedgeDoc, #superclass : #Object, #instVars : [ 'server', @@ -18,28 +18,28 @@ Class { } { #category : #'as yet unclassified' } -CodiMD class >> newDefault [ +HedgeDoc class >> newDefault [ ^ self new defaultServer. ] { #category : #accessing } -CodiMD >> contents [ +HedgeDoc >> contents [ ^ contents ] { #category : #accessing } -CodiMD >> contents: anObject [ +HedgeDoc >> contents: anObject [ contents := anObject ] { #category : #'as yet unclassified' } -CodiMD >> defaultServer [ +HedgeDoc >> defaultServer [ self server: 'https://docutopia.tupale.co'. ] { #category : #'as yet unclassified' } -CodiMD >> htmlUrl [ +HedgeDoc >> htmlUrl [ | link | link := self url copy. link segments insert: 's' before: 1. @@ -47,28 +47,28 @@ CodiMD >> htmlUrl [ ] { #category : #'as yet unclassified' } -CodiMD >> importContents [ +HedgeDoc >> importContents [ self contents: self retrieveContents ] { #category : #accessing } -CodiMD >> pad [ +HedgeDoc >> pad [ ^ pad ] { #category : #accessing } -CodiMD >> pad: anObject [ +HedgeDoc >> pad: anObject [ pad := anObject ] { #category : #'as yet unclassified' } -CodiMD >> retrieveContents [ +HedgeDoc >> retrieveContents [ self url ifNil: [ ^ self ]. ^ (self url addPathSegment: 'download') retrieveContents ] { #category : #'as yet unclassified' } -CodiMD >> retrieveHtmlContents [ +HedgeDoc >> retrieveHtmlContents [ | htmlContents | self url ifNil: [ ^ self ]. htmlContents := self htmlUrl. @@ -76,38 +76,38 @@ CodiMD >> retrieveHtmlContents [ ] { #category : #'as yet unclassified' } -CodiMD >> saveContentsToFile: aFileLocator [ +HedgeDoc >> saveContentsToFile: aFileLocator [ self url ifNil: [ ^ self ]. ^ (self url addPathSegment: 'download') saveContentsToFile: aFileLocator ] { #category : #'as yet unclassified' } -CodiMD >> saveHtmlContentsToFile: aFileLocator [ +HedgeDoc >> saveHtmlContentsToFile: aFileLocator [ self url ifNil: [ ^ self ]. ^ self htmlUrl saveContentsToFile: aFileLocator ] { #category : #accessing } -CodiMD >> server [ +HedgeDoc >> server [ ^ server ] { #category : #accessing } -CodiMD >> server: aUrlString [ +HedgeDoc >> server: aUrlString [ server := aUrlString ] { #category : #accessing } -CodiMD >> url [ +HedgeDoc >> url [ ^ url asUrl ] { #category : #accessing } -CodiMD >> url: anObject [ +HedgeDoc >> url: anObject [ url := anObject ] { #category : #visiting } -CodiMD >> visit [ +HedgeDoc >> visit [ WebBrowser openOn: self server, '/', self pad. ] diff --git a/repository/Grafoscopio-Utils/Markdown.class.st b/repository/Grafoscopio-Utils/Markdown.class.st index 752091a..7ca036b 100644 --- a/repository/Grafoscopio-Utils/Markdown.class.st +++ b/repository/Grafoscopio-Utils/Markdown.class.st @@ -143,8 +143,12 @@ Markdown >> locateYAMLMetadataClosing [ { #category : #accessing } Markdown >> metadata [ - - ^ PPYAMLGrammar new parse: self extractYAMLMetadata. + | rawMeta | + rawMeta := PPYAMLGrammar new parse: self extractYAMLMetadata. + rawMeta associationsDo: [ :assoc | + assoc value = 'false' ifTrue: [ assoc value: false ]. + assoc value = 'true' ifTrue: [ assoc value: true ] ]. + ^ rawMeta ] { #category : #utilities } diff --git a/repository/Grafoscopio-Utils/Pandoc.class.st b/repository/Grafoscopio-Utils/Pandoc.class.st index b97d436..c4f6d93 100644 --- a/repository/Grafoscopio-Utils/Pandoc.class.st +++ b/repository/Grafoscopio-Utils/Pandoc.class.st @@ -114,8 +114,8 @@ Pandoc class >> luaFilters [ { #category : #converters } Pandoc class >> markdownToHtml: inputFile [ - (Smalltalk os isUnix or: [ Smalltalk os isMacOS ]) ifTrue: [ self markdownToHtmlOnUnix: inputFile ]. - Smalltalk os isWindows ifTrue: [ self markdownToHtmlOnWindows: inputFile ]. + (Smalltalk os isUnix or: [ Smalltalk os isMacOS ]) ifTrue: [ ^ self markdownToHtmlOnUnix: inputFile ]. + Smalltalk os isWindows ifTrue: [ ^ self markdownToHtmlOnWindows: inputFile ]. ] { #category : #converters }