Changing Tiddler creation time to make it closer to the expected value in TiddlyWiki (still needs to be debugged)
This commit is contained in:
parent
8894a61b12
commit
a4aad67179
@ -1,6 +1,6 @@
|
||||
Class {
|
||||
#name : 'FedWikiItem',
|
||||
#superclass : 'Object',
|
||||
#name : #FedWikiItem,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'text',
|
||||
'id',
|
||||
@ -9,26 +9,26 @@ Class {
|
||||
#category : 'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> fromDictionary: aDictionary [
|
||||
text := aDictionary at: 'text'.
|
||||
id := aDictionary at: 'id'.
|
||||
type := aDictionary at: 'type'.
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ',self type, ' | ', self text, ' )'
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> text [
|
||||
^ text
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiItem >> type [
|
||||
^ type
|
||||
]
|
||||
|
@ -1,6 +1,6 @@
|
||||
Class {
|
||||
#name : 'FedWikiPage',
|
||||
#superclass : 'Object',
|
||||
#name : #FedWikiPage,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'url',
|
||||
'title',
|
||||
@ -11,7 +11,7 @@ Class {
|
||||
#category : 'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> dataDictionary [
|
||||
| dataUrl |
|
||||
self isView ifFalse: [
|
||||
@ -21,34 +21,34 @@ FedWikiPage >> dataDictionary [
|
||||
^ STONJSON fromString: dataUrl asUrl retrieveContents
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> fromDataDictionary [
|
||||
title := self dataDictionary at: 'title'.
|
||||
story := self dataDictionary at: 'story'.
|
||||
self importJournal ifTrue: [ journal := self dataDictionary at: 'journal'].
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> host [
|
||||
^ self url host
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> importJournal [
|
||||
^ importJournal ifNil: [ importJournal := false ]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> importJournal: aBoolean [
|
||||
importJournal := aBoolean
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> isView [
|
||||
^ self url firstPathSegment = 'view'
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> jsonData [
|
||||
| dataUrl |
|
||||
self isView ifFalse: [
|
||||
@ -57,29 +57,29 @@ FedWikiPage >> jsonData [
|
||||
dataUrl := self scheme , '://', self host, self titleSegmentUrl, '.json'
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )'
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> scheme [
|
||||
^ self url scheme
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> story [
|
||||
^ story
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> title [
|
||||
^ title.
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> titleSegmentUrl [
|
||||
self isView ifFalse: [
|
||||
self inform: 'Please provide a view url for the FedWiki page.'.
|
||||
@ -87,12 +87,12 @@ FedWikiPage >> titleSegmentUrl [
|
||||
^ self url segments last.
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> url [
|
||||
^ url
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
FedWikiPage >> url: aString [
|
||||
url := aString asZnUrl
|
||||
]
|
||||
|
@ -5,8 +5,8 @@ I implement the standard fields as described in the standard documentation at: <
|
||||
|
||||
"
|
||||
Class {
|
||||
#name : 'Tiddler',
|
||||
#superclass : 'Object',
|
||||
#name : #Tiddler,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'title',
|
||||
'text',
|
||||
@ -23,16 +23,16 @@ Class {
|
||||
'bag',
|
||||
'revision'
|
||||
],
|
||||
#category : 'TiddlyWiki-Model'
|
||||
#category : #'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'instance creation' }
|
||||
{ #category : #'instance creation' }
|
||||
Tiddler class >> nowLocal [
|
||||
^ (ZTimestampFormat fromString: '200102031605067')
|
||||
^ (ZTimestampFormat fromString: '20010203160506700')
|
||||
format: (ZTimestamp fromString: Time nowLocal asDateAndTime asString)
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> asDictionary [
|
||||
| response |
|
||||
response := Dictionary new
|
||||
@ -55,23 +55,23 @@ Tiddler >> asDictionary [
|
||||
^ response
|
||||
]
|
||||
|
||||
{ #category : 'converting' }
|
||||
{ #category : #converting }
|
||||
Tiddler >> asJson [
|
||||
^ STONJSON toStringPretty: { self asDictionary }
|
||||
]
|
||||
|
||||
{ #category : 'converting' }
|
||||
{ #category : #converting }
|
||||
Tiddler >> asJsonString [
|
||||
^ STONJSON toStringPretty: self asDictionary
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> asJsonTempFile [
|
||||
^ MarkupFile exportAsFileOn: FileLocator temp / self title, 'json' containing:self asJson
|
||||
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> asStonStringPretty [
|
||||
| output temp |
|
||||
temp := self copy.
|
||||
@ -85,77 +85,77 @@ Tiddler >> asStonStringPretty [
|
||||
^ output contents
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> bag [
|
||||
^ bag
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> bag: aString [
|
||||
bag := aString
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> caption [
|
||||
|
||||
^ caption
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> caption: anObject [
|
||||
|
||||
caption := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> created [
|
||||
|
||||
^ created ifNil: [ created := DateAndTime now ]
|
||||
^ created ifNil: [ created := self class nowLocal ]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> created: anObject [
|
||||
|
||||
created := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> creator [
|
||||
|
||||
^ creator
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> creator: anObject [
|
||||
|
||||
creator := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> customFields [
|
||||
^ customFields ifNil: [ customFields := Dictionary new]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> exportJSONFile [
|
||||
| jsonFile |
|
||||
jsonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase,'.', self created asString, '.json').
|
||||
^ MarkupFile exportAsFileOn: jsonFile containing:self asJson
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> exportSTONFile [
|
||||
| stonFile output |
|
||||
stonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase, '.', self created asString, '.ston') .
|
||||
^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> exportWithTemplate: aTemplate [
|
||||
^ aTemplate asMustacheTemplate value: self asDictionary
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> fromDictionary: aDictionary [
|
||||
| customKeys |
|
||||
self
|
||||
@ -177,7 +177,7 @@ Tiddler >> fromDictionary: aDictionary [
|
||||
self customFields at: key put: (aDictionary at: key) ].
|
||||
]
|
||||
|
||||
{ #category : 'instance creation' }
|
||||
{ #category : #'instance creation' }
|
||||
Tiddler >> fromMarkdownParsedItems: aCollection [
|
||||
| outputStream |
|
||||
outputStream := '' writeStream.
|
||||
@ -190,7 +190,7 @@ Tiddler >> fromMarkdownParsedItems: aCollection [
|
||||
]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> importFedWikiPage: pageViewUrlString [
|
||||
| pageTitle pageViewUrl pageData |
|
||||
pageViewUrl := pageViewUrlString asZnUrl.
|
||||
@ -199,7 +199,7 @@ Tiddler >> importFedWikiPage: pageViewUrlString [
|
||||
^ STONJSON fromString: pageData retrieveContents
|
||||
]
|
||||
|
||||
{ #category : 'utilities' }
|
||||
{ #category : #utilities }
|
||||
Tiddler >> itemContentsStringFor: item into: stream [
|
||||
stream
|
||||
nextPutAll: item text;
|
||||
@ -207,7 +207,7 @@ Tiddler >> itemContentsStringFor: item into: stream [
|
||||
nextPut: Character cr
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> linkedTiddlers [
|
||||
"At the begining we are going to introduce 'pureTiddlers' as thos included in the wiki which are not linked
|
||||
via aliases. Future versions of this method sould included internal aliased tiddlers."
|
||||
@ -216,19 +216,19 @@ Tiddler >> linkedTiddlers [
|
||||
^ self wiki tiddlers select: [:tiddler | pureTiddlersTitles includes: tiddler title ].
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> list [
|
||||
|
||||
^ list
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> list: anObject [
|
||||
|
||||
list := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> listedTiddlers [
|
||||
"I export all tiddlers in the list field as an alphabetic collection.
|
||||
Future versions should preserve the order in the list."
|
||||
@ -244,13 +244,13 @@ Tiddler >> listedTiddlers [
|
||||
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> manualLinksList [
|
||||
self list ifNil: [^ nil].
|
||||
^ WikiTextGrammar new linkSea star parse: self list.
|
||||
]
|
||||
|
||||
{ #category : 'utilities' }
|
||||
{ #category : #utilities }
|
||||
Tiddler >> markdownLinksAsWikiText [
|
||||
"I'm useful to convert _internal_ links between formats, as is a common pattern
|
||||
found when migrating content from Markdown to TiddlyWiki's WikiText.
|
||||
@ -264,111 +264,111 @@ Tiddler >> markdownLinksAsWikiText [
|
||||
^ markdownLinks
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> modified [
|
||||
|
||||
^ modified
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> modified: anObject [
|
||||
|
||||
modified := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> modifier [
|
||||
|
||||
^ modifier
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> modifier: anObject [
|
||||
|
||||
modifier := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ', self title, ' )'
|
||||
]
|
||||
|
||||
{ #category : 'as yet unclassified' }
|
||||
{ #category : #'as yet unclassified' }
|
||||
Tiddler >> rawAliasedLinks [
|
||||
^ self rawLinks select: [ :each | each includesSubstring: '|' ]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> rawLinks [
|
||||
^ (WikiTextGrammar new linkSea star parse: self text) asSet
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> revision [
|
||||
^ revision
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> revision: aNumberString [
|
||||
revision := aNumberString
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> tags [
|
||||
|
||||
^ tags
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> tags: anObject [
|
||||
|
||||
tags := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> text [
|
||||
|
||||
^ text
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> text: anObject [
|
||||
|
||||
text := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> title [
|
||||
|
||||
^ title
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> title: anObject [
|
||||
|
||||
title := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> type [
|
||||
|
||||
^ type
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> type: anObject [
|
||||
|
||||
type := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> wiki [
|
||||
^ wiki
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
Tiddler >> wiki: aTiddlyWiki [
|
||||
wiki := aTiddlyWiki
|
||||
]
|
||||
|
@ -5,8 +5,8 @@ More information:
|
||||
https://tiddlywiki.com/
|
||||
"
|
||||
Class {
|
||||
#name : 'TiddlyWiki',
|
||||
#superclass : 'Object',
|
||||
#name : #TiddlyWiki,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'tiddlers',
|
||||
'file',
|
||||
@ -16,7 +16,7 @@ Class {
|
||||
#category : 'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> addToConfigFile [
|
||||
| cleaned |
|
||||
cleaned := self copy.
|
||||
@ -27,12 +27,12 @@ TiddlyWiki >> addToConfigFile [
|
||||
MarkupFile exportAsFileOn: self configFile containing:(STON toStringPretty: self configDictonary)
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> configDictonary [
|
||||
^ STONJSON fromString: self configFile contents.
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> configFile [
|
||||
| tempFile |
|
||||
tempFile := FileLocator home / '.config' / 'TiddlyWikiPharo' / 'tiddlywiki.conf.ston'.
|
||||
@ -44,12 +44,12 @@ TiddlyWiki >> configFile [
|
||||
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection [
|
||||
^ MarkupFile exportAsFileOn: self file parent / 'subtiddlers.json' containing: (self jsonSubtiddlers: subtiddlersCollection)
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> exportSTONFile [
|
||||
| stonFile output |
|
||||
stonFile := self tiddlersJSONFile withoutExtension, 'ston'.
|
||||
@ -62,17 +62,17 @@ TiddlyWiki >> exportSTONFile [
|
||||
^ MarkupFile exportAsFileOn: stonFile containing:output contents
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> file [
|
||||
^ file
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> file: anObject [
|
||||
file := anObject
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> importJSONFile [
|
||||
"I import a JSON representation of my tiddlers data, that has been previosly exported
|
||||
by the TiddlyWiki HTML self contained file.
|
||||
@ -88,30 +88,30 @@ TiddlyWiki >> importJSONFile [
|
||||
])
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> jsonSubtiddlers: subtiddlersCollection [
|
||||
| subtiddlersDict |
|
||||
subtiddlersDict := subtiddlersCollection collect: [:tiddler | tiddler asDictionary ].
|
||||
^ STONJSON toStringPretty: subtiddlersDict
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> loadFromConfig: wikiname [
|
||||
^ self configDictonary at: wikiname.
|
||||
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> local [
|
||||
^ self file
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> local: aFileRefence [
|
||||
^ self file:aFileRefence
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> name [
|
||||
| tempName suffix |
|
||||
name ifNotNil: [ ^ name ].
|
||||
@ -125,13 +125,13 @@ TiddlyWiki >> name [
|
||||
name := tempName
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> name: aString [
|
||||
|
||||
name := aString
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> networkView [
|
||||
| view |
|
||||
view := GtMondrian new.
|
||||
@ -143,45 +143,45 @@ TiddlyWiki >> networkView [
|
||||
^ view
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> printOn: aStream [
|
||||
super printOn: aStream.
|
||||
aStream
|
||||
nextPutAll: '( ', self file basename ,' )'
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> remote [
|
||||
|
||||
^ remote
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> remote: aUrlString [
|
||||
|
||||
remote := aUrlString asZnUrl
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> taggedWith: aTag [
|
||||
^ self tiddlers select: [:tiddler |
|
||||
tiddler tags isNotNil and: [tiddler tags includesSubstring: aTag ]
|
||||
]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> tiddlers [
|
||||
|
||||
^ tiddlers ifNil: [ tiddlers := OrderedCollection new ]
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> tiddlers: anOrderedCollection [
|
||||
|
||||
tiddlers := anOrderedCollection
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> tiddlersJSONFile [
|
||||
| jsonFile |
|
||||
file ifNil: [
|
||||
|
@ -1,34 +1,34 @@
|
||||
Class {
|
||||
#name : 'WikiText',
|
||||
#superclass : 'Object',
|
||||
#name : #WikiText,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'content'
|
||||
],
|
||||
#category : 'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiText >> content [
|
||||
^ content
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiText >> content: aString [
|
||||
content := aString
|
||||
]
|
||||
|
||||
{ #category : 'conversions' }
|
||||
{ #category : #conversions }
|
||||
WikiText >> converMarkdownBold [
|
||||
self content: (self content copyReplaceAll: '**' with: '''''').
|
||||
]
|
||||
|
||||
{ #category : 'conversions' }
|
||||
{ #category : #conversions }
|
||||
WikiText >> convertMarkdownBold [
|
||||
self content: (self content copyReplaceAll: '**' with: '''''').
|
||||
^ self.
|
||||
]
|
||||
|
||||
{ #category : 'conversions' }
|
||||
{ #category : #conversions }
|
||||
WikiText >> convertMarkdownLinks [
|
||||
| markdownLinks markdownLinksRegex |
|
||||
"\[([\w|\s]+)\]\((\S+)\)"
|
||||
@ -45,7 +45,7 @@ WikiText >> convertMarkdownLinks [
|
||||
^ self content
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiText >> sample [
|
||||
^ 'The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Class {
|
||||
#name : 'WikiTextGrammar',
|
||||
#superclass : 'PP2CompositeNode',
|
||||
#name : #WikiTextGrammar,
|
||||
#superclass : #PP2CompositeNode,
|
||||
#instVars : [
|
||||
'document',
|
||||
'link',
|
||||
@ -11,37 +11,37 @@ Class {
|
||||
#category : 'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> document [
|
||||
^ link islandInSea star
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> link [
|
||||
^ linkOpen, linkContent, linkClose ==> #second
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> linkClose [
|
||||
^ ']]' asPParser
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> linkContent [
|
||||
^ #any asPParser starLazy flatten
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> linkOpen [
|
||||
^ '[[' asPParser
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> linkSea [
|
||||
^ link sea ==> #second
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammar >> start [
|
||||
^ document
|
||||
]
|
||||
|
@ -1,15 +1,15 @@
|
||||
Class {
|
||||
#name : 'WikiTextGrammarTest',
|
||||
#superclass : 'PP2CompositeNodeTest',
|
||||
#name : #WikiTextGrammarTest,
|
||||
#superclass : #PP2CompositeNodeTest,
|
||||
#category : 'TiddlyWiki-Model'
|
||||
}
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammarTest >> parserClass [
|
||||
^ WikiTextGrammar
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammarTest >> testDocument [
|
||||
| input |
|
||||
input := WikiText new sample.
|
||||
@ -17,7 +17,7 @@ WikiTextGrammarTest >> testDocument [
|
||||
self assert: result size equals: 2
|
||||
]
|
||||
|
||||
{ #category : 'accessing' }
|
||||
{ #category : #accessing }
|
||||
WikiTextGrammarTest >> testLink [
|
||||
self
|
||||
parse: '[[Just testing]]'
|
||||
|
@ -1 +1 @@
|
||||
Package { #name : 'TiddlyWiki' }
|
||||
Package { #name : #TiddlyWiki }
|
||||
|
Loading…
Reference in New Issue
Block a user