Skip to content

Commit f6fbe33

Browse files
committed
refactor: code structure & design
1 parent bd528cc commit f6fbe33

11 files changed

+77
-41
lines changed

.github/workflows/deploy.yml

+5-10
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,8 @@ jobs:
2121
run: |
2222
rm -f README.md
2323
mv content/* .
24-
mv etc/cover_small.jpg .
25-
mv etc/cover_square.png .
26-
mv etc/cover.jpg .
27-
mv etc/style-custom.css .
24+
mv book.json etc/
2825
mv etc/main.go .
29-
mv etc/robots.txt .
30-
mv etc/script-gitbook-plugin-disqus.js .
3126
npm install -g gitbook-cli
3227
gitbook install
3328
cd ~/.gitbook/versions/3.2.3 && npm i npm@5
@@ -73,12 +68,12 @@ jobs:
7368
run: |
7469
rm -f README.md
7570
mv content/* .
76-
mv etc/cover_small.jpg .
77-
mv etc/cover_square.png .
78-
mv etc/cover.jpg .
7971
mv etc/main.go .
80-
go run main.go -mode=ebook -adjustment=pre
72+
rm -f book.json
8173
gitbook install
74+
cd ~/.gitbook/versions/3.2.3 && npm i npm@5
75+
cd ${{ github.workspace }}
76+
go run main.go -mode=ebook -adjustment=pre
8277
mkdir _book/
8378
- name: 'Generating ebook in pdf'
8479
run: gitbook pdf ./ ./_book/dasarpemrogramangolang.pdf

content/2-instalasi-golang.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# A.2. Instalasi Golang (Stable & Unstable)
1+
# A.2. Instalasi Golang
22

33
Hal pertama yang perlu dilakukan sebelum bisa menggunakan Go adalah meng-*install*-nya terlebih dahulu. Panduan instalasi sebenarnya sudah disediakan di situs resmi Go [http://golang.org/doc/install#install](http://golang.org/doc/install#install).
44

content/SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
* A. Pemrograman Go Dasar
2020
* [A.1. Belajar Golang](1-berkenalan-dengan-golang.md)
21-
* [A.2. Instalasi Golang (Stable & Unstable)](2-instalasi-golang.md)
21+
* [A.2. Instalasi Golang](2-instalasi-golang.md)
2222
* [A.3. Setup Go Modules](A-setup-go-project-dengan-go-modules.md)
2323
* [A.4. Setup GOPATH dan Workspace](A-gopath-dan-workspace.md)
2424
* [A.5. Instalasi Editor](A-instalasi-editor.md)

etc/book.json content/book.json

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
"meta",
88
"sitemap"
99
],
10+
"styles": {
11+
"website": "style-website.css"
12+
},
13+
"pdf": {
14+
"margin": {
15+
"left": 10,
16+
"right": 10
17+
}
18+
},
1019
"pluginsConfig": {
1120
"disqus": {
1221
"shortName": "dasarpemrogramangolang"

etc/cover.jpg content/cover.jpg

File renamed without changes.
File renamed without changes.
File renamed without changes.

etc/robots.txt content/robots.txt

File renamed without changes.
File renamed without changes.

etc/style-custom.css content/style-website.css

+61-22
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,10 @@ body .book.font-family-1, .book-summary {
3232
}
3333

3434
.page-inner {
35-
max-width: fit-content;
35+
max-width: none;
3636
padding: 20px 100px 40px 100px;
3737
}
3838

39-
/* disable word wrap at left sidebar */
40-
.book-summary ul.summary li a, .book-summary ul.summary li span {
41-
text-overflow: initial;
42-
white-space: normal;
43-
line-height: 1.4em;
44-
padding: 9px 15px;
45-
}
46-
47-
/* sidebar background */
48-
.book-summary {
49-
background-color: #ffffff;
50-
}
51-
5239
/* sidebar ads animation */
5340
/* .book-summary .summary > li:nth-child(8) a {
5441
color: white;
@@ -81,18 +68,64 @@ body .book.font-family-1, .book-summary {
8168
background: hsla(0,0%,53%,.1);
8269
}
8370

84-
/* sidebar active link */
85-
.book-summary li.active>a:before {
86-
content: " ";
71+
/* sidebar background */
72+
.book-summary {
73+
background-color: #ffffff;
74+
}
75+
76+
/* sidebar items */
77+
.book-summary ul.summary li a, .book-summary ul.summary li span {
78+
text-overflow: initial;
79+
white-space: normal;
80+
line-height: 1.4em;
81+
padding: 9px 10px 9px 6px;
82+
}
83+
.book-summary ul.summary li.chapter {
84+
position: relative;
85+
padding-left: 10px;
86+
padding-right: 10px;
87+
}
88+
.book-summary ul.summary > li.chapter:before {
8789
position: absolute;
88-
right: 0;
89-
top: 0;
90-
bottom: 0;
90+
content: " ";
91+
background-color: #F4F4F5;
9192
width: 2px;
92-
background-color: #008cff;
93+
left: 27px;
94+
top: 39px;
95+
bottom: 0px;
9396
}
94-
.book-summary li.active>a {
97+
.book-summary ul.summary li.chapter span {
98+
font-weight: 600;
99+
}
100+
.book-summary ul.summary li.chapter a {
101+
text-indent: -41px;
102+
padding-left: 51px;
103+
}
104+
.book-summary ul.summary li.chapter a:hover, .book-summary ul.summary li.chapter.active a {
105+
background-color: #F4F4F5;
95106
font-weight: bold;
107+
border-radius: 6px;
108+
text-decoration: none;
109+
}
110+
.book-summary ul.summary li span:before {
111+
content: "📄";
112+
margin-right: 2px;
113+
font-size: 1.2em;
114+
}
115+
.book-summary ul.summary li.divider {
116+
margin: 18px 0 7px;
117+
}
118+
119+
/* docsearch */
120+
#book-doc-search-input {
121+
padding: 5px;
122+
}
123+
#book-doc-search-input .DocSearch-Button {
124+
border-radius: 6px;
125+
background-color: #F4F4F5;
126+
}
127+
#book-doc-search-input .DocSearch-Button:hover {
128+
box-shadow: inset 0 0 0 2px #008cff;
96129
}
97130

98131
/* make the sidebar wider, and adjust the content to match it */
@@ -220,6 +253,12 @@ ins.adsbygoogle {
220253
}
221254
}
222255

256+
/* content */
257+
.markdown-section h1 {
258+
font-size: 3em;
259+
font-weight: 400;
260+
margin-bottom: 0.4em;
261+
}
223262
.markdown-section hr,
224263
.ebook-wrapper hr {
225264
height: 1px !important;

etc/main.go

-7
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,6 @@ func webbookPostAdjustment() {
178178
</div>` + buttonToFind
179179
htmlString = strings.ReplaceAll(htmlString, buttonToFind, buttonReplacement)
180180

181-
// ==== inject adjustment css
182-
adjustmentCSSBuf, _ := os.ReadFile("./style-custom.css")
183-
os.WriteFile("./_book/gitbook/style-custom.css", adjustmentCSSBuf, 0644)
184-
adjustmentCSSToFind := `</head>`
185-
adjustmentCSSReplacement := `<link rel="stylesheet" href="gitbook/style-custom.css?v=` + getVersion() + `">` + adjustmentCSSToFind
186-
htmlString = strings.ReplaceAll(htmlString, adjustmentCSSToFind, adjustmentCSSReplacement)
187-
188181
// ==== inject github stars js script
189182
buttonScriptToFind := `</head>`
190183
buttonScriptReplacement := `<script async defer src="https://buttons.github.io/buttons.js"></script>` + buttonScriptToFind

0 commit comments

Comments
 (0)