diff --git a/repository/Fossil/FossilRepo.class.st b/repository/Fossil/FossilRepo.class.st index 5ef4d1b..05a9b8f 100644 --- a/repository/Fossil/FossilRepo.class.st +++ b/repository/Fossil/FossilRepo.class.st @@ -57,6 +57,41 @@ FossilRepo >> fetchPage: pageName [ ^ NeoJSONReader fromString: (self jsonWikiDataFor: 'get/', pageName) ] +{ #category : #'as yet unclassified' } +FossilRepo >> getFileContentsFor: anEmbeddedDocUrl [ + "Given the web page contents for a file, hosted in Fossil, I detect all the standard + page decorations (chrome) and strip them to provide only file contents, contained between +
HTML tags.." + + | pageContentLines blockQuoteStart blockQuoteEnd fileContentLines fileContent | + pageContentLines := (self getPageContentsFor: anEmbeddedDocUrl) lines. + pageContentLines + doWithIndex: [ :line :index | + line = '' + ifTrue: [ blockQuoteEnd := index ] ]. + fileContentLines := pageContentLines + copyFrom: blockQuoteStart + 1 + to: blockQuoteEnd - 1. + fileContent := WriteStream on: ''. + fileContentLines do: [ :line | fileContent nextPutAll: line; crlf ]. + ^ fileContent contents. +] + +{ #category : #utilities } +FossilRepo >> getPageContentsFor: anEmbeddedDocUrl [ + "I use the Fossil web interface to get the contents of a file. + I'm useful if the file is posted online, but the repository contents are + not locally available. + + anEmbeddedDocUrl should have the schema presented at: + + https://www.fossil-scm.org/xfer/doc/trunk/www/embeddeddoc.wiki" + + ^ (ZnEasy get: anEmbeddedDocUrl, '?mimetype=text/plain') contents. +] + { #category : #utilities } FossilRepo >> isUnversioned: aFileNameWithRelativePath [ @@ -167,7 +202,9 @@ FossilRepo >> whoAmI [ { #category : #wiki } FossilRepo >> wikiRoot [ - ^ self jsonRoot addPathSegment: 'wiki' + ^ self remote + addPathSegments: #('json' 'wiki') + "addPathSegment: 'wiki' " ] { #category : #wiki }' + ifTrue: [ blockQuoteStart := index ]. + line = '