Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change css style for blog and fix the home link #821

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Microdown-Blog-Tests/MicDummyBlogDeployer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ MicDummyBlogDeployer >> go [
self deploy.
MicBlogCreator
createFrom: FileSystem workingDirectory / self sourceFolder
to: self outputDirectory.
to: self outputDirectory
withRoot: ''.
self launchHTTPServer.
1 seconds wait.
self launchBrowser
Expand Down
27 changes: 13 additions & 14 deletions src/Microdown-Blog-Tests/MicFileTestResources.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MicFileTestResources >> dumperInput1 [

| root |
root := Microdown parse:
'# [A Cool Story](' , '' , '/anExample1.html' , '' , ')'.
'### [A Cool Story](' , '' , '/anExample1.html' , '' , ')'.
root children add: (Microdown parse: '2019/01/09') children first.
root children add: (Microdown parse:
'Pharo is cool but this is a superlong paragraph Simple powerful language: No constructors, no...')
Expand All @@ -24,7 +24,8 @@ MicFileTestResources >> dumperInput1WithRootPath [

| root |
root := Microdown parse:
'# [A Cool Story](' , '' , self genericNonEmptyRootPath, '/anExample1.html' , '' , ')'.
'### [A Cool Story](' , '' , self genericNonEmptyRootPath
, '/anExample1.html' , '' , ')'.
root children add: (Microdown parse: '2019/01/09') children first.
root children add: (Microdown parse:
'Pharo is cool but this is a superlong paragraph Simple powerful language: No constructors, no...')
Expand All @@ -38,9 +39,8 @@ MicFileTestResources >> dumperInput2 [

| root |
root := Microdown parse:
'# [Pharo is cool](' , '' , '/anExample2.html' , '' , ')'.
root children add:
(Microdown parse: '2019/01/22') children first.
'### [Pharo is cool](' , '' , '/anExample2.html' , '' , ')'.
root children add: (Microdown parse: '2019/01/22') children first.
root children add: (Microdown parse:
'If you are either a beginner or an expert in object-oriented programming, this MOOC will...')
children first.
Expand All @@ -53,9 +53,9 @@ MicFileTestResources >> dumperInput2WithRootPath [

| root |
root := Microdown parse:
'# [Pharo is cool](' , '' , self genericNonEmptyRootPath, '/anExample2.html' , '' , ')'.
root children add:
(Microdown parse: '2019/01/22') children first.
'### [Pharo is cool](' , '' , self genericNonEmptyRootPath
, '/anExample2.html' , '' , ')'.
root children add: (Microdown parse: '2019/01/22') children first.
root children add: (Microdown parse:
'If you are either a beginner or an expert in object-oriented programming, this MOOC will...')
children first.
Expand All @@ -68,9 +68,8 @@ MicFileTestResources >> dumperInput3 [

| root |
root := Microdown parse:
'# [Mooc Pharo](' , '' , '/anExample3.html' , '' , ')'.
root children add:
(Microdown parse: '2018/01/29') children first.
'### [Mooc Pharo](' , '' , '/anExample3.html' , '' , ')'.
root children add: (Microdown parse: '2018/01/29') children first.
root children add: (Microdown parse:
'Welcome to the Pharo Mooc (a set of videos, exercises, challenges, and miniprojects).')
children first.
Expand All @@ -83,9 +82,9 @@ MicFileTestResources >> dumperInput3WithRootPath [

| root |
root := Microdown parse:
'# [Mooc Pharo](' , '' , self genericNonEmptyRootPath, '/anExample3.html' , '' , ')'.
root children add:
(Microdown parse: '2018/01/29') children first.
'### [Mooc Pharo](' , '' , self genericNonEmptyRootPath
, '/anExample3.html' , '' , ')'.
root children add: (Microdown parse: '2018/01/29') children first.
root children add: (Microdown parse:
'Welcome to the Pharo Mooc (a set of videos, exercises, challenges, and miniprojects).')
children first.
Expand Down
27 changes: 16 additions & 11 deletions src/Microdown-Blog/MicBlogCreator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ MicBlogCreator >> createAllHtmlFile [
listOfSingleSummary := allFileParse collect: [ :each |
MicSingleSummarizer new
targetDirectory: targetDirectory;
root: root;
root: root;
summarize: each ].
self sortSingleSummarizedDocuments: listOfSingleSummary.
self generateRecentpost: listOfSingleSummary.
Expand Down Expand Up @@ -205,8 +205,8 @@ MicBlogCreator >> generateRecentpost: listOfMicSingleSummarized [
MicBlogCreator >> initialize [

super initialize.
self cssFrameworkName: 'Axist'.
sum := MicListSummarizer new.
self cssFrameworkName: 'ClasslessCSS'.
sum := MicListSummarizer new
]

{ #category : 'rendering' }
Expand All @@ -232,20 +232,25 @@ MicBlogCreator >> initializeMonthList: singleSummarizedDocuments [
MicBlogCreator >> mustacheAssembly: htmlString [

| context |

context := Dictionary new
at: 'content' put: htmlString;
at: 'recentPost' put: (MicHTMLVisitor new visit: recentPost copy) first contents;
at: 'archive' put: (MicHTMLVisitor new visit: dateList copy) first contents;
yourself.

^ (MustacheTemplate on: self mustacheTemplate) value: context
at: 'homeLink' put: self root , '/';
at: 'content' put: htmlString;
at: 'recentPost'
put:
(MicHTMLVisitor new visit: recentPost copy) first
contents;
at: 'archive'
put:
(MicHTMLVisitor new visit: dateList copy) first contents;
yourself.

^ (MustacheTemplate on: self mustacheTemplate) value: context
]

{ #category : 'rendering' }
MicBlogCreator >> mustacheTemplate [

^ ' <h1 ><a href="/index.html" title="Weekly news about Pharo" rel="home">Weekly news about Pharo</a></h1>
^ ' <h1 ><a href="{{{homeLink}}}" title="Weekly news about Pharo" rel="home">Weekly news about Pharo</a></h1>
<p>Everything you wanted to know about http://www.pharo.org without being forced to read 1000 mails</p>
<table>
<tr>
Expand Down
10 changes: 5 additions & 5 deletions src/Microdown-Blog/MicSingleSummarizer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ MicSingleSummarizer >> firstHeaderBlockOf: aMicRootBlock [
h := MicHeaderBlock new.
t := MicTextBlock new bodyString:
'Please define a header'.
h level: 1.
h level: 3.
t parent: h.
^ h ].
newHeader := MicHeaderBlock new.
header headerElements do: [ :t | t copy parent: newHeader ].
newHeader level: header level.
newHeader level: 3.
^ newHeader
]

Expand Down Expand Up @@ -54,12 +54,12 @@ MicSingleSummarizer >> headerLink: aMicRootBlock [
| headerLink header fileReference |
headerLink := MicHeaderBlock new.
header := self firstHeaderBlockOf: aMicRootBlock.

self verifyFromFile: aMicRootBlock.

fileReference := (aMicRootBlock fromFile withoutExtension fullName
withoutPrefix: targetDirectory fullName) , '.html'.
fileReference := fileReference asFileReference.
withoutPrefix: targetDirectory fullName) , '.html'.
fileReference := fileReference asFileReference.

headerLink
addChild: (self makeALink: header text to: fileReference);
Expand Down
Loading