Temporal cleaning for conflict resolution.
This commit is contained in:
parent
d83ae0f878
commit
fe68a9976c
@ -16,19 +16,3 @@ WikiText >> content [
|
||||
WikiText >> content: aString [
|
||||
content := aString
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WikiText >> convertMarkdownLinks [
|
||||
| markdownLinks markdownLinksRegex |
|
||||
markdownLinksRegex := '\[([\w|\s]+)\]\((\S+)\)'.
|
||||
"For the explanation of the Regex details see: http://scottradcliff.com/how-to-parse-urls-in-markdown.html"
|
||||
markdownLinks := self content regex: markdownLinksRegex matchesCollect: [:link | link ].
|
||||
markdownLinks ifEmpty: [^ self content ].
|
||||
markdownLinks do: [:markdownLink | | linkText closingLinkIndex newContent |
|
||||
closingLinkIndex := markdownLink indexOf: $].
|
||||
linkText := markdownLink copyFrom: 2 to: closingLinkIndex.
|
||||
newContent := self content copyReplaceAll: markdownLink with: '[[', linkText, ']'.
|
||||
self content: newContent.
|
||||
].
|
||||
^ self content
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user