Creando subfolders de metadatos

This commit is contained in:
nestorsire 2022-11-21 12:58:40 -05:00
parent d1568f748d
commit 5984ff492c

View File

@ -19,7 +19,8 @@ PaqueteSemanal class >> location: anObject [
{ #category : #accessing } { #category : #accessing }
PaqueteSemanal >> extractMetadataForFolder: subfolder [ PaqueteSemanal >> extractMetadataForFolder: subfolder [
| subfolderFiles extractMetadatos | | subfolderFiles extractMetadatos subfolderRenamed |
subfolderRenamed := self sanitizeFolderNamed: subfolder.
subfolderFiles := (self location / subfolder) allChildren select: [:item | item isFile and: [(item basename = '.DS_Store') not ]]. subfolderFiles := (self location / subfolder) allChildren select: [:item | item isFile and: [(item basename = '.DS_Store') not ]].
subfolderFiles do: [:archivoPruebas | | metadatosArchivo titulo metaTiddler | subfolderFiles do: [:archivoPruebas | | metadatosArchivo titulo metaTiddler |
extractMetadatos := GtSubprocessWithInMemoryOutput new extractMetadatos := GtSubprocessWithInMemoryOutput new
@ -35,10 +36,10 @@ PaqueteSemanal >> extractMetadataForFolder: subfolder [
text: metadatosArchivo; text: metadatosArchivo;
type: 'application/json'. type: 'application/json'.
MarkupFile MarkupFile
exportAsFileOn: (self metadataFolder / titulo, 'json') exportAsFileOn: (self metadataFolder / subfolderRenamed / titulo, 'json')
containing: metaTiddler asJson containing: metaTiddler asJson
]. ].
^ self metadataFolder ^ self metadataFolder / subfolderRenamed
] ]
@ -66,3 +67,12 @@ PaqueteSemanal >> repository [
PaqueteSemanal >> repository: folder [ PaqueteSemanal >> repository: folder [
repository := folder repository := folder
] ]
{ #category : #accessing }
PaqueteSemanal >> sanitizeFolderNamed: name [
| sanitized |
sanitized := name trimmed copyReplaceAll: '!' with: ''.
sanitized := sanitized copyReplaceAll: ' ' with: ''.
sanitized := sanitized romanizeAccents.
^ sanitized
]