diff --git a/repository/Grafoscopio-Utils/Markdown.class.st b/repository/Grafoscopio-Utils/Markdown.class.st index cc27488..bda223a 100644 --- a/repository/Grafoscopio-Utils/Markdown.class.st +++ b/repository/Grafoscopio-Utils/Markdown.class.st @@ -68,14 +68,22 @@ Markdown >> detectYAMLMetadata [ { #category : #operation } Markdown >> exportMetadataAsJson [ - | yaml2json | - self exportMetadataAsYaml. - yaml2json := OSSUnixSubprocess new - shellCommand: 'yaml2json /tmp/metadata.yaml > /tmp/metadata.json'; - run. - yaml2json waitForExit. - yaml2json closeAndCleanStreams. - ^ FileLocator temp / 'metadata.json' + "TBD: Lua scripts should be checked and installed when missing. Maybe a shared location + in '.local/share/Grafoscopio/Scripts' should be developed in the near future." + | output luaScript | + luaScript := FileLocator home / '.local/share/Brea/scripts/meta-to-json.lua'. + OSSUnixSubprocess new + workingDirectory: self file parent fullName; + command: 'pandoc'; + arguments: { '--lua-filter=', luaScript fullName . self file basename }; + redirectStdout; + redirectStdin; + runAndWaitOnExitDo: [ :process :outString :errString | + output := process isSuccess + ifTrue: [ outString ] + ifFalse: [ errString ] + ]. + ^ output correctAccentedCharacters ] { #category : #operation } diff --git a/repository/Grafoscopio-Utils/String.extension.st b/repository/Grafoscopio-Utils/String.extension.st index 53dbdb9..39af119 100644 --- a/repository/Grafoscopio-Utils/String.extension.st +++ b/repository/Grafoscopio-Utils/String.extension.st @@ -14,6 +14,19 @@ String >> asDashedLowercase [ ^ '-' join: (self substrings collect: [:each | each asLowercase ]) ] +{ #category : #'*Grafoscopio-Utils' } +String >> correctAccentedCharacters [ + + | output | + output := self + copyReplaceAll: 'ó' with: 'ó'. + output := output copyReplaceAll: 'á' with: 'á'. + output := output copyReplaceAll: 'é' with: 'é'. + output := output copyReplaceAll: 'í' with: 'í'. + output := output copyReplaceAll: 'ú' with: 'ú'. + ^ output +] + { #category : #'*Grafoscopio-Utils' } String >> isOrgModeHeader [ ^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ')