Changing Tiddler creation time to make it closer to the expected value in TiddlyWiki (still needs to be debugged)

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-10-19 18:23:57 -05:00
parent 8894a61b12
commit a4aad67179
8 changed files with 121 additions and 121 deletions

View File

@ -1,6 +1,6 @@
Class { Class {
#name : 'FedWikiItem', #name : #FedWikiItem,
#superclass : 'Object', #superclass : #Object,
#instVars : [ #instVars : [
'text', 'text',
'id', 'id',
@ -9,26 +9,26 @@ Class {
#category : 'TiddlyWiki-Model' #category : 'TiddlyWiki-Model'
} }
{ #category : 'accessing' } { #category : #accessing }
FedWikiItem >> fromDictionary: aDictionary [ FedWikiItem >> fromDictionary: aDictionary [
text := aDictionary at: 'text'. text := aDictionary at: 'text'.
id := aDictionary at: 'id'. id := aDictionary at: 'id'.
type := aDictionary at: 'type'. type := aDictionary at: 'type'.
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiItem >> printOn: aStream [ FedWikiItem >> printOn: aStream [
super printOn: aStream. super printOn: aStream.
aStream aStream
nextPutAll: '( ',self type, ' | ', self text, ' )' nextPutAll: '( ',self type, ' | ', self text, ' )'
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiItem >> text [ FedWikiItem >> text [
^ text ^ text
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiItem >> type [ FedWikiItem >> type [
^ type ^ type
] ]

View File

@ -1,6 +1,6 @@
Class { Class {
#name : 'FedWikiPage', #name : #FedWikiPage,
#superclass : 'Object', #superclass : #Object,
#instVars : [ #instVars : [
'url', 'url',
'title', 'title',
@ -11,7 +11,7 @@ Class {
#category : 'TiddlyWiki-Model' #category : 'TiddlyWiki-Model'
} }
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> dataDictionary [ FedWikiPage >> dataDictionary [
| dataUrl | | dataUrl |
self isView ifFalse: [ self isView ifFalse: [
@ -21,34 +21,34 @@ FedWikiPage >> dataDictionary [
^ STONJSON fromString: dataUrl asUrl retrieveContents ^ STONJSON fromString: dataUrl asUrl retrieveContents
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> fromDataDictionary [ FedWikiPage >> fromDataDictionary [
title := self dataDictionary at: 'title'. title := self dataDictionary at: 'title'.
story := self dataDictionary at: 'story'. story := self dataDictionary at: 'story'.
self importJournal ifTrue: [ journal := self dataDictionary at: 'journal']. self importJournal ifTrue: [ journal := self dataDictionary at: 'journal'].
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> host [ FedWikiPage >> host [
^ self url host ^ self url host
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> importJournal [ FedWikiPage >> importJournal [
^ importJournal ifNil: [ importJournal := false ] ^ importJournal ifNil: [ importJournal := false ]
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> importJournal: aBoolean [ FedWikiPage >> importJournal: aBoolean [
importJournal := aBoolean importJournal := aBoolean
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> isView [ FedWikiPage >> isView [
^ self url firstPathSegment = 'view' ^ self url firstPathSegment = 'view'
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> jsonData [ FedWikiPage >> jsonData [
| dataUrl | | dataUrl |
self isView ifFalse: [ self isView ifFalse: [
@ -57,29 +57,29 @@ FedWikiPage >> jsonData [
dataUrl := self scheme , '://', self host, self titleSegmentUrl, '.json' dataUrl := self scheme , '://', self host, self titleSegmentUrl, '.json'
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> printOn: aStream [ FedWikiPage >> printOn: aStream [
super printOn: aStream. super printOn: aStream.
aStream aStream
nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )' nextPutAll: '( ', self title, ' | ', self story size asString, ' items story )'
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> scheme [ FedWikiPage >> scheme [
^ self url scheme ^ self url scheme
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> story [ FedWikiPage >> story [
^ story ^ story
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> title [ FedWikiPage >> title [
^ title. ^ title.
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> titleSegmentUrl [ FedWikiPage >> titleSegmentUrl [
self isView ifFalse: [ self isView ifFalse: [
self inform: 'Please provide a view url for the FedWiki page.'. self inform: 'Please provide a view url for the FedWiki page.'.
@ -87,12 +87,12 @@ FedWikiPage >> titleSegmentUrl [
^ self url segments last. ^ self url segments last.
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> url [ FedWikiPage >> url [
^ url ^ url
] ]
{ #category : 'accessing' } { #category : #accessing }
FedWikiPage >> url: aString [ FedWikiPage >> url: aString [
url := aString asZnUrl url := aString asZnUrl
] ]

View File

@ -5,8 +5,8 @@ I implement the standard fields as described in the standard documentation at: <
" "
Class { Class {
#name : 'Tiddler', #name : #Tiddler,
#superclass : 'Object', #superclass : #Object,
#instVars : [ #instVars : [
'title', 'title',
'text', 'text',
@ -23,16 +23,16 @@ Class {
'bag', 'bag',
'revision' 'revision'
], ],
#category : 'TiddlyWiki-Model' #category : #'TiddlyWiki-Model'
} }
{ #category : 'instance creation' } { #category : #'instance creation' }
Tiddler class >> nowLocal [ Tiddler class >> nowLocal [
^ (ZTimestampFormat fromString: '200102031605067') ^ (ZTimestampFormat fromString: '20010203160506700')
format: (ZTimestamp fromString: Time nowLocal asDateAndTime asString) format: (ZTimestamp fromString: Time nowLocal asDateAndTime asString)
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> asDictionary [ Tiddler >> asDictionary [
| response | | response |
response := Dictionary new response := Dictionary new
@ -55,23 +55,23 @@ Tiddler >> asDictionary [
^ response ^ response
] ]
{ #category : 'converting' } { #category : #converting }
Tiddler >> asJson [ Tiddler >> asJson [
^ STONJSON toStringPretty: { self asDictionary } ^ STONJSON toStringPretty: { self asDictionary }
] ]
{ #category : 'converting' } { #category : #converting }
Tiddler >> asJsonString [ Tiddler >> asJsonString [
^ STONJSON toStringPretty: self asDictionary ^ STONJSON toStringPretty: self asDictionary
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> asJsonTempFile [ Tiddler >> asJsonTempFile [
^ MarkupFile exportAsFileOn: FileLocator temp / self title, 'json' containing:self asJson ^ MarkupFile exportAsFileOn: FileLocator temp / self title, 'json' containing:self asJson
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> asStonStringPretty [ Tiddler >> asStonStringPretty [
| output temp | | output temp |
temp := self copy. temp := self copy.
@ -85,77 +85,77 @@ Tiddler >> asStonStringPretty [
^ output contents ^ output contents
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> bag [ Tiddler >> bag [
^ bag ^ bag
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> bag: aString [ Tiddler >> bag: aString [
bag := aString bag := aString
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> caption [ Tiddler >> caption [
^ caption ^ caption
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> caption: anObject [ Tiddler >> caption: anObject [
caption := anObject caption := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> created [ Tiddler >> created [
^ created ifNil: [ created := DateAndTime now ] ^ created ifNil: [ created := self class nowLocal ]
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> created: anObject [ Tiddler >> created: anObject [
created := anObject created := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> creator [ Tiddler >> creator [
^ creator ^ creator
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> creator: anObject [ Tiddler >> creator: anObject [
creator := anObject creator := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> customFields [ Tiddler >> customFields [
^ customFields ifNil: [ customFields := Dictionary new] ^ customFields ifNil: [ customFields := Dictionary new]
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> exportJSONFile [ Tiddler >> exportJSONFile [
| jsonFile | | jsonFile |
jsonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase,'.', self created asString, '.json'). jsonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase,'.', self created asString, '.json').
^ MarkupFile exportAsFileOn: jsonFile containing:self asJson ^ MarkupFile exportAsFileOn: jsonFile containing:self asJson
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> exportSTONFile [ Tiddler >> exportSTONFile [
| stonFile output | | stonFile output |
stonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase, '.', self created asString, '.ston') . stonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase, '.', self created asString, '.ston') .
^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty ^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> exportWithTemplate: aTemplate [ Tiddler >> exportWithTemplate: aTemplate [
^ aTemplate asMustacheTemplate value: self asDictionary ^ aTemplate asMustacheTemplate value: self asDictionary
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> fromDictionary: aDictionary [ Tiddler >> fromDictionary: aDictionary [
| customKeys | | customKeys |
self self
@ -177,7 +177,7 @@ Tiddler >> fromDictionary: aDictionary [
self customFields at: key put: (aDictionary at: key) ]. self customFields at: key put: (aDictionary at: key) ].
] ]
{ #category : 'instance creation' } { #category : #'instance creation' }
Tiddler >> fromMarkdownParsedItems: aCollection [ Tiddler >> fromMarkdownParsedItems: aCollection [
| outputStream | | outputStream |
outputStream := '' writeStream. outputStream := '' writeStream.
@ -190,7 +190,7 @@ Tiddler >> fromMarkdownParsedItems: aCollection [
] ]
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> importFedWikiPage: pageViewUrlString [ Tiddler >> importFedWikiPage: pageViewUrlString [
| pageTitle pageViewUrl pageData | | pageTitle pageViewUrl pageData |
pageViewUrl := pageViewUrlString asZnUrl. pageViewUrl := pageViewUrlString asZnUrl.
@ -199,7 +199,7 @@ Tiddler >> importFedWikiPage: pageViewUrlString [
^ STONJSON fromString: pageData retrieveContents ^ STONJSON fromString: pageData retrieveContents
] ]
{ #category : 'utilities' } { #category : #utilities }
Tiddler >> itemContentsStringFor: item into: stream [ Tiddler >> itemContentsStringFor: item into: stream [
stream stream
nextPutAll: item text; nextPutAll: item text;
@ -207,7 +207,7 @@ Tiddler >> itemContentsStringFor: item into: stream [
nextPut: Character cr nextPut: Character cr
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> linkedTiddlers [ Tiddler >> linkedTiddlers [
"At the begining we are going to introduce 'pureTiddlers' as thos included in the wiki which are not linked "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." 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 ]. ^ self wiki tiddlers select: [:tiddler | pureTiddlersTitles includes: tiddler title ].
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> list [ Tiddler >> list [
^ list ^ list
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> list: anObject [ Tiddler >> list: anObject [
list := anObject list := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> listedTiddlers [ Tiddler >> listedTiddlers [
"I export all tiddlers in the list field as an alphabetic collection. "I export all tiddlers in the list field as an alphabetic collection.
Future versions should preserve the order in the list." Future versions should preserve the order in the list."
@ -244,13 +244,13 @@ Tiddler >> listedTiddlers [
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> manualLinksList [ Tiddler >> manualLinksList [
self list ifNil: [^ nil]. self list ifNil: [^ nil].
^ WikiTextGrammar new linkSea star parse: self list. ^ WikiTextGrammar new linkSea star parse: self list.
] ]
{ #category : 'utilities' } { #category : #utilities }
Tiddler >> markdownLinksAsWikiText [ Tiddler >> markdownLinksAsWikiText [
"I'm useful to convert _internal_ links between formats, as is a common pattern "I'm useful to convert _internal_ links between formats, as is a common pattern
found when migrating content from Markdown to TiddlyWiki's WikiText. found when migrating content from Markdown to TiddlyWiki's WikiText.
@ -264,111 +264,111 @@ Tiddler >> markdownLinksAsWikiText [
^ markdownLinks ^ markdownLinks
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> modified [ Tiddler >> modified [
^ modified ^ modified
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> modified: anObject [ Tiddler >> modified: anObject [
modified := anObject modified := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> modifier [ Tiddler >> modifier [
^ modifier ^ modifier
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> modifier: anObject [ Tiddler >> modifier: anObject [
modifier := anObject modifier := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> printOn: aStream [ Tiddler >> printOn: aStream [
super printOn: aStream. super printOn: aStream.
aStream aStream
nextPutAll: '( ', self title, ' )' nextPutAll: '( ', self title, ' )'
] ]
{ #category : 'as yet unclassified' } { #category : #'as yet unclassified' }
Tiddler >> rawAliasedLinks [ Tiddler >> rawAliasedLinks [
^ self rawLinks select: [ :each | each includesSubstring: '|' ] ^ self rawLinks select: [ :each | each includesSubstring: '|' ]
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> rawLinks [ Tiddler >> rawLinks [
^ (WikiTextGrammar new linkSea star parse: self text) asSet ^ (WikiTextGrammar new linkSea star parse: self text) asSet
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> revision [ Tiddler >> revision [
^ revision ^ revision
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> revision: aNumberString [ Tiddler >> revision: aNumberString [
revision := aNumberString revision := aNumberString
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> tags [ Tiddler >> tags [
^ tags ^ tags
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> tags: anObject [ Tiddler >> tags: anObject [
tags := anObject tags := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> text [ Tiddler >> text [
^ text ^ text
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> text: anObject [ Tiddler >> text: anObject [
text := anObject text := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> title [ Tiddler >> title [
^ title ^ title
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> title: anObject [ Tiddler >> title: anObject [
title := anObject title := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> type [ Tiddler >> type [
^ type ^ type
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> type: anObject [ Tiddler >> type: anObject [
type := anObject type := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> wiki [ Tiddler >> wiki [
^ wiki ^ wiki
] ]
{ #category : 'accessing' } { #category : #accessing }
Tiddler >> wiki: aTiddlyWiki [ Tiddler >> wiki: aTiddlyWiki [
wiki := aTiddlyWiki wiki := aTiddlyWiki
] ]

View File

@ -5,8 +5,8 @@ More information:
https://tiddlywiki.com/ https://tiddlywiki.com/
" "
Class { Class {
#name : 'TiddlyWiki', #name : #TiddlyWiki,
#superclass : 'Object', #superclass : #Object,
#instVars : [ #instVars : [
'tiddlers', 'tiddlers',
'file', 'file',
@ -16,7 +16,7 @@ Class {
#category : 'TiddlyWiki-Model' #category : 'TiddlyWiki-Model'
} }
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> addToConfigFile [ TiddlyWiki >> addToConfigFile [
| cleaned | | cleaned |
cleaned := self copy. cleaned := self copy.
@ -27,12 +27,12 @@ TiddlyWiki >> addToConfigFile [
MarkupFile exportAsFileOn: self configFile containing:(STON toStringPretty: self configDictonary) MarkupFile exportAsFileOn: self configFile containing:(STON toStringPretty: self configDictonary)
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> configDictonary [ TiddlyWiki >> configDictonary [
^ STONJSON fromString: self configFile contents. ^ STONJSON fromString: self configFile contents.
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> configFile [ TiddlyWiki >> configFile [
| tempFile | | tempFile |
tempFile := FileLocator home / '.config' / 'TiddlyWikiPharo' / 'tiddlywiki.conf.ston'. tempFile := FileLocator home / '.config' / 'TiddlyWikiPharo' / 'tiddlywiki.conf.ston'.
@ -44,12 +44,12 @@ TiddlyWiki >> configFile [
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection [ TiddlyWiki >> exportJSONSubtiddlers: subtiddlersCollection [
^ MarkupFile exportAsFileOn: self file parent / 'subtiddlers.json' containing: (self jsonSubtiddlers: subtiddlersCollection) ^ MarkupFile exportAsFileOn: self file parent / 'subtiddlers.json' containing: (self jsonSubtiddlers: subtiddlersCollection)
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> exportSTONFile [ TiddlyWiki >> exportSTONFile [
| stonFile output | | stonFile output |
stonFile := self tiddlersJSONFile withoutExtension, 'ston'. stonFile := self tiddlersJSONFile withoutExtension, 'ston'.
@ -62,17 +62,17 @@ TiddlyWiki >> exportSTONFile [
^ MarkupFile exportAsFileOn: stonFile containing:output contents ^ MarkupFile exportAsFileOn: stonFile containing:output contents
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> file [ TiddlyWiki >> file [
^ file ^ file
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> file: anObject [ TiddlyWiki >> file: anObject [
file := anObject file := anObject
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> importJSONFile [ TiddlyWiki >> importJSONFile [
"I import a JSON representation of my tiddlers data, that has been previosly exported "I import a JSON representation of my tiddlers data, that has been previosly exported
by the TiddlyWiki HTML self contained file. by the TiddlyWiki HTML self contained file.
@ -88,30 +88,30 @@ TiddlyWiki >> importJSONFile [
]) ])
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> jsonSubtiddlers: subtiddlersCollection [ TiddlyWiki >> jsonSubtiddlers: subtiddlersCollection [
| subtiddlersDict | | subtiddlersDict |
subtiddlersDict := subtiddlersCollection collect: [:tiddler | tiddler asDictionary ]. subtiddlersDict := subtiddlersCollection collect: [:tiddler | tiddler asDictionary ].
^ STONJSON toStringPretty: subtiddlersDict ^ STONJSON toStringPretty: subtiddlersDict
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> loadFromConfig: wikiname [ TiddlyWiki >> loadFromConfig: wikiname [
^ self configDictonary at: wikiname. ^ self configDictonary at: wikiname.
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> local [ TiddlyWiki >> local [
^ self file ^ self file
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> local: aFileRefence [ TiddlyWiki >> local: aFileRefence [
^ self file:aFileRefence ^ self file:aFileRefence
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> name [ TiddlyWiki >> name [
| tempName suffix | | tempName suffix |
name ifNotNil: [ ^ name ]. name ifNotNil: [ ^ name ].
@ -125,13 +125,13 @@ TiddlyWiki >> name [
name := tempName name := tempName
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> name: aString [ TiddlyWiki >> name: aString [
name := aString name := aString
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> networkView [ TiddlyWiki >> networkView [
| view | | view |
view := GtMondrian new. view := GtMondrian new.
@ -143,45 +143,45 @@ TiddlyWiki >> networkView [
^ view ^ view
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> printOn: aStream [ TiddlyWiki >> printOn: aStream [
super printOn: aStream. super printOn: aStream.
aStream aStream
nextPutAll: '( ', self file basename ,' )' nextPutAll: '( ', self file basename ,' )'
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> remote [ TiddlyWiki >> remote [
^ remote ^ remote
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> remote: aUrlString [ TiddlyWiki >> remote: aUrlString [
remote := aUrlString asZnUrl remote := aUrlString asZnUrl
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> taggedWith: aTag [ TiddlyWiki >> taggedWith: aTag [
^ self tiddlers select: [:tiddler | ^ self tiddlers select: [:tiddler |
tiddler tags isNotNil and: [tiddler tags includesSubstring: aTag ] tiddler tags isNotNil and: [tiddler tags includesSubstring: aTag ]
] ]
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> tiddlers [ TiddlyWiki >> tiddlers [
^ tiddlers ifNil: [ tiddlers := OrderedCollection new ] ^ tiddlers ifNil: [ tiddlers := OrderedCollection new ]
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> tiddlers: anOrderedCollection [ TiddlyWiki >> tiddlers: anOrderedCollection [
tiddlers := anOrderedCollection tiddlers := anOrderedCollection
] ]
{ #category : 'accessing' } { #category : #accessing }
TiddlyWiki >> tiddlersJSONFile [ TiddlyWiki >> tiddlersJSONFile [
| jsonFile | | jsonFile |
file ifNil: [ file ifNil: [

View File

@ -1,34 +1,34 @@
Class { Class {
#name : 'WikiText', #name : #WikiText,
#superclass : 'Object', #superclass : #Object,
#instVars : [ #instVars : [
'content' 'content'
], ],
#category : 'TiddlyWiki-Model' #category : 'TiddlyWiki-Model'
} }
{ #category : 'accessing' } { #category : #accessing }
WikiText >> content [ WikiText >> content [
^ content ^ content
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiText >> content: aString [ WikiText >> content: aString [
content := aString content := aString
] ]
{ #category : 'conversions' } { #category : #conversions }
WikiText >> converMarkdownBold [ WikiText >> converMarkdownBold [
self content: (self content copyReplaceAll: '**' with: ''''''). self content: (self content copyReplaceAll: '**' with: '''''').
] ]
{ #category : 'conversions' } { #category : #conversions }
WikiText >> convertMarkdownBold [ WikiText >> convertMarkdownBold [
self content: (self content copyReplaceAll: '**' with: ''''''). self content: (self content copyReplaceAll: '**' with: '''''').
^ self. ^ self.
] ]
{ #category : 'conversions' } { #category : #conversions }
WikiText >> convertMarkdownLinks [ WikiText >> convertMarkdownLinks [
| markdownLinks markdownLinksRegex | | markdownLinks markdownLinksRegex |
"\[([\w|\s]+)\]\((\S+)\)" "\[([\w|\s]+)\]\((\S+)\)"
@ -45,7 +45,7 @@ WikiText >> convertMarkdownLinks [
^ self content ^ self content
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiText >> sample [ WikiText >> sample [
^ 'The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog. ^ 'The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog.

View File

@ -1,6 +1,6 @@
Class { Class {
#name : 'WikiTextGrammar', #name : #WikiTextGrammar,
#superclass : 'PP2CompositeNode', #superclass : #PP2CompositeNode,
#instVars : [ #instVars : [
'document', 'document',
'link', 'link',
@ -11,37 +11,37 @@ Class {
#category : 'TiddlyWiki-Model' #category : 'TiddlyWiki-Model'
} }
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> document [ WikiTextGrammar >> document [
^ link islandInSea star ^ link islandInSea star
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> link [ WikiTextGrammar >> link [
^ linkOpen, linkContent, linkClose ==> #second ^ linkOpen, linkContent, linkClose ==> #second
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> linkClose [ WikiTextGrammar >> linkClose [
^ ']]' asPParser ^ ']]' asPParser
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> linkContent [ WikiTextGrammar >> linkContent [
^ #any asPParser starLazy flatten ^ #any asPParser starLazy flatten
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> linkOpen [ WikiTextGrammar >> linkOpen [
^ '[[' asPParser ^ '[[' asPParser
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> linkSea [ WikiTextGrammar >> linkSea [
^ link sea ==> #second ^ link sea ==> #second
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammar >> start [ WikiTextGrammar >> start [
^ document ^ document
] ]

View File

@ -1,15 +1,15 @@
Class { Class {
#name : 'WikiTextGrammarTest', #name : #WikiTextGrammarTest,
#superclass : 'PP2CompositeNodeTest', #superclass : #PP2CompositeNodeTest,
#category : 'TiddlyWiki-Model' #category : 'TiddlyWiki-Model'
} }
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammarTest >> parserClass [ WikiTextGrammarTest >> parserClass [
^ WikiTextGrammar ^ WikiTextGrammar
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammarTest >> testDocument [ WikiTextGrammarTest >> testDocument [
| input | | input |
input := WikiText new sample. input := WikiText new sample.
@ -17,7 +17,7 @@ WikiTextGrammarTest >> testDocument [
self assert: result size equals: 2 self assert: result size equals: 2
] ]
{ #category : 'accessing' } { #category : #accessing }
WikiTextGrammarTest >> testLink [ WikiTextGrammarTest >> testLink [
self self
parse: '[[Just testing]]' parse: '[[Just testing]]'

View File

@ -1 +1 @@
Package { #name : 'TiddlyWiki' } Package { #name : #TiddlyWiki }