Default Markdown and webView for DataFrames.
This commit is contained in:
parent
da4c9bf9c4
commit
6832d9024d
@ -1,5 +1,26 @@
|
||||
Extension { #name : #DataFrame }
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
DataFrame >> asMarkdown [
|
||||
| response |
|
||||
response := '' writeStream.
|
||||
self columnNames do: [ :name | response nextPutAll: '| ' , name , ' ' ].
|
||||
response
|
||||
nextPutAll: '|';
|
||||
cr.
|
||||
self columns size timesRepeat: [ response nextPutAll: '|---' ].
|
||||
response
|
||||
nextPutAll: '|';
|
||||
cr.
|
||||
self asArrayOfRows
|
||||
do: [ :row |
|
||||
row do: [ :cell | response nextPutAll: '| ' , cell asString , ' ' ].
|
||||
response
|
||||
nextPutAll: '|';
|
||||
cr ].
|
||||
^ response contents withInternetLineEndings.
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
DataFrame >> viewDataFor: aView [
|
||||
<gtView>
|
||||
@ -17,3 +38,9 @@ DataFrame >> viewDataFor: aView [
|
||||
].
|
||||
^ columnedList
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
DataFrame >> webView [
|
||||
|
||||
^ Pandoc convertString: self asMarkdown from: 'markdown' to: 'html'
|
||||
]
|
||||
|
@ -10,6 +10,16 @@ Class {
|
||||
#category : #'MiniDocs-Core'
|
||||
}
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
Pandoc class >> convertString: aString from: inputFormat to: outputFormat [
|
||||
OSSUnixSubprocess new
|
||||
shellCommand: 'echo "', aString , '" | pandoc -f ', inputFormat,' -t ', outputFormat;
|
||||
redirectStdout;
|
||||
runAndWaitOnExitDo: [ :command :outString |
|
||||
^ outString
|
||||
].
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
Pandoc class >> downloadLuaFilters [
|
||||
self luaFilters do: [ :filter | | filterUrl |
|
||||
|
11
src/MiniDocs/Pandoc.extension.st
Normal file
11
src/MiniDocs/Pandoc.extension.st
Normal file
@ -0,0 +1,11 @@
|
||||
Extension { #name : #Pandoc }
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
Pandoc class >> convertString: aString from: inputFormat to: outputFormat [
|
||||
OSSUnixSubprocess new
|
||||
shellCommand: 'echo "', aString , '" | pandoc -f ', inputFormat,' -t ', outputFormat;
|
||||
redirectStdout;
|
||||
runAndWaitOnExitDo: [ :command :outString |
|
||||
^ outString
|
||||
].
|
||||
]
|
Loading…
Reference in New Issue
Block a user