From ffa5ce7782982203ca9bb7bc6ec931c5ab17d4b4 Mon Sep 17 00:00:00 2001 From: OffrayLuna Date: Thu, 7 Dec 2017 11:20:45 +0000 Subject: [PATCH] Notebook support for downloading linked images. --- src/Grafoscopio/GrafoscopioNode.class.st | 17 ------------ src/Grafoscopio/GrafoscopioNodeTest.class.st | 28 -------------------- 2 files changed, 45 deletions(-) diff --git a/src/Grafoscopio/GrafoscopioNode.class.st b/src/Grafoscopio/GrafoscopioNode.class.st index 133f693..7b19a25 100644 --- a/src/Grafoscopio/GrafoscopioNode.class.st +++ b/src/Grafoscopio/GrafoscopioNode.class.st @@ -418,23 +418,6 @@ GrafoscopioNode >> exportPreambleTo: aStream [ aStream nextPutAll: 'abstract: ', '|'; lf; nextPutAll: (configDict at: 'abstract'); lf] ] -{ #category : #'as yet unclassified' } -GrafoscopioNode >> extractHtmlImages [ - "comment stating purpose of message" - |imgSoup imgHost imgList folders| - - imgList := Set new. - imgSoup := Soup fromString: self body. - imgHost:= self links last asUrl removeLastPathSegment. - folders:= Set new. - (imgSoup findAllTags: 'img') do: [ :each|| src | - src := (each attributeAt: 'src') asUrl. - (src host) ifNil: [ src := imgHost addPathSegments: src pathSegments ]. - imgList add: src. - ]. - ^imgList . -] - { #category : #utility } GrafoscopioNode >> find: aString andReplaceWith: anotherString [ anotherString ifNil: [ ^ self ]. diff --git a/src/Grafoscopio/GrafoscopioNodeTest.class.st b/src/Grafoscopio/GrafoscopioNodeTest.class.st index 904ac23..1d7da93 100644 --- a/src/Grafoscopio/GrafoscopioNodeTest.class.st +++ b/src/Grafoscopio/GrafoscopioNodeTest.class.st @@ -42,34 +42,6 @@ GrafoscopioNodeTest >> testDemoteNode [ ] -{ #category : #tests } -GrafoscopioNodeTest >> testDownloadImagesInto [ - "comment stating purpose of message" - - |txt txtNode| - txt:= ' - - '. - - txtNode := GrafoscopioNode new body: txt. - txtNode links: 'http://pharo.org'. - txtNode downloadImagesInto: FileLocator temp. - self assert: (FileLocator temp / 'web') allChildren size equals: 4. -] - -{ #category : #tests } -GrafoscopioNodeTest >> testExtractHtmlImages [ - "comment stating purpose of message" - - | txt txtNode | - txt := self dummyHtml. - txtNode := GrafoscopioNode new body: txt. - txtNode links: 'http://pharo.org/files/'. - txtNode extractHtmlImages. - txtNode downloadImagesInto: FileLocator temp. - self assert: (FileLocator temp / 'web') allChildren size equals: 4 -] - { #category : #tests } GrafoscopioNodeTest >> testFindAndReplace [ | tree |