diff --git a/src/MiniDocs/LePage.extension.st b/src/MiniDocs/LePage.extension.st index bc0a2c6..553b015 100644 --- a/src/MiniDocs/LePage.extension.st +++ b/src/MiniDocs/LePage.extension.st @@ -49,7 +49,7 @@ LePage >> asMarkdeep [ { #category : #'*MiniDocs' } LePage >> asMarkdeepFile [ - ^ self asMarkdeep exportAsFileOn: self storage / self markdeepFileName + ^ self asMarkdeep notifyExportAsFileOn: self storage / self markdeepFileName ] { #category : #'*MiniDocs' } diff --git a/src/MiniDocs/LePageHeaderBuilder.extension.st b/src/MiniDocs/LePageHeaderBuilder.extension.st index 778bc43..6352ed1 100644 --- a/src/MiniDocs/LePageHeaderBuilder.extension.st +++ b/src/MiniDocs/LePageHeaderBuilder.extension.st @@ -13,3 +13,18 @@ LePageHeaderBuilder >> addExportPageButton [ aButton phlow spawnObject: self page asMarkdeepFile ]. self toolbarElement addItem: newButton. ] + +{ #category : #'*MiniDocs' } +LePageHeaderBuilder >> addRefreshWebViewButton [ + + | newButton | + + newButton := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + label: 'Refresh web view'; + icon: BrGlamorousVectorIcons refresh; + action: [ :aButton | + self page asMarkdeep exportAsFileOn: (self page storage / self page markdownFileName). + aButton phlow spawnObject: self page localHostAddress ]. + self toolbarElement addItem: newButton. +] diff --git a/src/MiniDocs/Markdeep.class.st b/src/MiniDocs/Markdeep.class.st index 09cb1cd..b50ac1b 100644 --- a/src/MiniDocs/Markdeep.class.st +++ b/src/MiniDocs/Markdeep.class.st @@ -147,7 +147,7 @@ Markdeep >> exportAsFile [ | newFile | self markdownFile ifNil: [ self inform: 'Define an input Markdown file or use #exportAsFileOn: instead.' ]. newFile := (self markdownFile file fullName, '.html') asFileReference. - ^ self exportAsFileOn: newFile. + ^ self notifyExportAsFileOn: newFile. ] { #category : #persistence } @@ -156,8 +156,6 @@ Markdeep >> exportAsFileOn: aFileReference [ aFileReference exists ifFalse: [ aFileReference ensureCreateFile ]. aFileReference writeStreamDo: [ :stream | stream nextPutAll: self contents ]. - self inform: 'Exported as: ', String cr, aFileReference fullName. - ^ aFileReference ] { #category : #utilities } @@ -272,6 +270,13 @@ Markdeep >> navTop: aString [ navTop:= aString. ] +{ #category : #persistence } +Markdeep >> notifyExportAsFileOn: aFileReference [ + self exportAsFileOn: aFileReference. + self inform: 'Exported as: ', String cr, aFileReference fullName. + ^ aFileReference +] + { #category : #accessing } Markdeep >> options [ ^ options ifNil: [ diff --git a/src/MiniDocs/MiniDocsServer.class.st b/src/MiniDocs/MiniDocsServer.class.st index fa4fb16..84209e7 100644 --- a/src/MiniDocs/MiniDocsServer.class.st +++ b/src/MiniDocs/MiniDocsServer.class.st @@ -2,7 +2,8 @@ Class { #name : #MiniDocsServer, #superclass : #Teapot, #classInstVars : [ - 'storage' + 'storage', + 'singleton' ], #category : #MiniDocs } @@ -17,10 +18,26 @@ MiniDocsServer class >> initialize [ self addStorage: FileLocator documents / 'lepiter' / 'default' ] +{ #category : #accessing } +MiniDocsServer class >> isRunning [ + ^ self singleton server isRunning +] + +{ #category : #accessing } +MiniDocsServer class >> restart [ + self stopAll. + ^ self start +] + +{ #category : #accessing } +MiniDocsServer class >> singleton [ + ^ singleton +] + { #category : #accessing } MiniDocsServer class >> start [ self initialize. - ^ self superclass on + ^ singleton := self superclass on serveStatic: '/lepiter/doc/' from: self storage first pathString; start ]