Compare commits

..

No commits in common. "master" and "detached" have entirely different histories.

2 changed files with 21 additions and 67 deletions

View File

@ -526,13 +526,8 @@ Tiddler >> rawAliasedLinks [
{ #category : #accessing } { #category : #accessing }
Tiddler >> rawLinks [ Tiddler >> rawLinks [
^ self rawLinksIn: self text self text ifNil: [ ^ Set new ].
] ^ (WikiTextGrammar new linkSea star parse: self text) asSet
{ #category : #accessing }
Tiddler >> rawLinksIn: aText [
aText ifNil: [ ^ Set new ].
^ (WikiTextGrammar new linkSea star parse: aText) asSet
] ]
{ #category : #accessing } { #category : #accessing }
@ -594,25 +589,13 @@ Tiddler >> tagsAsString [
^ response contents ^ response contents
] ]
{ #category : #accessing }
Tiddler >> tagsInBrackets [
| tagsInBrackets |
tagsInBrackets := self rawLinksIn: self tags.
^ tagsInBrackets
]
{ #category : #accessing } { #category : #accessing }
Tiddler >> tagsReformating [ Tiddler >> tagsReformating [
| response sanitized | | response |
self tags class ~= ByteString ifTrue: [ ^ self ]. self tags class ~= ByteString ifTrue: [ ^ self ].
response := Set new. response := Set new.
sanitized := self tags. response add: self tags.
self tagsInBrackets ifNotEmpty: [ self tags: response.
self tagsInBrackets do: [:tag | sanitized := sanitized copyReplaceAll: tag with: ''. ].
sanitized := sanitized copyReplaceAll: '[[]] ' with: ''.
].
response addAll: (sanitized trimmed splitOn: Character space) asSet.
self tags: (response union: self tagsInBrackets).
] ]

View File

@ -54,14 +54,6 @@ TiddlyWiki class >> fromJSONUrl: anUrlString [
name: anUrlString name: anUrlString
] ]
{ #category : #accessing }
TiddlyWiki class >> fromMindMapFile: mindmapFile [
"mindmapFile is a FileReference to a Mind map created in Freeplane."
| mindMapXML mindMapNodes |
mindMapXML := (XMLDOMParser on: mindmapFile contents) parseDocument.
mindMapNodes := mindMapXML xpath: '//node'.
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki class >> loadFromLocalFolder: aFolder [ TiddlyWiki class >> loadFromLocalFolder: aFolder [
@ -236,18 +228,6 @@ TiddlyWiki >> downloadHTML [
^ self folder ^ self folder
] ]
{ #category : #accessing }
TiddlyWiki >> downloadLink: v into: subfolder [
| filePath fileName |
fileName := v asUrl segments last.
filePath := subfolder / fileName.
GtSubprocessWithInMemoryOutput new
shellCommand: 'curl -L -# ' , v asString, ' -o ' , filePath fullName;
runAndWait;
stdout.
^ filePath
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> exportCommonTiddlers [ TiddlyWiki >> exportCommonTiddlers [
@ -310,11 +290,10 @@ TiddlyWiki >> exportJSONFileOptimized [
exporter := wikiFolder / 'scripts' / 'exportJsonFile'. exporter := wikiFolder / 'scripts' / 'exportJsonFile'.
exporter exists ifFalse: [ self installJsonExporter ]. exporter exists ifFalse: [ self installJsonExporter ].
GtSubprocessWithInMemoryOutput new OSSUnixSubprocess new
command: exporter fullName; command: exporter fullName;
workingDirectory: exporter parent fullName; workingDirectory: exporter parent fullName;
runAndWait. runAndWaitOnExitDo: [ :process :outString | ^ self jsonFile ]
^ self jsonFile
] ]
{ #category : #accessing } { #category : #accessing }
@ -363,7 +342,7 @@ TiddlyWiki >> exportJSONTiddlersTagged: aTag in: aFolder named: aFileName [
| taggedTiddlers jsonString | | taggedTiddlers jsonString |
self tiddlers. self tiddlers.
taggedTiddlers := self tagWith: aTag. taggedTiddlers := self taggedWith: aTag.
jsonString := '[', (',' join: (taggedTiddlers collect: [ :each | each asJsonString ])), ']'. jsonString := '[', (',' join: (taggedTiddlers collect: [ :each | each asJsonString ])), ']'.
^ MarkupFile exportAsFileOn: aFolder / (aFileName, '.json') containing: jsonString ^ MarkupFile exportAsFileOn: aFolder / (aFileName, '.json') containing: jsonString
] ]
@ -549,20 +528,22 @@ TiddlyWiki >> importSTONFilesFrom: aFolder [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> installJsonExporter [ TiddlyWiki >> installJsonExporter [
| subfolder | | folder |
subfolder := (self folder / 'scripts') ensureCreateDirectory. folder := (self file parent / 'scripts') ensureCreateDirectory.
ZnClient new ZnClient new
url: 'https://mutabit.com/repos.fossil/mutabit/uv/wiki/scripts/exportJsonFile'; url: 'https://mutabit.com/repos.fossil/mutabit/uv/wiki/scripts/exportJsonFile';
downloadTo: subfolder / 'exportJsonFile'. downloadTo: folder / 'exportJsonFile'.
ZnClient new ZnClient new
url: 'https://mutabit.com/repos.fossil/mutabit/doc/trunk/wiki/scripts/exportJsonFile.nim'; url: 'https://mutabit.com/repos.fossil/mutabit/doc/trunk/wiki/scripts/exportJsonFile.nim';
downloadTo: subfolder / 'exportJsonFile.nim'. downloadTo: folder / 'exportJsonFile.nim'.
^ GtSubprocessWithInMemoryOutput new OSSUnixSubprocess new
command: 'chmod +x ' , ((subfolder / 'exportJsonFile') fullName); command: 'chmod';
workingDirectory: subfolder fullName; arguments: { '+x' . (folder / 'exportJsonFile') fullName };
runAndWait; workingDirectory: folder fullName;
stdout redirectStdout;
redirectStderr;
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
] ]
{ #category : #accessing } { #category : #accessing }
@ -572,12 +553,6 @@ TiddlyWiki >> isInTiddlyHost [
^ self remote host endsWith: 'tiddlyhost.com' ^ self remote host endsWith: 'tiddlyhost.com'
] ]
{ #category : #accessing }
TiddlyWiki >> jsonCache [
self downloadLink: self tiddlersJSONUrl into: self folder.
^ (self folder / 'tiddlers.json') contents
]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> jsonFile [ TiddlyWiki >> jsonFile [
^ jsonFile ifNil: [ ^ jsonFile ifNil: [
@ -876,11 +851,8 @@ TiddlyWiki >> remote: aUrlString [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> remoteTiddlersContentsString [ TiddlyWiki >> remoteTiddlersContentsString [
| jsonAddress |
self isInTiddlyHost ifFalse: [ ^ self ]. self isInTiddlyHost ifFalse: [ ^ self ].
jsonAddress := self remote asString, '/tiddlers.json'. ^ (self remote asString, '/tiddlers.json') asZnUrl retrieveContents.
^ [jsonAddress asZnUrl retrieveContents]
onErrorDo: [ self jsonCache ].
] ]
{ #category : #accessing } { #category : #accessing }
@ -966,7 +938,7 @@ TiddlyWiki >> syncRemoteLocalDestructive [
] ]
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> tagWith: 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 ]
] ]
@ -1041,7 +1013,6 @@ TiddlyWiki >> tiddlersJSONFile [
{ #category : #accessing } { #category : #accessing }
TiddlyWiki >> tiddlersJSONUrl [ TiddlyWiki >> tiddlersJSONUrl [
self isInTiddlyHost ifTrue: [^ self remote / 'tiddlers.json' ].
self remote ifNil: [^ nil]. self remote ifNil: [^ nil].
] ]