Fixed encoding bug in htmlToMarkdown.
This commit is contained in:
parent
b2c8d2bfdf
commit
bab4ab7fb9
@ -505,20 +505,22 @@ GrafoscopioNode >> headers [
|
||||
{ #category : #operation }
|
||||
GrafoscopioNode >> htmlToMarkdown [
|
||||
"I convert the node body from HTML format to Pandoc's Markdown."
|
||||
| htmlFile |
|
||||
| htmlFile markdownFile |
|
||||
|
||||
(self isTaggedAs: 'código' ) ifTrue: [ ^self ].
|
||||
((self headerStartsWith: '%invisible') or:[self hasAncestorHeaderWith: '%invisible'])
|
||||
((self headerStartsWith: '%invisible') "or:[self hasAncestorHeaderWith: '%invisible']")
|
||||
ifTrue: [ ^self ].
|
||||
|
||||
htmlFile := FileLocator temp asFileReference / 'body.html'.
|
||||
htmlFile ensureDelete.
|
||||
htmlFile ensureCreateFile.
|
||||
htmlFile writeStreamDo: [:stream | stream nextPutAll: self body].
|
||||
|
||||
self body: (PipeableOSProcess command: 'pandoc -f html -t markdown --atx-headers ', htmlFile fullName) output.
|
||||
markdownFile := FileLocator temp asFileReference / 'body.markdown'.
|
||||
markdownFile ensureDelete.
|
||||
htmlFile writeStreamDo: [:out | out nextPutAll: self body ].
|
||||
OSProcess
|
||||
waitForCommand: 'pandoc -f html -t markdown --atx-headers ',
|
||||
htmlFile fullName, ' -o ', markdownFile fullName.
|
||||
self body: markdownFile contents.
|
||||
htmlFile ensureDelete.
|
||||
|
||||
markdownFile ensureDelete.
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
@ -887,16 +889,6 @@ GrafoscopioNode >> publish [
|
||||
self inform: publishedUrl , ' was published and the url was copied to clipboard'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
GrafoscopioNode >> remoteRepository [
|
||||
^ remoteRepository
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
GrafoscopioNode >> remoteRepository: anObject [
|
||||
remoteRepository := anObject
|
||||
]
|
||||
|
||||
{ #category : #'add/remove nodes' }
|
||||
GrafoscopioNode >> removeLastNode [
|
||||
"Adds the given node to the receivers collection of children, and sets this object as the parent
|
||||
@ -915,6 +907,11 @@ GrafoscopioNode >> removeNode: aNode [
|
||||
|
||||
]
|
||||
|
||||
{ #category : #utility }
|
||||
GrafoscopioNode >> replaceAccentedHTMLChars [
|
||||
self body: (self body copyReplaceAll: 'í' with: 'í' )
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
GrafoscopioNode >> root [
|
||||
"I return the root node of the Grafoscopio tree, i.e the common ancestor of all other nodes"
|
||||
|
Loading…
Reference in New Issue
Block a user