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 }
Tiddler >> rawLinks [
^ self rawLinksIn: self text
]
{ #category : #accessing }
Tiddler >> rawLinksIn: aText [
aText ifNil: [ ^ Set new ].
^ (WikiTextGrammar new linkSea star parse: aText) asSet
self text ifNil: [ ^ Set new ].
^ (WikiTextGrammar new linkSea star parse: self text) asSet
]
{ #category : #accessing }
@ -594,25 +589,13 @@ Tiddler >> tagsAsString [
^ response contents
]
{ #category : #accessing }
Tiddler >> tagsInBrackets [
| tagsInBrackets |
tagsInBrackets := self rawLinksIn: self tags.
^ tagsInBrackets
]
{ #category : #accessing }
Tiddler >> tagsReformating [
| response sanitized |
| response |
self tags class ~= ByteString ifTrue: [ ^ self ].
response := Set new.
sanitized := self tags.
self tagsInBrackets ifNotEmpty: [
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).
response add: self tags.
self tags: response.
]

View File

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