Improving remote and local storage for TiddlyWiki.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-09-13 20:19:31 -05:00
parent b8b4c6863e
commit 7725213f7a
2 changed files with 50 additions and 1 deletions

View File

@ -9,7 +9,9 @@ Class {
#superclass : 'Object',
#instVars : [
'tiddlers',
'file'
'file',
'remote',
'name'
],
#category : 'TiddlyWiki-Model'
}
@ -53,6 +55,40 @@ TiddlyWiki >> importJSONFile [
])
]
{ #category : 'accessing' }
TiddlyWiki >> local [
^ self file
]
{ #category : 'accessing' }
TiddlyWiki >> local: aFileRefence [
^ self file:aFileRefence
]
{ #category : 'accessing' }
TiddlyWiki >> name [
^ name ifNil: [
self file
ifNil: [ | tempName suffix |
tempName := self remote file.
(tempName endsWithAnyOf: #('.html' '.htm'))
ifTrue: [
suffix := (tempName splitOn: '.') last.
tempName := tempName removeSuffix: '.', suffix.
].
name := tempName
]
ifNotNil: [ name := self file basenameWithoutExtension ]
]
]
{ #category : 'accessing' }
TiddlyWiki >> name: aString [
name := aString
]
{ #category : 'accessing' }
TiddlyWiki >> networkView [
| view |
@ -72,6 +108,18 @@ TiddlyWiki >> printOn: aStream [
nextPutAll: '( ', self file basename ,' )'
]
{ #category : 'accessing' }
TiddlyWiki >> remote [
^ remote
]
{ #category : 'accessing' }
TiddlyWiki >> remote: aUrlString [
remote := aUrlString asZnUrl
]
{ #category : 'accessing' }
TiddlyWiki >> taggedWith: aTag [
^ self tiddlers select: [:tiddler |

View File

@ -31,6 +31,7 @@ WikiText >> convertMarkdownBold [
{ #category : 'conversions' }
WikiText >> convertMarkdownLinks [
| markdownLinks markdownLinksRegex |
"\[([\w|\s]+)\]\((\S+)\)"
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 ].