Remove archive argument from readComponent
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
`(.exists .components ,e ,(symbolName componentType)))
|
`(.exists .components ,e ,(symbolName componentType)))
|
||||||
|
|
||||||
// Changes to the object returned by (readComponent) will not be saved! Use (withWritableComponents) for making changes
|
// Changes to the object returned by (readComponent) will not be saved! Use (withWritableComponents) for making changes
|
||||||
(defMacro readComponent [archive e componentType]
|
(defMacro readComponent [e componentType]
|
||||||
`(let [componentData (dictGet (the Map<String,String> .components ,e) ,(symbolName componentType))]
|
`(let [componentData (dictGet (the Map<String,String> .components ,e) ,(symbolName componentType))]
|
||||||
(print (+ "reading " componentData " as " ,(symbolName componentType) " for " .id ,e))
|
(print (+ "reading " componentData " as " ,(symbolName componentType) " for " .id ,e))
|
||||||
(the nat.components ,componentType
|
(the nat.components ,componentType
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
(symbol)]
|
(symbol)]
|
||||||
(doFor [name type] bindingPairs
|
(doFor [name type] bindingPairs
|
||||||
(bindingList.push `&mut ,name)
|
(bindingList.push `&mut ,name)
|
||||||
(bindingList.push `(readComponent ,archive ,e ,type))
|
(bindingList.push `(readComponent ,e ,type))
|
||||||
(saveList.push `(dictSet .components ,e ,(symbolName type) (tink.Json.stringify (the nat.components ,type ,name)))))
|
(saveList.push `(dictSet .components ,e ,(symbolName type) (tink.Json.stringify (the nat.components ,type ,name)))))
|
||||||
`(let [,@bindingList
|
`(let [,@bindingList
|
||||||
,retValSymbol {,@body}]
|
,retValSymbol {,@body}]
|
||||||
@@ -49,16 +49,15 @@
|
|||||||
,retValSymbol)))
|
,retValSymbol)))
|
||||||
|
|
||||||
// Create a system that selects Entries according to a single string component (i.e. Name or Author) matching the given value
|
// Create a system that selects Entries according to a single string component (i.e. Name or Author) matching the given value
|
||||||
(defMacro stringComponentSystem [archive componentType value process]
|
(defMacro stringComponentSystem [componentType value process]
|
||||||
`(new System
|
`(new System
|
||||||
(lambda [archive :nat.Entry e]
|
(lambda [archive :nat.Entry e]
|
||||||
?(and (hasComponent e ,componentType)
|
?(and (hasComponent e ,componentType)
|
||||||
(= ,value (readComponent ,archive e ,componentType))))
|
(= ,value (readComponent e ,componentType))))
|
||||||
,process))
|
,process))
|
||||||
|
|
||||||
(function tagList [archive e]
|
(function tagList [archive e]
|
||||||
(let [t
|
(let [t (readComponent e Tags)]
|
||||||
(readComponent archive e Tags)]
|
|
||||||
(collect (t.keys))))
|
(collect (t.keys))))
|
||||||
|
|
||||||
(function tagsMatch [archive e tagsBoolExp]
|
(function tagsMatch [archive e tagsBoolExp]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
(defNew []
|
(defNew []
|
||||||
(super
|
(super
|
||||||
->[archive e] (hasComponent e Name)
|
->[archive e] (hasComponent e Name)
|
||||||
->[archive e] (let [name (readComponent archive e Name)]
|
->[archive e] (let [name (readComponent e Name)]
|
||||||
(if (entriesByName.exists (name.toLowerCase))
|
(if (entriesByName.exists (name.toLowerCase))
|
||||||
(.push (dictGet entriesByName (name.toLowerCase)) e)
|
(.push (dictGet entriesByName (name.toLowerCase)) e)
|
||||||
(dictSet entriesByName (name.toLowerCase) [e]))
|
(dictSet entriesByName (name.toLowerCase) [e]))
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
// named method in case a user will want to run it on selectedEntries instead of on media entries
|
// named method in case a user will want to run it on selectedEntries instead of on media entries
|
||||||
(method scrapeForImages [archive e]
|
(method scrapeForImages [archive e]
|
||||||
(let [:String title
|
(let [:String title
|
||||||
(readComponent archive e Name)
|
(readComponent e Name)
|
||||||
:Array<String> wikipediaImageUrls
|
:Array<String> wikipediaImageUrls
|
||||||
(queryImageUrls (queryImageTitles [title]))]
|
(queryImageUrls (queryImageTitles [title]))]
|
||||||
(addFiles archive e
|
(addFiles archive e
|
||||||
|
|||||||
Reference in New Issue
Block a user