From bd65f02acbd18532342f18e65e86edd1a2062e1c Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 23 Jan 2026 19:26:29 +0700 Subject: all: move _example/ directory under _doc/ directory This allow us to inspect the example using the serve-doc task, along with the content of _doc/. --- README.md | 63 ++++++++------- REUSE.toml | 2 +- _doc/example/.gitignore | 4 + _doc/example/favicon.ico | Bin 0 -> 4550 bytes _doc/example/favicon.ico.license | 2 + _doc/example/html.tmpl | 50 ++++++++++++ _doc/example/index.adoc | 24 ++++++ _doc/example/index.css | 164 ++++++++++++++++++++++++++++++++++++++ _doc/example/sub/custom.css | 6 ++ _doc/example/sub/index.adoc | 9 +++ _example/.gitignore | 4 - _example/custom.css | 8 -- _example/favicon.ico | Bin 5686 -> 0 bytes _example/html.tmpl | 50 ------------ _example/index.adoc | 23 ------ _example/index.css | 166 --------------------------------------- _example/sub/index.adoc | 8 -- 17 files changed, 291 insertions(+), 292 deletions(-) create mode 100644 _doc/example/.gitignore create mode 100644 _doc/example/favicon.ico create mode 100644 _doc/example/favicon.ico.license create mode 100644 _doc/example/html.tmpl create mode 100644 _doc/example/index.adoc create mode 100644 _doc/example/index.css create mode 100644 _doc/example/sub/custom.css create mode 100644 _doc/example/sub/index.adoc delete mode 100644 _example/.gitignore delete mode 100644 _example/custom.css delete mode 100644 _example/favicon.ico delete mode 100644 _example/html.tmpl delete mode 100644 _example/index.adoc delete mode 100644 _example/index.css delete mode 100644 _example/sub/index.adoc diff --git a/README.md b/README.md index 88289c0..51765e6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + + + # Welcome to ciigo @@ -124,12 +127,12 @@ ciigo version -In this repository, we have an "\_example" directory that we can try using -`ciigo`. +In this repository, we have an "\_doc/example/" directory that we can try +using `ciigo`. ``` -$ tree _example -_example/ +$ tree _doc/example +_doc/example/ ├── custom.css ├── favicon.ico ├── html.tmpl @@ -139,21 +142,21 @@ _example/ └── index.adoc ``` -First, lets convert all AsciiDoc files (.adoc) inside the "\_example" +First, lets convert all AsciiDoc files (.adoc) inside the "\_doc/example" directory recursively, ``` -$ ciigo convert ./_example -2025/01/06 19:17:07 convertFileMarkups: converting _example/sub/index.adoc -2025/01/06 19:17:07 convertFileMarkups: converting _example/index.adoc +$ ciigo convert ./_doc/example +2025/01/06 19:17:07 convertFileMarkups: converting _doc/example/sub/index.adoc +2025/01/06 19:17:07 convertFileMarkups: converting _doc/example/index.adoc $ ``` Then serve it under HTTP server, ``` -$ ciigo serve ./_example/ -2025/01/06 19:17:47 ciigo: starting HTTP server at http://127.0.0.1:6320 for "./_example" +$ ciigo serve ./_doc/example/ +2025/01/06 19:17:47 ciigo: starting HTTP server at http://127.0.0.1:6320 for "./_doc/example" ``` @@ -168,7 +171,7 @@ As we can see, the style of "/sub/" page is different because they use custom style defined using ``` -:stylesheet: /custom.css +:stylesheet: custom.css ``` inside the "/sub/index.adoc" file. @@ -178,7 +181,7 @@ their own style. Lets convert again but now using new "-template", ``` -$ ciigo -template _example/html.tmpl +$ ciigo -template _doc/example/html.tmpl $ ``` @@ -188,31 +191,31 @@ To force converting all markup files, we can update the modification time of our template file, ``` -$ touch _example/html.tmpl +$ touch _doc/example/html.tmpl $ ``` or delete all the HTML files, ``` -$ find _example/ -name "*.html" -delete +$ find _doc/example/ -name "*.html" -delete $ ``` and then run the convert command again. ``` -$ ciigo -template ./_example/html.tmpl convert ./_example/ -2025/01/06 19:28:17 convertFileMarkups: converting _example/sub/index.adoc -2025/01/06 19:28:17 convertFileMarkups: converting _example/index.adoc +$ ciigo -template ./_doc/example/html.tmpl convert ./_doc/example/ +2025/01/06 19:28:17 convertFileMarkups: converting _doc/example/sub/index.adoc +2025/01/06 19:28:17 convertFileMarkups: converting _doc/example/index.adoc $ ``` Run the `serve` command again to preview our new generated HTML files, ``` -$ ciigo serve ./_example/ -2025/01/06 19:36:07 ciigo: starting HTTP server at http://127.0.0.1:6320 for "./_example" +$ ciigo serve ./_doc/example/ +2025/01/06 19:36:07 ciigo: starting HTTP server at http://127.0.0.1:6320 for "./_doc/example" ``` @@ -228,18 +231,18 @@ as tile and a "Sub" menu at the top-right. The "ciigo serve" command able to watch for new changes on markup files and convert it automatically to HTML without need to run "convert" manually. -Lets run the serve command again on \_example directory, +Lets run the serve command again on "\_doc/example" directory, ``` -$ ciigo serve ./_example/ -2025/01/06 19:46:54 ciigo: starting HTTP server at http://127.0.0.1:6320 for "./_example" +$ ciigo serve ./_doc/example/ +2025/01/06 19:46:54 ciigo: starting HTTP server at http://127.0.0.1:6320 for "./_doc/example" ``` -Create new directory "journal" under "\_example", +Create new directory "journal" under "\_doc/example", ``` -$ mkdir -p ./_example/journal/ +$ mkdir -p ./_doc/example/journal/ $ ``` @@ -259,10 +262,6 @@ and we should see new HTML page generated with the above content. Each time we refresh the browser, ciigo will check if the markup file is updated and then convert it automatically to HTML and return it to browser. -Another way to trigger ciigo to rescan for new markup files is by creating -or updating file ".ciigo_rescan" inside the content directory. -In the above example, by creating file "\_example/.ciigo_rescan". - Lets try updating the "journal/index.adoc" into ``` @@ -274,7 +273,7 @@ Hello ciigo! and create or update the ".ciigo_rescan", ``` -$ touch _example/.ciigo_rescan +$ touch _doc/example/.ciigo_rescan $ ``` @@ -289,7 +288,7 @@ and when we refresh the browser, we should see the page being updated. Once we have write the content as we like, we can deploy the generated HTML files and other assets files to the server. -For example, using `rsync(1)` we can deploy the "\_example/" excluding the +For example, using `rsync(1)` we can deploy the "\_doc/example/" excluding the hidden files (start with ".") and files with extension ".adoc", ".md", and ".tmpl"; by issuing the following command, @@ -297,7 +296,7 @@ hidden files (start with ".") and files with extension ".adoc", ".md", and $ rsync --exclude='.*' \ --exclude='*.adoc' --exclude='*.md' --exclude='*.tmpl' \ --recursive --archive \ - _example/ \ + _doc/example/ \ user@myserver:/srv/pub/ ``` @@ -350,5 +349,5 @@ later. diff --git a/REUSE.toml b/REUSE.toml index 23588b2..6664413 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -5,6 +5,6 @@ version = 1 [[annotations]] -path = ["go.sum", "README.md", "_example/favicon.ico", "testdata/**", "_AUR/**"] +path = ["go.sum", "testdata/**", "_AUR/**"] SPDX-FileCopyrightText = "2022 Shulhan " SPDX-License-Identifier = "GPL-3.0-or-later" diff --git a/_doc/example/.gitignore b/_doc/example/.gitignore new file mode 100644 index 0000000..37384e4 --- /dev/null +++ b/_doc/example/.gitignore @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2020 Shulhan +/.ciigo_rescan +/journal diff --git a/_doc/example/favicon.ico b/_doc/example/favicon.ico new file mode 100644 index 0000000..a32b4a2 Binary files /dev/null and b/_doc/example/favicon.ico differ diff --git a/_doc/example/favicon.ico.license b/_doc/example/favicon.ico.license new file mode 100644 index 0000000..6109097 --- /dev/null +++ b/_doc/example/favicon.ico.license @@ -0,0 +1,2 @@ +SPDX-License-Identifier: GPL-3.0-or-later +SPDX-FileCopyrightText: 2026 M. Shulhan diff --git a/_doc/example/html.tmpl b/_doc/example/html.tmpl new file mode 100644 index 0000000..98c9356 --- /dev/null +++ b/_doc/example/html.tmpl @@ -0,0 +1,50 @@ + + + + + + + + + + + {{.Title}} + + {{- range .Styles}} + + {{- end}} + + + +
+
+
+ ciigo +
+ + +
+
+ +
+
+ {{.Body}} +
+ +
+ + + + + + diff --git a/_doc/example/index.adoc b/_doc/example/index.adoc new file mode 100644 index 0000000..e76bfa0 --- /dev/null +++ b/_doc/example/index.adoc @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2020 Shulhan + += Welcome to ciigo +Shulhan +25 September 2019 +:sectanchors: +:sectlinks: +:toc: + +`ciigo` is a library and a program to write static web server with embedded +files using +https://asciidoctor.org/docs/what-is-asciidoc/[AsciiDoc^] +markup format. + +== ciigo as library + +For an up to date documentation of how to use the library see the +https://git.sr.ht/~shulhan/ciigo[repository page^]. + +== ciigo as CLI + +`ciigo` as CLI can convert, generate, and/or serve a directory that contains +markup files, as HTML files. diff --git a/_doc/example/index.css b/_doc/example/index.css new file mode 100644 index 0000000..3467881 --- /dev/null +++ b/_doc/example/index.css @@ -0,0 +1,164 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* SPDX-FileCopyrightText: 2020 Shulhan */ + +body { + margin: 0; + font-family: Arial, sans-serif; + background-color: #fff; + line-height: 1.3; + text-align: center; + color: #222; +} +pre { + font-family: Menlo, monospace; + font-size: 0.875rem; + line-height: 1.4; + overflow-x: auto; + background: #efefef; + padding: 0.625rem; + border-radius: 0.3125rem; +} +a { + color: #375eab; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +p, +li { + max-width: 50rem; + word-wrap: break-word; +} +p, +pre, +ul, +ol { + margin: 1.25rem; +} + +h1, +h2, +h3, +h4 { + margin: 1.25rem 0 1.25rem; + padding: 0; + color: #375eab; + font-weight: bold; +} +h1 { + font-size: 1.75rem; + line-height: 1; +} +h1 .text-muted { + color: #777; +} +h2 { + clear: right; + font-size: 1.25rem; + background: #e0ebf5; + padding: 0.5rem; + line-height: 1.25; + font-weight: normal; + overflow: auto; + overflow-wrap: break-word; +} +h2 a { + font-weight: bold; +} +h3 { + font-size: 1.25rem; + line-height: 1.25; + overflow: auto; + overflow-wrap: break-word; +} +h3, +h4 { + margin: 1.25rem 0.3125rem; +} +h4 { + font-size: 1rem; +} + +h2 > span, +h3 > span { + float: right; + margin: 0 25px 0 0; + font-weight: normal; + color: #5279c7; +} + +dl { + margin: 1.25rem; +} +dd { + margin: 0 0 0 1.25rem; +} +dl, +dd { + font-size: 0.875rem; +} + +/** + * Custom classes for pages + */ + +.topbar { + background: #e0ebf5; + height: 4rem; + overflow: hidden; +} + +.topbar .top-heading, +.topbar .menu { + padding: 1.313rem 0; + font-size: 1.25rem; + font-weight: normal; +} + +.topbar .top-heading { + float: left; +} +.topbar .top-heading a { + color: #222; + text-decoration: none; +} + +.topbar .menu { + float: right; +} +.topbar .menu a { + margin: 0.625rem 0.125rem; + padding: 0.625rem; + color: white; + background: #375eab; + border: 0.0625rem solid #375eab; + border-radius: 5px; +} +.topbar .menu form { + margin-left: 0.625rem; +} +.page { + width: 100%; +} + +.page > .container, +.topbar > .container { + text-align: left; + margin-left: auto; + margin-right: auto; + padding: 0 1.25rem; +} + +.container .meta { + font-style: italic; + margin: 1.25rem; +} + +.footer { + text-align: center; + color: #666; + font-size: 0.875rem; + margin: 2.5rem 0; +} diff --git a/_doc/example/sub/custom.css b/_doc/example/sub/custom.css new file mode 100644 index 0000000..c113fea --- /dev/null +++ b/_doc/example/sub/custom.css @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* SPDX-FileCopyrightText: 2020 Shulhan */ + +h1 { + color: sienna; +} diff --git a/_doc/example/sub/index.adoc b/_doc/example/sub/index.adoc new file mode 100644 index 0000000..a28cb80 --- /dev/null +++ b/_doc/example/sub/index.adoc @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2020 Shulhan + += Sub directory +Second Author +24 November 2020 +:stylesheet: custom.css + +This is an example of content in sub directory using custom stylesheet. diff --git a/_example/.gitignore b/_example/.gitignore deleted file mode 100644 index 37384e4..0000000 --- a/_example/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// SPDX-FileCopyrightText: 2020 Shulhan -/.ciigo_rescan -/journal diff --git a/_example/custom.css b/_example/custom.css deleted file mode 100644 index 8bf831b..0000000 --- a/_example/custom.css +++ /dev/null @@ -1,8 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2020 Shulhan - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -h1 { - color: sienna; -} diff --git a/_example/favicon.ico b/_example/favicon.ico deleted file mode 100644 index 8d22584..0000000 Binary files a/_example/favicon.ico and /dev/null differ diff --git a/_example/html.tmpl b/_example/html.tmpl deleted file mode 100644 index 527ab6a..0000000 --- a/_example/html.tmpl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - {{.Title}} - - {{- range .Styles}} - - {{- end}} - - - -
-
-
- ciigo -
- - -
-
- -
-
- {{.Body}} -
- -
- - - - - - diff --git a/_example/index.adoc b/_example/index.adoc deleted file mode 100644 index a1b6c85..0000000 --- a/_example/index.adoc +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-FileCopyrightText: 2020 Shulhan -// SPDX-License-Identifier: GPL-3.0-or-later -= Welcome to ciigo -Shulhan -25 September 2019 -:sectanchors: -:sectlinks: -:toc: - -`ciigo` is a library and a program to write static web server with embedded -files using -https://asciidoctor.org/docs/what-is-asciidoc/[AsciiDoc^] -markup format. - -== ciigo as library - -For an up to date documentation of how to use the library see the -https://git.sr.ht/~shulhan/ciigo[repository page^]. - -== ciigo as CLI - -`ciigo` as CLI can convert, generate, and/or serve a directory that contains -markup files, as HTML files. diff --git a/_example/index.css b/_example/index.css deleted file mode 100644 index b6254c4..0000000 --- a/_example/index.css +++ /dev/null @@ -1,166 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2020 Shulhan - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -body { - margin: 0; - font-family: Arial, sans-serif; - background-color: #fff; - line-height: 1.3; - text-align: center; - color: #222; -} -pre { - font-family: Menlo, monospace; - font-size: 0.875rem; - line-height: 1.4; - overflow-x: auto; - background: #efefef; - padding: 0.625rem; - border-radius: 0.3125rem; -} -a { - color: #375eab; - text-decoration: none; -} -a:hover { - text-decoration: underline; -} - -p, -li { - max-width: 50rem; - word-wrap: break-word; -} -p, -pre, -ul, -ol { - margin: 1.25rem; -} - -h1, -h2, -h3, -h4 { - margin: 1.25rem 0 1.25rem; - padding: 0; - color: #375eab; - font-weight: bold; -} -h1 { - font-size: 1.75rem; - line-height: 1; -} -h1 .text-muted { - color: #777; -} -h2 { - clear: right; - font-size: 1.25rem; - background: #e0ebf5; - padding: 0.5rem; - line-height: 1.25; - font-weight: normal; - overflow: auto; - overflow-wrap: break-word; -} -h2 a { - font-weight: bold; -} -h3 { - font-size: 1.25rem; - line-height: 1.25; - overflow: auto; - overflow-wrap: break-word; -} -h3, -h4 { - margin: 1.25rem 0.3125rem; -} -h4 { - font-size: 1rem; -} - -h2 > span, -h3 > span { - float: right; - margin: 0 25px 0 0; - font-weight: normal; - color: #5279c7; -} - -dl { - margin: 1.25rem; -} -dd { - margin: 0 0 0 1.25rem; -} -dl, -dd { - font-size: 0.875rem; -} - -/** - * Custom classes for pages - */ - -.topbar { - background: #e0ebf5; - height: 4rem; - overflow: hidden; -} - -.topbar .top-heading, -.topbar .menu { - padding: 1.313rem 0; - font-size: 1.25rem; - font-weight: normal; -} - -.topbar .top-heading { - float: left; -} -.topbar .top-heading a { - color: #222; - text-decoration: none; -} - -.topbar .menu { - float: right; -} -.topbar .menu a { - margin: 0.625rem 0.125rem; - padding: 0.625rem; - color: white; - background: #375eab; - border: 0.0625rem solid #375eab; - border-radius: 5px; -} -.topbar .menu form { - margin-left: 0.625rem; -} -.page { - width: 100%; -} - -.page > .container, -.topbar > .container { - text-align: left; - margin-left: auto; - margin-right: auto; - padding: 0 1.25rem; -} - -.container .meta { - font-style: italic; - margin: 1.25rem; -} - -.footer { - text-align: center; - color: #666; - font-size: 0.875rem; - margin: 2.5rem 0; -} diff --git a/_example/sub/index.adoc b/_example/sub/index.adoc deleted file mode 100644 index 060610d..0000000 --- a/_example/sub/index.adoc +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-FileCopyrightText: 2020 Shulhan -// SPDX-License-Identifier: GPL-3.0-or-later -= Sub directory -Second Author -24 November 2020 -:stylesheet: /custom.css - -This is an example of content in sub directory using custom stylesheet. -- cgit v1.3