Compare commits
No commits in common. "master" and "unsync" have entirely different histories.
@ -23,30 +23,6 @@ FileLocator class >> atAlias: aString put: aFolderOrFile [
|
|||||||
^ updatedAliases
|
^ updatedAliases
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
|
||||||
FileLocator >> extractMetadata [
|
|
||||||
"I package the functionality from [[How to extract meta information using ExifTool]],
|
|
||||||
from the GToolkit Book.
|
|
||||||
I depend on the external tool ExifTool."
|
|
||||||
|
|
||||||
| process variablesList |
|
|
||||||
process := GtSubprocessWithInMemoryOutput new
|
|
||||||
command: 'exiftool';
|
|
||||||
arguments: { self fullName}.
|
|
||||||
process errorBlock: [ :proc | ^ self error: 'Failed to run exiftool' ].
|
|
||||||
process runAndWait.
|
|
||||||
variablesList := process stdout lines collect: [ :currentLine |
|
|
||||||
| separatorIndex name value |
|
|
||||||
separatorIndex := currentLine indexOf: $:.
|
|
||||||
name := (currentLine copyFrom: 1 to: separatorIndex - 1) trimBoth.
|
|
||||||
value := (currentLine
|
|
||||||
copyFrom: separatorIndex + 1
|
|
||||||
to: currentLine size) trimBoth.
|
|
||||||
name -> value
|
|
||||||
].
|
|
||||||
^ variablesList asOrderedDictionary
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'*MiniDocs' }
|
{ #category : #'*MiniDocs' }
|
||||||
FileLocator class >> fileAliases [
|
FileLocator class >> fileAliases [
|
||||||
^ MiniDocs appFolder / 'fileAliases.ston'
|
^ MiniDocs appFolder / 'fileAliases.ston'
|
||||||
|
@ -37,9 +37,7 @@ HedgeDoc >> asLePage [
|
|||||||
addSnippet: snippet;
|
addSnippet: snippet;
|
||||||
yourself.
|
yourself.
|
||||||
newPage incomingLinks.
|
newPage incomingLinks.
|
||||||
newPage options
|
newPage metadata addAll: self metadata.
|
||||||
at: 'originalMetadata' put: self metadata;
|
|
||||||
at: 'url' put: self url.
|
|
||||||
^ newPage
|
^ newPage
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -164,6 +162,7 @@ HedgeDoc >> url: anObject [
|
|||||||
(html xpath: '//head/meta[@name="application-name"][@content = "HedgeDoc - Ideas grow better together"]') isEmpty
|
(html xpath: '//head/meta[@name="application-name"][@content = "HedgeDoc - Ideas grow better together"]') isEmpty
|
||||||
ifTrue: [ self inform: 'Not a hedgedoc url'.
|
ifTrue: [ self inform: 'Not a hedgedoc url'.
|
||||||
url := nil ].
|
url := nil ].
|
||||||
|
self metadata at: 'title' put: tempUrl firstPathSegment.
|
||||||
server := tempUrl host.
|
server := tempUrl host.
|
||||||
url := anObject
|
url := anObject
|
||||||
]
|
]
|
||||||
|
@ -50,7 +50,7 @@ Markdown >> body: aString [
|
|||||||
{ #category : #operation }
|
{ #category : #operation }
|
||||||
Markdown >> commentYAMLMetadata [
|
Markdown >> commentYAMLMetadata [
|
||||||
| newContents |
|
| newContents |
|
||||||
self contents detectYAMLMetadata ifFalse: [ ^ self ].
|
self detectYAMLMetadata ifFalse: [ ^ self ].
|
||||||
newContents := '' writeStream.
|
newContents := '' writeStream.
|
||||||
newContents nextPutAll: '<!--@yaml'; lf.
|
newContents nextPutAll: '<!--@yaml'; lf.
|
||||||
newContents nextPutAll: self yamlMetadataString.
|
newContents nextPutAll: self yamlMetadataString.
|
||||||
@ -160,10 +160,7 @@ Markdown >> fromFile: aFileReference [
|
|||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
Markdown >> fromString: markdownString [
|
Markdown >> fromString: markdownString [
|
||||||
markdownString yamlMetadata
|
markdownString yamlMetadata
|
||||||
ifNotNil: [
|
ifNotNil: [(self metadata) at: 'original' put: markdownString yamlMetadata].
|
||||||
self metadata
|
|
||||||
ifEmpty: [self metadata: markdownString yamlMetadata]
|
|
||||||
ifNotEmpty: [self metadata at: 'original' put: markdownString yamlMetadata]].
|
|
||||||
self body: markdownString contentsWithoutYAMLMetadata
|
self body: markdownString contentsWithoutYAMLMetadata
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -193,7 +190,6 @@ Markdown >> lines [
|
|||||||
Markdown >> metadata [
|
Markdown >> metadata [
|
||||||
|
|
||||||
^ metadata ifNil: [ metadata := Dictionary new].
|
^ metadata ifNil: [ metadata := Dictionary new].
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -234,8 +230,3 @@ Markdown >> printOn: aStream [
|
|||||||
Markdown >> title [
|
Markdown >> title [
|
||||||
^ title ifNil: [ title:= self headerAsTitle ]
|
^ title ifNil: [ title:= self headerAsTitle ]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
Markdown >> title: aString [
|
|
||||||
title := aString
|
|
||||||
]
|
|
||||||
|
@ -147,11 +147,17 @@ Pandoc class >> markdownToHtmlOnUnix: inputFile [
|
|||||||
outputFile := inputFile parent / (inputFile basenameWithoutExtension , '.html').
|
outputFile := inputFile parent / (inputFile basenameWithoutExtension , '.html').
|
||||||
outputFile ensureDelete.
|
outputFile ensureDelete.
|
||||||
outputFile ensureCreateFile.
|
outputFile ensureCreateFile.
|
||||||
GtSubprocessWithInMemoryOutput new
|
OSSUnixSubprocess new
|
||||||
shellCommand: 'pandoc -f markdown+startnum+task_lists --standalone -t html ', inputFile fullName, ' --output ', outputFile fullName;
|
command: 'pandoc';
|
||||||
runAndWait;
|
arguments: {'-f'. 'markdown+startnum+task_lists'. '--standalone'. '-t'. 'html'. inputFile fullName.
|
||||||
stdout.
|
'--output'. outputFile fullName };
|
||||||
^ outputFile.
|
redirectStdout;
|
||||||
|
redirectStderr;
|
||||||
|
runAndWaitOnExitDo: [ :process :outString :errString |
|
||||||
|
process isSuccess
|
||||||
|
ifTrue: [ ^ outputFile ]
|
||||||
|
ifFalse: [ ^ inputFile ]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #converters }
|
{ #category : #converters }
|
||||||
|
Loading…
Reference in New Issue
Block a user