From cbb609dbaf45118a2fc6af7b1a031207ec79e0cd Mon Sep 17 00:00:00 2001 From: Noval Agung Prayogo Date: Fri, 15 Nov 2024 02:16:50 +0700 Subject: [PATCH] feat: UI & source code structure updates (#278) --- .github/workflows/deploy.yml | 13 +- content/CHANGELOG.md | 7 + content/README.md | 8 +- content/SUMMARY.md | 160 ------------------ {etc => content}/book.json | 3 + {etc => content}/cover.jpg | Bin {etc => content}/cover_small.jpg | Bin {etc => content}/cover_square.png | Bin content/download-ebook.md | 6 +- {etc => content}/robots.txt | 0 .../script-gitbook-plugin-disqus.js | 0 etc/custom.css => content/style-custom.css | 25 ++- etc/main.go | 10 +- 13 files changed, 39 insertions(+), 193 deletions(-) delete mode 100644 content/SUMMARY.md rename {etc => content}/book.json (94%) rename {etc => content}/cover.jpg (100%) rename {etc => content}/cover_small.jpg (100%) rename {etc => content}/cover_square.png (100%) rename {etc => content}/robots.txt (100%) rename etc/gitbook-plugin-disqus.js => content/script-gitbook-plugin-disqus.js (100%) rename etc/custom.css => content/style-custom.css (90%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f52f91757..31e8fa588 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 @@ -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 diff --git a/content/CHANGELOG.md b/content/CHANGELOG.md index 550b392a2..7919e71ab 100644 --- a/content/CHANGELOG.md +++ b/content/CHANGELOG.md @@ -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 diff --git a/content/README.md b/content/README.md index 3159032f8..f9059d1fc 100644 --- a/content/README.md +++ b/content/README.md @@ -21,15 +21,15 @@ Ada total sekitar 120 chapter yang dibahas dalam website/ebook ini. Kumpu -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. diff --git a/content/SUMMARY.md b/content/SUMMARY.md deleted file mode 100644 index 2f6d90ac3..000000000 --- a/content/SUMMARY.md +++ /dev/null @@ -1,160 +0,0 @@ -# Summary - -* [Dasar Pemrograman Golang](README.md) -* [Version Changelogs & Updates](CHANGELOG.md) -* [Download Ebook](download-ebook.md) -* [Author & Contributors](CONTRIBUTING.md) -* [Lisensi dan Distribusi Konten](DISTRIBUTION.md) - -
- -* Referensi Belajar Lainnya - * [📖 Dasar Pemrograman Python](https://dasarpemrogramanpython.novalagung.com/) - * [📖 Dasar Pemrograman Rust](https://dasarpemrogramanrust.novalagung.com/) - * [📖 How To](https://howto.novalagung.com) - * [▶️ Udemy Course: Belajar Docker & Kubernetes](https://www.udemy.com/course/praktis-belajar-docker-dan-kubernetes-untuk-pemula/) - -
- -* A. Pemrograman Go Dasar - * [A.1. Belajar Golang](1-berkenalan-dengan-golang.md) - * [A.2. Instalasi Golang (Stable & Unstable)](2-instalasi-golang.md) - * [A.3. Setup Go Modules](A-setup-go-project-dengan-go-modules.md) - * [A.4. Setup GOPATH dan Workspace](A-gopath-dan-workspace.md) - * [A.5. Instalasi Editor](A-instalasi-editor.md) - * [A.6. Go Command](A-go-command.md) - * [A.7. Program Pertama: Hello World](A-hello-world.md) - * [A.8. Komentar](A-komentar.md) - * [A.9. Variabel](A-variabel.md) - * [A.10. Tipe Data](A-tipe-data.md) - * [A.11. Konstanta](A-konstanta.md) - * [A.12. Operator](A-operator.md) - * [A.13. Seleksi Kondisi](A-seleksi-kondisi.md) - * [A.14. Perulangan](A-perulangan.md) - * [A.15. Array](A-array.md) - * [A.16. Slice](A-slice.md) - * [A.17. Map](A-map.md) - * [A.18. Fungsi](A-fungsi.md) - * [A.19. Fungsi Multiple Return](A-fungsi-multiple-return.md) - * [A.20. Fungsi Variadic](A-fungsi-variadic.md) - * [A.21. Fungsi Closure](A-fungsi-closure.md) - * [A.22. Fungsi Sebagai parameter](A-fungsi-sebagai-parameter.md) - * [A.23. Pointer](A-pointer.md) - * [A.24. Struct](A-struct.md) - * [A.25. Method](A-method.md) - * [A.26. Properti Public dan Private (Exported vs Unexported)](A-properti-public-dan-private.md) - * [A.27. Interface](A-interface.md) - * [A.28. Any / interface{} / Interface Kosong](A-interface-kosong.md) - * [A.29. Reflect](A-reflect.md) - * [A.30. Goroutine](A-goroutine.md) - * [A.31. Channel](A-channel.md) - * [A.32. Buffered Channel](A-buffered-channel.md) - * [A.33. Channel - Select](A-channel-select.md) - * [A.34. Channel - Range & Close](A-channel-range-close.md) - * [A.35. Channel - Timeout](A-channel-timeout.md) - * [A.36. Defer & Exit](A-defer-exit.md) - * [A.37. Error, Panic, & Recover](A-error-panic-recover.md) - * [A.38. Layout Format String](A-string-format.md) - * [A.39. Random](A-random.md) - * [A.40. Time, Parsing Time, & Format Time](A-time-parsing-format.md) - * [A.41. Timer, Ticker, & Scheduler](A-timer-ticker-scheduler.md) - * [A.42. Time Duration](A-time-duration.md) - * [A.43. Konversi Antar Tipe Data](A-data-type-conversion.md) - * [A.44. Fungsi String](A-strings.md) - * [A.45. Regexp](A-regex.md) - * [A.46. Encode - Decode Base64](A-encoding-base64.md) - * [A.47. Hash Sha1](A-hash-sha1.md) - * [A.48. Arguments & Flag](A-command-line-args-flag.md) - * [A.49. Exec](A-exec.md) - * [A.50. File](A-file.md) - * [A.51. Web Server](A-web-server.md) - * [A.52. URL Parsing](A-url-parsing.md) - * [A.53. JSON Data](A-json.md) - * [A.54. Web Service API Server](A-web-service-api.md) - * [A.55. Simple Client HTTP Request](A-client-http-request-simple.md) - * [A.56. SQL](A-sql.md) - * [A.57. NoSQL MongoDB](A-mongodb.md) - * [A.58. Unit Test](A-unit-test.md) - * [A.59. sync.WaitGroup](A-waitgroup.md) - * [A.60. sync.Mutex](A-mutex.md) - * [A.61. Go Vendoring](A-go-vendoring.md) - * [A.62. Concurrency Pattern: Pipeline](A-concurrency-pipeline.md) - * [A.63. Concurrency Pattern: Simplified Fan-in Fan-out Pipeline](A-simplified-fan-in-fan-out-pipeline.md) - * [A.64. Concurrency Pattern: Context Cancellation Pipeline](A-pipeline-context-cancellation.md) - * [A.65. Go Generics](A-golang-generics.md) - -
- -* B. Pemrograman Web Go Dasar - * [B.1. Golang Web App: Hello World](B-golang-web-hello-world.md) - * [B.2. Routing http.HandleFunc](B-routing-http-handlefunc.md) - * [B.3. Routing Static Assets](B-routing-static-assets.md) - * [B.4. Template: Render HTML Template](B-template-render-html.md) - * [B.5. Template: Render Partial HTML Template](B-template-render-partial-html.md) - * [B.6. Template: Actions & Variables](B-template-actions-variables.md) - * [B.7. Template: Functions](B-template-functions.md) - * [B.8. Template: Custom Functions](B-template-custom-functions.md) - * [B.9. Template: Render Specific HTML Template](B-render-specific-html-template.md) - * [B.10. Template: Render HTML String](B-render-html-string.md) - * [B.11. HTTP Method: POST & GET](B-http-method-basic.md) - * [B.12. Form Value](B-form-value.md) - * [B.13. Form Upload File](B-form-upload-file.md) - * [B.14. AJAX JSON Payload](B-ajax-json-payload.md) - * [B.15. AJAX JSON Response](B-ajax-json-response.md) - * [B.16. AJAX Multiple File Upload](B-ajax-multi-upload.md) - * [B.17. Download File](B-download-file.md) - * [B.18. HTTP Basic Auth](B-http-basic-auth.md) - * [B.19. Middleware http.Handler](B-middleware-using-http-handler.md) - * [B.20. Custom Multiplexer](B-custom-mux-multiplexer.md) - * [B.21. HTTP Cookie](B-cookie.md) - * [B.22. Simple Configuration](B-simple-configuration.md) - * [B.23. Server Handler HTTP Request Cancellation](B-server-handler-http-request-cancellation.md) - -
- -* C. Pemrograman Go Lanjut - * [C.1. Project Layout Structure](C-project-layout-structure.md) - * [C.2. Go Web Framework](C-golang-web-framework.md) - * [C.3. Echo Framework & Routing](C-echo-routing.md) - * [C.4. Parsing HTTP Request Payload (Echo)](C-parsing-http-request-payload-echo.md) - * [C.5. HTTP Request Payload Validation (Validator v9, Echo)](C-http-request-payload-validation.md) - * [C.6. HTTP Error Handling (Validator v9, Echo)](C-http-error-handling.md) - * [C.7. Template Rendering in Echo](C-echo-template-rendering.md) - * [C.8. Advanced Middleware & Logging (Logrus, Echo Logger)](C-advanced-middleware-and-logging.md) - * [C.9. CLI Flag Parser (Kingpin)](C-flag-parser.md) - * [C.10. Advanced Configuration: Viper](C-advanced-configuration-viper.md) - * [C.11. Best Practice Configuration: Environment Variable](C-best-practice-configuration-env-var.md) - * [C.12. Secure Cookie (Gorilla Securecookie)](C-securecookie.md) - * [C.13. Session (Gorilla Session)](C-session.md) - * [C.14. CORS & Preflight Request](C-cors-preflight-request.md) - * [C.15. CSRF](C-csrf.md) - * [C.16. Secure Middleware](C-secure-middleware.md) - * [C.17. HTTP Gzip Compression (gziphandler)](C-http-gzip-compression.md) - * [C.18. Send Mail (net/smtp, Gomail v2)](C-send-email.md) - * [C.19. Read & Write Excel XLSX File (Excelize)](C-read-write-excel-xlsx-file.md) - * [C.20. Write PDF File (gofpdf)](C-write-pdf-file.md) - * [C.21. Convert HTML to PDF (go-wkhtmltopdf)](C-convert-html-to-pdf.md) - * [C.22. Scraping & Parsing HTML (goquery)](C-scraping-parsing-html.md) - * [C.23. Parse & Generate XML (etree)](C-xml-parser.md) - * [C.24. HTTPS/TLS Web Server](C-https-tls.md) - * [C.25. HTTP/2 & HTTP/2 Server Push](C-http2-server-push.md) - * [C.26. Advanced Client HTTP Request](C-client-http-request-advanced.md) - * [C.27. Secure & Insecure Client HTTP Request](C-secure-insecure-client-http-request.md) - * [C.28. FTP](C-golang-ftp.md) - * [C.29. SSH & SFTP](C-golang-ssh-sftp.md) - * [C.30. Protobuf](C-golang-protobuf-implementation.md) - * [C.31. gRPC + Protobuf](C-golang-grpc-protobuf.md) - * [C.32. JSON Web Token (JWT)](C-golang-jwt.md) - * [C.33. LDAP Authentication](C-golang-ldap-authentication.md) - * [C.34. SSO SAML (Service Provider)](C-golang-sso-saml-sp.md) - * [C.35. Dockerize Aplikasi Golang](C-dockerize-golang.md) - * [C.36. Redis](C-golang-redis.md) - * [C.37. Singleflight](C-singleflight.md) - * [C.38. AWS S3](C-golang-aws-s3.md) - -
- -* D. Studi Kasus - * [D.1. Insert 1 Juta Data dari File CSV Ke Database Server, Menggunakan Teknik Worker Pool, Database Connection Pool, dan Mekanisme Failover](D-insert-1mil-csv-record-into-db-in-a-minute.md) - * [D.2. Google API Search Dengan Timeout](D-google-api-search.md) - * [D.3. Web Socket: Chatting App](D-golang-web-socket-chatting-app.md) diff --git a/etc/book.json b/content/book.json similarity index 94% rename from etc/book.json rename to content/book.json index dfc2a902a..6c415decb 100644 --- a/etc/book.json +++ b/content/book.json @@ -7,6 +7,9 @@ "meta", "sitemap" ], + "styles": { + "website": "style-custom.css" + }, "pluginsConfig": { "disqus": { "shortName": "dasarpemrogramangolang" diff --git a/etc/cover.jpg b/content/cover.jpg similarity index 100% rename from etc/cover.jpg rename to content/cover.jpg diff --git a/etc/cover_small.jpg b/content/cover_small.jpg similarity index 100% rename from etc/cover_small.jpg rename to content/cover_small.jpg diff --git a/etc/cover_square.png b/content/cover_square.png similarity index 100% rename from etc/cover_square.png rename to content/cover_square.png diff --git a/content/download-ebook.md b/content/download-ebook.md index 52408eafb..d7267c0f3 100644 --- a/content/download-ebook.md +++ b/content/download-ebook.md @@ -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) diff --git a/etc/robots.txt b/content/robots.txt similarity index 100% rename from etc/robots.txt rename to content/robots.txt diff --git a/etc/gitbook-plugin-disqus.js b/content/script-gitbook-plugin-disqus.js similarity index 100% rename from etc/gitbook-plugin-disqus.js rename to content/script-gitbook-plugin-disqus.js diff --git a/etc/custom.css b/content/style-custom.css similarity index 90% rename from etc/custom.css rename to content/style-custom.css index f9dd0e514..16a5bb455 100644 --- a/etc/custom.css +++ b/content/style-custom.css @@ -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 */ @@ -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; @@ -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; } } @@ -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; @@ -161,7 +172,7 @@ ins.adsbygoogle { position: fixed; bottom: 0; right: 17px; - left: 500px; + left: 470px; z-index: 1000; } diff --git a/etc/main.go b/etc/main.go index c5e26c4b9..1df76b35d 100644 --- a/etc/main.go +++ b/etc/main.go @@ -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) } @@ -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) @@ -180,13 +179,6 @@ func webbookPostAdjustment() { ` + buttonToFind htmlString = strings.ReplaceAll(htmlString, buttonToFind, buttonReplacement) - // ==== inject adjustment css - adjustmentCSSBuf, _ := os.ReadFile("./custom.css") - os.WriteFile("./_book/gitbook/custom.css", adjustmentCSSBuf, 0644) - adjustmentCSSToFind := `` - adjustmentCSSReplacement := `` + adjustmentCSSToFind - htmlString = strings.ReplaceAll(htmlString, adjustmentCSSToFind, adjustmentCSSReplacement) - // ==== inject github stars js script buttonScriptToFind := `` buttonScriptReplacement := `` + buttonScriptToFind