Skip to content

Commit

Permalink
feat: UI & source code structure updates (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
novalagung authored Nov 14, 2024
1 parent 9d9d357 commit cbb609d
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 193 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,13 @@ jobs:
run: |
rm -f README.md
mv content/* .
mv etc/cover_small.jpg .
mv etc/cover_square.png .
mv etc/cover.jpg .
mv etc/custom.css .
mv book.json book.json.tmp
mv etc/main.go .
mv etc/robots.txt .
mv etc/gitbook-plugin-disqus.js .
npm install -g gitbook-cli
gitbook install
cd ~/.gitbook/versions/3.2.3 && npm i npm@5
cd ${{ github.workspace }}
mv etc/book.json .
mv book.json.tmp book.json
gitbook install
go run main.go -mode=webbook -adjustment=pre
gitbook build
Expand Down Expand Up @@ -73,9 +68,7 @@ jobs:
run: |
rm -f README.md
mv content/* .
mv etc/cover_small.jpg .
mv etc/cover_square.png .
mv etc/cover.jpg .
rm -rf book.json
mv etc/main.go .
go run main.go -mode=ebook -adjustment=pre
gitbook install
Expand Down
7 changes: 7 additions & 0 deletions content/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Version Changelogs & Updates

## 📝 Release v4.0.20241115 (2024-11-15)

#### ◉ General update

- Code structure updates
- UI updates

## 📝 Release v4.0.20240830 (2024-08-30)

#### ◉ Chapter update
Expand Down
8 changes: 4 additions & 4 deletions content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Ada total sekitar <b>120 chapter</b> yang dibahas dalam website/ebook ini. Kumpu
</li>
</ol>

Versi e-book: **v4.0.20240830**, dan versi Go **1.22**.
Versi e-book: **v4.0.20241115**, dan versi Go **1.22**.

## Download File E-book (pdf, epub, mobi)

Versi ebook bisa di-download dalam bentuk file via link berikut:

- [PDF](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.pdf?v=v4.0.20240830)
- [Epub](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.epub?v=v4.0.20240830)
- [Mobi](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.mobi?v=v4.0.20240830)
- [PDF](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.pdf?v=v4.0.20241115)
- [Epub](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.epub?v=v4.0.20241115)
- [Mobi](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.mobi?v=v4.0.20241115)

Untuk mendapatkan konten buku yang paling update, silakan baca langsung versi web secara online atau download ulang e-book versi terbaru.

Expand Down
160 changes: 0 additions & 160 deletions content/SUMMARY.md

This file was deleted.

3 changes: 3 additions & 0 deletions etc/book.json → content/book.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"meta",
"sitemap"
],
"styles": {
"website": "style-custom.css"
},
"pluginsConfig": {
"disqus": {
"shortName": "dasarpemrogramangolang"
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 3 additions & 3 deletions content/download-ebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Ebook Dasar Pemrograman Golang bisa di-download dalam bentuk file, silakan gunakan link berikut:

- [PDF](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.pdf?v=v4.0.20240830)
- [Epub](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.epub?v=v4.0.20240830)
- [Mobi](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.mobi?v=v4.0.20240830)
- [PDF](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.pdf?v=v4.0.20241115)
- [Epub](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.epub?v=v4.0.20241115)
- [Mobi](https://github.com/novalagung/dasarpemrogramangolang/raw/ebooks/dasarpemrogramangolang.mobi?v=v4.0.20241115)
File renamed without changes.
File renamed without changes.
25 changes: 18 additions & 7 deletions etc/custom.css → content/style-custom.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

/* base font */
body {
font-family: Source Sans Pro, Helvetica Neue, Arial, sans-serif;
body .book.font-family-1, .book-summary {
font-family: Inter, Source Sans Pro, Helvetica Neue, Arial, sans-serif;
}

/* unmark to disable search bar, replace it with the book title instead */
Expand All @@ -26,6 +27,15 @@ body {
position: absolute;
} */

.dropdown.font-settings {
display: none;
}

.page-inner {
max-width: fit-content;
padding: 20px 100px 40px 100px;
}

/* disable word wrap at left sidebar */
.book-summary ul.summary li a, .book-summary ul.summary li span {
text-overflow: initial;
Expand Down Expand Up @@ -87,12 +97,12 @@ body {

/* make the sidebar wider, and adjust the content to match it */
.book-summary {
left: -500px;
width: 500px;
left: -470px;
width: 470px;
}
@media (min-width: 600px) {
.book.with-summary .book-body {
left: 500px;
left: 470px;
}
}

Expand Down Expand Up @@ -128,7 +138,8 @@ ins.adsbygoogle {

/* disquss block */
#disqus_thread {
margin-top: 40px;
margin: 40px auto 5px;
max-width: 800px;
}
#disqus_thread + #disqus_thread {
display: none;
Expand Down Expand Up @@ -161,7 +172,7 @@ ins.adsbygoogle {
position: fixed;
bottom: 0;
right: 17px;
left: 500px;
left: 470px;
z-index: 1000;
}

Expand Down
10 changes: 1 addition & 9 deletions etc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func webbookPostAdjustment() {
htmlString = strings.ReplaceAll(htmlString, imagesAltToFind, imagesAltReplacement)

// ==== disqus lazy load
disqusJSBuf, err := os.ReadFile("./gitbook-plugin-disqus.js")
disqusJSBuf, err := os.ReadFile("./script-gitbook-plugin-disqus.js")
if err != nil {
fmt.Println("error", err)
}
Expand All @@ -163,7 +163,6 @@ func webbookPostAdjustment() {
"gitbook/gitbook-plugin-highlight/website.css",
"gitbook/gitbook-plugin-search/search.css",
"gitbook/gitbook-plugin-fontsettings/website.css",
// `/custom.css?v=` + getVersion() + `"`,
}
for _, cssFileNameToFind := range cssToLoad {
cssFileNameReplacement := fmt.Sprintf(`%s" media="print" onload="this.media='all'`, cssFileNameToFind)
Expand All @@ -180,13 +179,6 @@ func webbookPostAdjustment() {
</div>` + buttonToFind
htmlString = strings.ReplaceAll(htmlString, buttonToFind, buttonReplacement)

// ==== inject adjustment css
adjustmentCSSBuf, _ := os.ReadFile("./custom.css")
os.WriteFile("./_book/gitbook/custom.css", adjustmentCSSBuf, 0644)
adjustmentCSSToFind := `</head>`
adjustmentCSSReplacement := `<link rel="stylesheet" href="gitbook/custom.css?v=` + getVersion() + `">` + adjustmentCSSToFind
htmlString = strings.ReplaceAll(htmlString, adjustmentCSSToFind, adjustmentCSSReplacement)

// ==== inject github stars js script
buttonScriptToFind := `</head>`
buttonScriptReplacement := `<script async defer src="https://buttons.github.io/buttons.js"></script>` + buttonScriptToFind
Expand Down

0 comments on commit cbb609d

Please sign in to comment.