Reconvering Pandoc Markdown tranformation for node body.
This commit is contained in:
parent
fe3d9ff84c
commit
2690e93460
51
repository/Grafoscopio/GrafoscopioLinksList.class.st
Normal file
51
repository/Grafoscopio/GrafoscopioLinksList.class.st
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
"
|
||||||
|
I model the links of a GrafoscopioNode.
|
||||||
|
|
||||||
|
I'm responsable for showing the links and selecting them.
|
||||||
|
"
|
||||||
|
Class {
|
||||||
|
#name : #GrafoscopioLinksList,
|
||||||
|
#superclass : #ComposableModel,
|
||||||
|
#instVars : [
|
||||||
|
'links'
|
||||||
|
],
|
||||||
|
#category : #'Grafoscopio-UI'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : #specs }
|
||||||
|
GrafoscopioLinksList class >> defaultSpec [
|
||||||
|
^ SpecLayout composed
|
||||||
|
add: #links;
|
||||||
|
yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioLinksList >> content: aGrafoscopioNode [
|
||||||
|
links items: aGrafoscopioNode links
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
GrafoscopioLinksList >> initializeWidgets [
|
||||||
|
links := self newList.
|
||||||
|
self focusOrder add: links
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioLinksList >> links [
|
||||||
|
^ links
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
GrafoscopioLinksList >> links: anObject [
|
||||||
|
links := anObject
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #api }
|
||||||
|
GrafoscopioLinksList >> title [
|
||||||
|
^ 'Node links list'
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'api-events' }
|
||||||
|
GrafoscopioLinksList >> whenSelectedItemChanged: aBlock [
|
||||||
|
links whenSelectedItemChanged: aBlock
|
||||||
|
]
|
8
repository/Grafoscopio/GrafoscopioLinkstModel.class.st
Normal file
8
repository/Grafoscopio/GrafoscopioLinkstModel.class.st
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Class {
|
||||||
|
#name : #GrafoscopioLinkstModel,
|
||||||
|
#superclass : #ComposableModel,
|
||||||
|
#instVars : [
|
||||||
|
'links'
|
||||||
|
],
|
||||||
|
#category : #'Grafoscopio-UI'
|
||||||
|
}
|
@ -1073,3 +1073,38 @@ GrafoscopioNode >> visitedGoTo: aCollection [
|
|||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
GrafoscopioNode >> wrapBodyLines [
|
||||||
|
"I convert the node body from HTML format to Pandoc's Markdown."
|
||||||
|
| bodyFile |
|
||||||
|
(self isTaggedAs: 'código' ) ifTrue: [ ^self ].
|
||||||
|
bodyFile := FileLocator temp asFileReference / 'body.txt'.
|
||||||
|
bodyFile ensureCreateFile.
|
||||||
|
bodyFile writeStreamDo: [:out | out nextPutAll: self body ].
|
||||||
|
Smalltalk platformName = 'unix'
|
||||||
|
ifTrue: [ self body: (self wrapBodyLinesFor: bodyFile) ].
|
||||||
|
Smalltalk platformName = 'Win32'
|
||||||
|
ifTrue: [ self shouldBeImplemented ].
|
||||||
|
bodyFile ensureDelete.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
GrafoscopioNode >> wrapBodyLinesFor: inputFile [
|
||||||
|
| outputFile |
|
||||||
|
outputFile := FileLocator temp / 'body.tmp.txt'.
|
||||||
|
outputFile ensureDelete.
|
||||||
|
outputFile ensureCreateFile.
|
||||||
|
OSSUnixSubprocess new
|
||||||
|
command: 'fold';
|
||||||
|
arguments: {'-sw'. '80'. inputFile fullName. outputFile fullName};
|
||||||
|
redirectStdout;
|
||||||
|
redirectStderr;
|
||||||
|
runAndWaitOnExitDo: [ :process :outString :errString |
|
||||||
|
process isSuccess
|
||||||
|
ifTrue: [ ^ outString ]
|
||||||
|
ifFalse: [
|
||||||
|
self inform: errString.
|
||||||
|
^inputFile contents ]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
@ -427,11 +427,21 @@ GrafoscopioNotebook >> links: anObject [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'as yet unclassified' }
|
||||||
|
GrafoscopioNotebook >> linksList [
|
||||||
|
| currentNode |
|
||||||
|
currentNode := tree highlightedItem content.
|
||||||
|
GrafoscopioLinksList new
|
||||||
|
content: currentNode;
|
||||||
|
openWithSpec
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #utilities }
|
||||||
GrafoscopioNotebook >> listImagesUI [
|
GrafoscopioNotebook >> listImagesUI [
|
||||||
ListModel new
|
ListModel new
|
||||||
title: 'Images files list';
|
title: 'Images files list';
|
||||||
items: self imagesList ;
|
items: self imagesList ;
|
||||||
openWithSpec
|
openWithSpec
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
@ -951,6 +961,13 @@ GrafoscopioNotebook >> topBar [
|
|||||||
description: 'Toggle: code <--> text';
|
description: 'Toggle: code <--> text';
|
||||||
icon: MendaIcons new smalltalkCodeIcon;
|
icon: MendaIcons new smalltalkCodeIcon;
|
||||||
action: [ self toggleCodeNode ] ].
|
action: [ self toggleCodeNode ] ].
|
||||||
|
group
|
||||||
|
addItem: [ :item |
|
||||||
|
item
|
||||||
|
name: nil;
|
||||||
|
description: 'List node links';
|
||||||
|
icon: #tinyMenu asIcon;
|
||||||
|
action: [ self linksList ] ].
|
||||||
group
|
group
|
||||||
addItem: [ :item |
|
addItem: [ :item |
|
||||||
item
|
item
|
||||||
@ -1060,3 +1077,9 @@ GrafoscopioNotebook >> workingFile [
|
|||||||
GrafoscopioNotebook >> workingFile: aFileReference [
|
GrafoscopioNotebook >> workingFile: aFileReference [
|
||||||
workingFile := aFileReference.
|
workingFile := aFileReference.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
GrafoscopioNotebook >> wrapBodyLines [
|
||||||
|
self currentNodeContent wrapBodyLines.
|
||||||
|
self updateBodyFor: self currentNode
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user