Improving Markdeep and Markdown document tree readings with more renders and linefeed bugfix.
This commit is contained in:
parent
093f989e28
commit
2dd4377c4d
@ -55,13 +55,6 @@ HedgeDoc >> defaultServer [
|
||||
self server: 'https://docutopia.tupale.co'.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
HedgeDoc >> documentTree [
|
||||
| parser|
|
||||
parser := PPCommonMarkBlockParser new parse: self contents.
|
||||
^ parser accept: CMBlockVisitor new
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
HedgeDoc >> htmlUrl [
|
||||
| link |
|
||||
|
@ -213,7 +213,9 @@ Markdeep >> markdeepScriptTag [
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdeep >> markdownFile [
|
||||
^ self file ifNil: [ self file: FileLocator temp / ('untitled--', NanoID generate, '.md')].
|
||||
self file ifNil: [
|
||||
self file: FileLocator temp / ('untitled--', NanoID generate, '.md.html') ].
|
||||
^ (self file fullName withoutSuffix: '.html') asFileReference.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -276,10 +278,10 @@ Markdeep >> printOn: aStream [
|
||||
Markdeep >> processMarkdownFor: aFileReference [
|
||||
"comment stating purpose of message"
|
||||
| markdownContent |
|
||||
self markdownFile: aFileReference.
|
||||
self file: aFileReference, 'html'.
|
||||
markdownContent := Markdown fromFile: aFileReference.
|
||||
self metadata: markdownContent yamlMetadata.
|
||||
self body: (markdownContent commentYAMLMetadata contents).
|
||||
self metadata: markdownContent yamlMetadata
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -30,12 +30,12 @@ Markdown >> commentYAMLMetadata [
|
||||
| newContents |
|
||||
self detectYAMLMetadata ifFalse: [ ^ self ].
|
||||
newContents := '' writeStream.
|
||||
newContents nextPutAll: '<!--@yaml:'; crlf.
|
||||
newContents nextPutAll: '<!--@yaml'; lf.
|
||||
newContents nextPutAll: self yamlMetadataString.
|
||||
newContents nextPutAll: String cr.
|
||||
newContents nextPutAll: '-->'; crlf.
|
||||
newContents nextPutAll: String lf.
|
||||
newContents nextPutAll: '-->'; lf; lf.
|
||||
(self lines copyFrom: self yamlMetadataClosingLineNumber + 2 to: self lines size) do: [ :line |
|
||||
newContents nextPutAll: line; crlf ].
|
||||
newContents nextPutAll: line; lf;lf ].
|
||||
^ newContents contents.
|
||||
]
|
||||
|
||||
@ -64,6 +64,16 @@ Markdown >> contentsWithoutYAMLMetadata [
|
||||
^ newContents contents.
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
Markdown >> deleteYAMLMetadata [
|
||||
| newContents |
|
||||
self detectYAMLMetadata ifFalse: [ ^ self ].
|
||||
newContents := '' writeStream.
|
||||
(self lines copyFrom: self yamlMetadataClosingLineNumber + 1 to: self lines size) do: [ :line |
|
||||
newContents nextPutAll: line; lf;lf ].
|
||||
^ newContents contents.
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
Markdown >> detectYAMLMetadata [
|
||||
| lines |
|
||||
@ -74,6 +84,13 @@ Markdown >> detectYAMLMetadata [
|
||||
ifFound: [ ^ true ] ifNone: [ ^ false ] ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Markdown >> documentTree [
|
||||
| parser|
|
||||
parser := PPCommonMarkBlockParser new parse: self contents.
|
||||
^ parser accept: CMBlockVisitor new
|
||||
]
|
||||
|
||||
{ #category : #persistence }
|
||||
Markdown >> exportAsFile [
|
||||
| newFile |
|
||||
@ -222,7 +239,7 @@ Markdown >> yamlMetadataString [
|
||||
yamlLines do: [ :line |
|
||||
output
|
||||
nextPutAll: line;
|
||||
nextPut: Character cr. ].
|
||||
nextPut: Character lf. ].
|
||||
^ output contents
|
||||
]
|
||||
|
||||
|
@ -8,3 +8,25 @@ Class {
|
||||
PPCMEmphasize >> accept: visitor [
|
||||
^ visitor visitEmphasize: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PPCMEmphasize >> viewBody [
|
||||
| aText |
|
||||
aText := (self className ,' ', self text) asRopedText.
|
||||
|
||||
self children do: [ :child |
|
||||
aText append: ' ' asRopedText.
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: ('= "' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append:
|
||||
('"' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor)
|
||||
].
|
||||
|
||||
|
||||
^ aText
|
||||
]
|
||||
|
@ -8,3 +8,25 @@ Class {
|
||||
PPCMHardBreak >> accept: visitor [
|
||||
^ visitor visitHardBreak: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PPCMHardBreak >> viewBody [
|
||||
| aText |
|
||||
aText := (self className ,' ', self text) asRopedText.
|
||||
|
||||
self children do: [ :child |
|
||||
aText append: ' ' asRopedText.
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: ('= "' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append:
|
||||
('"' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor)
|
||||
].
|
||||
|
||||
|
||||
^ aText
|
||||
]
|
||||
|
@ -13,3 +13,25 @@ PPCMHtmlBlock >> accept: visitor [
|
||||
PPCMHtmlBlock >> isBlockLevel [
|
||||
^ true
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PPCMHtmlBlock >> viewBody [
|
||||
| aText |
|
||||
aText := (self className ,' ', self text) asRopedText.
|
||||
|
||||
self children do: [ :child |
|
||||
aText append: ' ' asRopedText.
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: ('= "' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append:
|
||||
('"' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor)
|
||||
].
|
||||
|
||||
|
||||
^ aText
|
||||
]
|
||||
|
@ -18,3 +18,25 @@ PPCMIndentedCode >> code [
|
||||
PPCMIndentedCode >> isBlockLevel [
|
||||
^ true
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
PPCMIndentedCode >> viewBody [
|
||||
| aText |
|
||||
aText := (self className ,' ', self text) asRopedText.
|
||||
|
||||
self children do: [ :child |
|
||||
aText append: ' ' asRopedText.
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: ('= "' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append: (child text asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor).
|
||||
aText append:
|
||||
('"' asRopedText foreground:
|
||||
BrGlamorousColors disabledButtonTextColor)
|
||||
].
|
||||
|
||||
|
||||
^ aText
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user