diff --git a/.editorconfig b/.editorconfig index 32ada8c79..9f978977b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,7 +23,7 @@ max_line_length = off trim_trailing_whitespace = false max_line_length = 80 -[*.yaml] +[*.{yaml,yml}] max_line_length = 80 [*.mjs] diff --git a/LICENSES/CC-BY-SA-4.0.txt b/LICENSES/CC-BY-SA-4.0.txt new file mode 100644 index 000000000..835a6836b --- /dev/null +++ b/LICENSES/CC-BY-SA-4.0.txt @@ -0,0 +1,170 @@ +Creative Commons Attribution-ShareAlike 4.0 International + + Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. + +Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors. + +Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. + +Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public. + +Creative Commons Attribution-ShareAlike 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + + e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + + i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights under this Public License. + + k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + + 3. Term. The term of this Public License is specified in Section 6(a). + + 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. Downstream recipients. + + A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + + B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. + + C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + + 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified form), You must: + + A. retain the following if it is supplied by the Licensor with the Licensed Material: + + i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + + v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + + B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + + C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + + 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + + b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. + + 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + + b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + + b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + + c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + + d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + + e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + + c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + + d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + +Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/REUSE.toml b/REUSE.toml index a3b5e5803..a08260e18 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -37,6 +37,30 @@ path = "scripts/cert/js/nodejs/.nvmrc" SPDX-FileCopyrightText = "© 2024 Sebastian Davids " SPDX-License-Identifier = "Apache-2.0" +[[annotations]] +path = [ + "scripts/asciidoc/example-pdf/src/src/csv/data.csv", +] +SPDX-FileCopyrightText = "© 2024 Sebastian Davids " +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = [ + "scripts/asciidoc/example-pdf/src/images/dragonfly.jpg", +] +SPDX-FileCopyrightText = "© 2017 Charles J. Sharp (https://www.sharpphotography.co.uk)" +SPDX-License-Identifier = "CC-BY-SA-4.0" + +[[annotations]] +path = "scripts/asciidoc/example-pdf/src/_includes/*.adoc" +SPDX-FileCopyrightText = "© 2024 Sebastian Davids " +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = "docs/user-guide/modules/ROOT/attachments/asciidoc/main.pdf" +SPDX-FileCopyrightText = "© 2024 Sebastian Davids " +SPDX-License-Identifier = "Apache-2.0" + [[annotations]] path = "docs/user-guide/modules/ROOT/attachments/latex/main.pdf" SPDX-FileCopyrightText = "© 2024 Sebastian Davids " @@ -44,6 +68,21 @@ SPDX-License-Identifier = "Apache-2.0" [[annotations]] path = [ + "scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-**", +] +SPDX-FileCopyrightText = "© 2002-2019 The M+ FONTS Project Authors" +SPDX-License-Identifier = "OFL-1.1" + +[[annotations]] +path = [ + "scripts/asciidoc/example-pdf/src/fonts/NotoEmoji-Regular.ttf", +] +SPDX-FileCopyrightText = "© 2013 Google LLC" +SPDX-License-Identifier = "OFL-1.1" + +[[annotations]] +path = [ + "scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-**", "scripts/latex/example/src/fonts/SourceCodePro-**", ] SPDX-FileCopyrightText = "© 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/)" @@ -51,6 +90,7 @@ SPDX-License-Identifier = "OFL-1.1" [[annotations]] path = [ + "scripts/asciidoc/example-pdf/src/fonts/SourceSans3-**", "scripts/latex/example/src/fonts/SourceSans3-**", ] SPDX-FileCopyrightText = "© 2010-2020 Adobe (http://www.adobe.com/)" @@ -58,6 +98,7 @@ SPDX-License-Identifier = "OFL-1.1" [[annotations]] path = [ + "scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-**", "scripts/latex/example/src/fonts/SourceSerif4-**", ] SPDX-FileCopyrightText = "© 2014 - 2023 Adobe (http://www.adobe.com/)" diff --git a/docs/user-guide/modules/ROOT/attachments/asciidoc/main.pdf b/docs/user-guide/modules/ROOT/attachments/asciidoc/main.pdf new file mode 100644 index 000000000..c61b639db Binary files /dev/null and b/docs/user-guide/modules/ROOT/attachments/asciidoc/main.pdf differ diff --git a/docs/user-guide/modules/ROOT/nav.adoc b/docs/user-guide/modules/ROOT/nav.adoc index d40613a0f..ad7fb2f78 100644 --- a/docs/user-guide/modules/ROOT/nav.adoc +++ b/docs/user-guide/modules/ROOT/nav.adoc @@ -6,6 +6,7 @@ * xref:index.adoc[] * xref:scripts/scripts.adoc[] ** xref:scripts/asciidoc/asciidoc.adoc[] +*** xref:scripts/asciidoc/asciidoc-pdf-build.adoc[] ** xref:scripts/cert/cert.adoc[] *** Standalone **** xref:scripts/cert/create-self-signed-cert.adoc[] diff --git a/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc-pdf-build.adoc b/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc-pdf-build.adoc new file mode 100644 index 000000000..f21182eed --- /dev/null +++ b/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc-pdf-build.adoc @@ -0,0 +1,229 @@ +// SPDX-FileCopyrightText: © 2024 Sebastian Davids +// SPDX-License-Identifier: Apache-2.0 += asciidoc_pdf_build +:script_url: https://github.com/sdavids/sdavids-shell-misc/blob/main/scripts/asciidoc/asciidoc_pdf_build.sh +:main_adoc_url: https://github.com/sdavids/sdavids-shell-misc/blob/main/scripts/asciidoc/example-pdf/src/main.adoc +:basic_theme_url: https://github.com/sdavids/sdavids-shell-misc/blob/main/scripts/asciidoc/example-pdf/src/themes/basic-theme.yml + +{script_url}[This script^] will typeset the documents of a given source directory into PDFs. + +The following parameters are optional: + +`f` :: delete the output directory before typesetting +`n` :: turn caching off +`o` :: the output directory (`$PWD/build` if not given) +`s` :: the source the directory (`$PWD/src` if not given) + +[NOTE] +==== +`*.adoc` files inside directories named `_includes` will not be typeset. + +This is useful for https://docs.asciidoctor.org/asciidoc/latest/directives/include/#when-is-an-include-directive-useful[AsciiDoc includes]. +==== + +[NOTE] +==== +If you want to use a https://docs.asciidoctor.org/pdf-converter/latest/theme/[custom theme], this script assumes that the theme is called `basic` and in the file `/themes/basic-theme.yml`. + +If you want to use custom fonts, this script assumes that the `ttf`-fonts are found in the `/fonts` directory. + +You can configure the https://docs.asciidoctor.org/pdf-converter/latest/image-paths-and-formats/#svg[font used by PlantUML] with the `/themes/basic-plantuml.cfg` file. +==== + +== Usage + +[,shell] +---- +$ tree --noreport -I scripts +. +└── src + └── index.adoc +$ scripts/asciidoc/asciidoc_pdf_build.sh +$ tree --noreport -I scripts +. +├── build +│ └── index.pdf <1> +└── src + └── index.adoc + +$ tree --noreport -a /tmp/example +/tmp/example +└── src + ├── _includes + │ └── footer.adoc + ├── a + │ ├── b + │ │ └── sub.adoc + │ └── dir.adoc + ├── fonts <2> + │ ├── JetBrainsMono-Bold.ttf + │ ├── JetBrainsMono-BoldItalic.ttf + │ ├── JetBrainsMono-Italic.ttf + │ ├── JetBrainsMono-Regular.ttf + │ ├── Lora-Bold.ttf + │ ├── Lora-BoldItalic.ttf + │ ├── Lora-Italic.ttf + │ ├── Lora-Regular.ttf + │ └── NotoEmoji-Regular.ttf + ├── index.adoc + └── themes + ├── basic-theme.yml <3> + └── basic-plantuml.cfg <4> +$ cat /tmp/example/src/themes/basic-theme.yml +--- +# https://github.com/asciidoctor/asciidoctor-pdf/blob/main/docs/theming-guide.adoc + +extends: default +font: + catalog: + JetBrainsMono: + normal: JetBrainsMono-Regular.ttf <5> + italic: JetBrainsMono-Italic.ttf + bold: JetBrainsMono-Bold.ttf + bold_italic: JetBrainsMono-BoldItalic.ttf + Lora: + normal: Lora-Regular.ttf + italic: Lora-Italic.ttf + bold: Lora-Bold.ttf + bold_italic: Lora-BoldItalic.ttf + NotoEmoji: NotoEmoji-Regular.ttf + fallbacks: [NotoEmoji] +base: + font-family: Lora +codespan: + font-family: JetBrainsMono +code: + font-family: JetBrainsMono +kbd: + font-family: JetBrainsMono +$ cat /tmp/example/src/themes/basic-plantuml.cfg +skinparam defaultFontName Lora <6> +$ cat /tmp/example/src/a/b/sub.adoc += Sub + +[plantuml] <7> +.... +@startuml + +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml + +Person(p, "Support") + +System(s, "Test System") + +Rel(p, s, "Uses", "https") + +@enduml +.... + +includes::../../_includes/footer.adoc[] +$ scripts/asciidoc/asciidoc_pdf_build.sh -s /tmp/example/src -o /tmp/example/out +$ tree --noreport -a /tmp/example -I src +/tmp/example +└── out <8> + ├── a + │ ├── b + │ │ ├── .asciidoctor <9> + │ │ │ └── diagram + │ │ │ └── diag-plantuml-md5-647767ca39d0b7ada6e2164960017d01.png.cache + │ │ ├── diag-plantuml-md5-647767ca39d0b7ada6e2164960017d01.png <9> + │ │ └── sub.pdf + │ └── dir.pdf + ├── diag-plantuml-md5-647767ca39d0b7ada6e2164960017d01.png <9> + └── index.pdf +$ scripts/asciidoc/asciidoc_pdf_build.sh -s /tmp/example/src -o /tmp/example/out -f -n +$ tree --noreport -a /tmp/example -I src +/tmp/example +└── out <10> + ├── a + │ ├── b + │ │ └── sub.pdf + │ └── dir.pdf + └── index.pdf +---- + +<1> the typeset PDF +<2> custom fonts +<3> custom theme +<4> PlantUML customization +<5> the custom theme uses the custom fonts +<6> PlantUML uses a custom font +<7> a document with an https://docs.asciidoctor.org/diagram-extension/latest/diagram_types/plantuml/[PlantUML diagram] +<8> notice there is no `footer.pdf` in an `_includes` directory +<9> the files of the https://docs.asciidoctor.org/diagram-extension/latest/generate/#diagram_caching[diagram cache] +<10> the output directory has been cleaned (`-f`) and no files for the cache have been created (`-n`) + +== Example + +{main_adoc_url}[main.adoc], +{basic_theme_url}[basic-theme.yml] + +[,console] +---- +$ cd scripts/asciidoc/example-pdf +$ ../asciidoc_pdf_build.sh +---- + +=> `build/main.pdf` + +Typeset PDF: xref:attachment$asciidoc/main.pdf[main.pdf] + +== Prerequisites + +* xref:developer-guide::dev-environment/dev-installation.adoc#docker[Docker] + +== Related Scripts + +* xref:scripts/pdf/pdf-remove-metadata.adoc[] ++ +[,shell] +---- +$ exiftool build/main.pdf +ExifTool Version Number : 12.76 +File Name : main.pdf +Directory : build +File Size : 132 kB +File Modification Date/Time : 2024:09:16 02:02:49+02:00 +File Access Date/Time : 2024:09:16 02:02:51+02:00 +File Inode Change Date/Time : 2024:09:16 02:02:49+02:00 +File Permissions : -rw-r--r-- +File Type : PDF +File Type Extension : pdf +MIME Type : application/pdf +PDF Version : 1.4 +Linearized : No +Page Count : 10 +Page Mode : UseOutlines +Title : AsciiDoc Showcase +Author : Sebastian Davids +Creator : Sebastian Davids +Producer : Asciidoctor PDF 2.3.18, based on Prawn 2.4.0 +Modify Date : 2024:09:15 23:58:24+00:00 +Create Date : 2024:09:16 00:02:45+00:00 +$ ../../pdf/pdf_remove_metadata.sh build/main.pdf +$ exiftool build/main.pdf +ExifTool Version Number : 12.76 +File Name : main.pdf +Directory : build +File Size : 132 kB +File Modification Date/Time : 2024:09:16 02:03:43+02:00 +File Access Date/Time : 2024:09:16 02:03:45+02:00 +File Inode Change Date/Time : 2024:09:16 02:03:43+02:00 +File Permissions : -rw------- +File Type : PDF +File Type Extension : pdf +MIME Type : application/pdf +PDF Version : 1.4 +Linearized : Yes +Page Mode : UseOutlines +Page Count : 10 +---- + +== More Information + +* https://github.com/asciidoctor/docker-asciidoctor[docker-asciidoctor] +* https://asciidoctor.org[Asciidoctor] +* https://docs.asciidoctor.org/asciidoc/latest/[AsciiDoc] +* https://docs.asciidoctor.org/pdf-converter/latest/[Asciidoctor PDF] +* https://docs.asciidoctor.org/pdf-converter/latest/theme/[Asciidoctor PDF - Theming] +* https://docs.asciidoctor.org/pdf-converter/latest/features/#limitations[Asciidoctor PDF - Known limitations] diff --git a/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc.adoc b/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc.adoc index 232760feb..7f3063f79 100644 --- a/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc.adoc +++ b/docs/user-guide/modules/ROOT/pages/scripts/asciidoc/asciidoc.adoc @@ -3,3 +3,5 @@ = AsciiDoc This section contains scripts related to https://docs.asciidoctor.org/asciidoc/latest/[AsciiDoc]: + +xref:scripts/asciidoc/asciidoc-pdf-build.adoc[]:: typeset the documents of a given directory into PDFs diff --git a/scripts/asciidoc/asciidoc_pdf_build.sh b/scripts/asciidoc/asciidoc_pdf_build.sh new file mode 100755 index 000000000..c5a34e680 --- /dev/null +++ b/scripts/asciidoc/asciidoc_pdf_build.sh @@ -0,0 +1,126 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: © 2024 Sebastian Davids +# SPDX-License-Identifier: Apache-2.0 + +set -Eeu -o pipefail -o posix + +# https://hub.docker.com/r/asciidoctor/docker-asciidoctor +readonly asciidoctor_version=1.80.0 +readonly asciidoctor_image="asciidoctor/docker-asciidoctor:${asciidoctor_version}" + +# https://stackoverflow.com/a/3915420 +# https://stackoverflow.com/questions/3915040/how-to-obtain-the-absolute-path-of-a-file-via-shell-bash-zsh-sh#comment100267041_3915420 +command -v realpath >/dev/null 2>&1 || realpath() { + if [ -h "$1" ]; then + # shellcheck disable=SC2012 + ls -ld "$1" | awk '{ print $11 }' + else + echo "$( + cd "$(dirname -- "$1")" >/dev/null + pwd -P + )/$(basename -- "$1")" + fi +} + +while getopts ':fno:s:' opt; do + case "${opt}" in + f) + force='true' + ;; + n) + no_cache='true' + ;; + o) + host_build_dir="${OPTARG}" + ;; + s) + host_src_dir="${OPTARG}" + ;; + ?) + echo "Usage: $0 -d [-n]" >&2 + exit 1 + ;; + esac +done + +readonly theme='basic' + +readonly force="${force:-false}" +readonly no_cache="${no_cache:-false}" + +host_src_dir="${host_src_dir:-$PWD/src}" + +if [ ! -d "${host_src_dir}" ]; then + printf "The source directory '%s' does not exist\n" "${host_src_dir}" >&2 + exit 1 +fi + +host_src_dir="$(realpath "${host_src_dir}")" +readonly host_src_dir + +host_build_dir="${host_build_dir:-$PWD/build}" + +if [ "${force}" = 'true' ] \ + && [ -d "${host_build_dir}" ] \ + && [ "${host_build_dir}" != "$PWD" ] \ + && [ "${host_build_dir}" != '.' ]; then + + rm -rf "${host_build_dir}" +fi + +mkdir -p "${host_build_dir}" + +host_build_dir="$(realpath "${host_build_dir}")" +readonly host_build_dir + +readonly src_dir='/documents' +readonly out_dir='/mnt/out' + +readonly build_dir="/tmp/build" + +cmd="asciidoctor-pdf -R ${src_dir} -D ${build_dir}" +cmd+=' -r asciidoctor-diagram' +cmd+=' -a toc' +# https://docs.asciidoctor.org/pdf-converter/latest/optimize-pdf/#enable-stream-compression +cmd+=' -a compress' +# https://docs.asciidoctor.org/pdf-converter/latest/icons/#icons-attribute +cmd+=' -a icons=font -a icon-set=fas' +if [ -d "${host_src_dir}/fonts" ]; then + # https://docs.asciidoctor.org/pdf-converter/latest/theme/apply-theme/#theme-and-font-directories + cmd+=" -a pdf-fontsdir=${src_dir}/fonts" +fi +if [ -d "${host_src_dir}/themes" ]; then + # https://docs.asciidoctor.org/pdf-converter/latest/theme/apply-theme/#theme-and-font-directories + cmd+=" -a pdf-themesdir=${src_dir}/themes" + if [ -f "${host_src_dir}/themes/${theme}-theme.yml" ]; then + # https://docs.asciidoctor.org/pdf-converter/latest/theme/apply-theme/#theme-and-font-directories + cmd+=" -a pdf-theme=${theme}-theme.yml" + fi + if [ -f "${host_src_dir}/themes/basic-plantuml.cfg" ]; then + # https://docs.asciidoctor.org/pdf-converter/latest/image-paths-and-formats/#svg + cmd+=" -a plantumlconfig=/documents/themes/basic-plantuml.cfg" + fi +fi +if [ "${no_cache}" != 'false' ]; then + # https://docs.asciidoctor.org/diagram-extension/latest/generate/#diagram_caching + cmd+=' -a diagram-nocache-option' +fi +cmd+=" '**/*.adoc'" +if [ "${no_cache}" = 'false' ]; then + cmd+=" && find ${build_dir} -depth -name '_includes' -type d -exec rm -rf {} \; && cp -r -f ${build_dir}/* ${out_dir}" +else + cmd+=" && cd ${build_dir} && find . -name '_includes' -prune -o \( -type f -name \*.pdf \) -exec cp --parents {} ${out_dir} \;" +fi +readonly cmd + +docker run \ + --user "$(id -u):$(id -g)" \ + --rm \ + --security-opt='no-new-privileges=true' \ + --cap-drop=all \ + --mount "type=bind,src=${host_src_dir},dst=${src_dir},readonly" \ + --mount "type=bind,src=${host_build_dir},dst=${out_dir}" \ + --env XDG_CACHE_HOME='/tmp' \ + "${asciidoctor_image}" \ + sh -c "${cmd}" diff --git a/scripts/asciidoc/example-pdf/.editorconfig b/scripts/asciidoc/example-pdf/.editorconfig new file mode 100644 index 000000000..11821edf0 --- /dev/null +++ b/scripts/asciidoc/example-pdf/.editorconfig @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: © 2024 Sebastian Davids +# SPDX-License-Identifier: Apache-2.0 + +# http://EditorConfig.org + +[*.cfg] +max_line_length = off + +[*.csv] +max_line_length = off +trim_trailing_whitespace = false + +[*.java] +max_line_length = 100 diff --git a/scripts/asciidoc/example-pdf/.gitattributes b/scripts/asciidoc/example-pdf/.gitattributes new file mode 100644 index 000000000..391948e2b --- /dev/null +++ b/scripts/asciidoc/example-pdf/.gitattributes @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: © 2024 Sebastian Davids +# SPDX-License-Identifier: Apache-2.0 + +# https://git-scm.com/docs/gitattributes + +*.java diff=java + +*.jpg binary -eol -whitespace +*.pdf binary -eol -whitespace +*.ttf binary -eol -whitespace diff --git a/scripts/asciidoc/example-pdf/.gitignore b/scripts/asciidoc/example-pdf/.gitignore new file mode 100644 index 000000000..51c3adf9a --- /dev/null +++ b/scripts/asciidoc/example-pdf/.gitignore @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Sebastian Davids +# SPDX-License-Identifier: Apache-2.0 + +# https://git-scm.com/docs/gitignore + +### Build ### +build/ diff --git a/scripts/asciidoc/example-pdf/src/_includes/contact.adoc b/scripts/asciidoc/example-pdf/src/_includes/contact.adoc new file mode 100644 index 000000000..5c66df733 --- /dev/null +++ b/scripts/asciidoc/example-pdf/src/_includes/contact.adoc @@ -0,0 +1,5 @@ +// keep this blank line for the ID to work + +// +[id=contact-{contact_id}] +{name} <{email}> diff --git a/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Bold.ttf b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Bold.ttf new file mode 100644 index 000000000..816e62f47 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Bold.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-BoldItalic.ttf b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-BoldItalic.ttf new file mode 100644 index 000000000..b8f402568 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-BoldItalic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Italic.ttf b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Italic.ttf new file mode 100644 index 000000000..63d3d3acf Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Italic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Regular.ttf b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Regular.ttf new file mode 100644 index 000000000..64dd8841a Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/MPlus1mn-Regular.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/NotoEmoji-Regular.ttf b/scripts/asciidoc/example-pdf/src/fonts/NotoEmoji-Regular.ttf new file mode 100644 index 000000000..69f381175 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/NotoEmoji-Regular.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Bold.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Bold.ttf new file mode 100644 index 000000000..4653b76c8 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Bold.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-BoldItalic.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-BoldItalic.ttf new file mode 100644 index 000000000..59e9319ac Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-BoldItalic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Italic.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Italic.ttf new file mode 100644 index 000000000..626044853 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Italic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Regular.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Regular.ttf new file mode 100644 index 000000000..b1fa336cd Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceCodePro-Regular.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Bold.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Bold.ttf new file mode 100644 index 000000000..969d7d4e6 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Bold.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-BoldItalic.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-BoldItalic.ttf new file mode 100644 index 000000000..22819c3e8 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-BoldItalic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Italic.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Italic.ttf new file mode 100644 index 000000000..5eb2375a7 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Italic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Regular.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Regular.ttf new file mode 100644 index 000000000..c906bdab8 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSans3-Regular.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Bold.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Bold.ttf new file mode 100644 index 000000000..10a40ad10 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Bold.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-BoldItalic.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-BoldItalic.ttf new file mode 100644 index 000000000..db0408d9d Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-BoldItalic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Italic.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Italic.ttf new file mode 100644 index 000000000..6fc037595 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Italic.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Regular.ttf b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Regular.ttf new file mode 100644 index 000000000..bd14f6c42 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/fonts/SourceSerif4-Regular.ttf differ diff --git a/scripts/asciidoc/example-pdf/src/images/dragonfly.jpg b/scripts/asciidoc/example-pdf/src/images/dragonfly.jpg new file mode 100644 index 000000000..e0a6e7377 Binary files /dev/null and b/scripts/asciidoc/example-pdf/src/images/dragonfly.jpg differ diff --git a/scripts/asciidoc/example-pdf/src/main.adoc b/scripts/asciidoc/example-pdf/src/main.adoc new file mode 100644 index 000000000..963784dd6 --- /dev/null +++ b/scripts/asciidoc/example-pdf/src/main.adoc @@ -0,0 +1,589 @@ +// SPDX-FileCopyrightText: © 2024 Sebastian Davids +// SPDX-License-Identifier: Apache-2.0 += AsciiDoc Showcase +Sebastian Davids +// no space here, otherwise the TOC will be placed incorrectly +:description: AsciiDoc Showcase +// https://docs.asciidoctor.org/asciidoc/latest/sections/section-ref/#section-attributes +:sectnums: +:sectanchors: +:sectlinks: +// https://docs.asciidoctor.org/asciidoc/latest/toc/position/ +:toc: macro +:toc-placement!: +// https://docs.asciidoctor.org/asciidoc/latest/macros/links/#hide-uri-scheme +:hide-uri-scheme: +// https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes-ref/#source-highlighting-and-formatting-attributes +:source-highlighter: rouge +:rouge-style: github +// https://docs.asciidoctor.org/asciidoc/latest/macros/images-directory/#imagesdir-attribute-syntax +:imagesdir: images +// https://docs.asciidoctor.org/asciidoc/latest/macros/ui-macros/ +:experimental: +// https://docs.asciidoctor.org/asciidoc/latest/document/doctype/ +:doctype: book +// https://docs.asciidoctor.org/asciidoc/latest/sections/chapters/#chapter-signifier +:!chapter-signifier: + +// https://docs.asciidoctor.org/asciidoc/latest/toc/position/#at-macro +toc::[] + +// https://docs.asciidoctor.org/asciidoc/latest/blocks/assign-id/ +[#source-code] +== Source Code + +=== Inline Source Code + +// https://docs.asciidoctor.org/asciidoc/latest/blocks/admonitions/ +[WARNING] +==== +Copy & Paste Hell! +==== + +// https://docs.asciidoctor.org/asciidoc/latest/verbatim/source-blocks/ +[source,java] +---- +class Main { + void main() { + System.out.println("Hello, World!"); + } +} +---- + +=== Included Source Code + +[TIP] +==== +Why not use the actual sources with highlighting, line numbers, callouts, and skip the file header? +==== + +// https://docs.asciidoctor.org/asciidoc/latest/blocks/add-title/ +// https://docs.asciidoctor.org/asciidoc/latest/verbatim/source-highlighter/#enable-line-numbering +// https://docs.asciidoctor.org/asciidoc/latest/verbatim/highlight-lines/ +// https://docs.asciidoctor.org/asciidoc/latest/directives/include-lines/ +[source,java,linenums,highlight=3..5] +.src/java/Main.java +---- +include::src/java/Main.java[lines=3..-1] +---- + +// https://docs.asciidoctor.org/asciidoc/latest/verbatim/callouts/ +<1> `// tag::main[]` starts a tag named "main" +<2> `// end::main[]` ends the tag + +Just the method defined with the `main` the tag and fix indentation: + +// https://docs.asciidoctor.org/asciidoc/latest/directives/include-with-indent/ +// https://docs.asciidoctor.org/asciidoc/latest/directives/include-tagged-regions/ +[source,java,indent=0] +---- +include::src/java/Main.java[tags=main] +---- + +== Miscellaneous + +=== Software Documentation + +// https://docs.asciidoctor.org/asciidoc/latest/macros/keyboard-macro/#keyboard-macro-syntax +kbd:[Ctrl+Alt+Delete] + +// https://docs.asciidoctor.org/asciidoc/latest/macros/ui-macros/#button-macro-syntax +Press btn:[OK] + +// https://docs.asciidoctor.org/asciidoc/latest/macros/ui-macros/#menu-macro-syntax +Select menu:File[Export > RAW] + +=== Sidebars + +// https://docs.asciidoctor.org/asciidoc/latest/blocks/sidebars/ +.Delete commented lines with sed +**** +IMPORTANT: Unfortunately, Mac und Linux handle `sed -i` differently: + +.Mac +[source,shell] +---- +sed -i '' '/^[@#]/d' "$file" +---- + +.Linux +[source,shell] +---- +sed -i '/^[@#]/d' "$file" +---- +**** + +=== Anchors + +// https://docs.asciidoctor.org/asciidoc/latest/macros/xref/#internal-cross-references +<> + +// https://docs.asciidoctor.org/asciidoc/latest/macros/xref/#explicit-link-text +<> + +// https://docs.asciidoctor.org/asciidoc/latest/directives/include-multiple-times-in-same-document/ +xref:contact-chowe[Cameron Howe] + +xref:contact-jmacmillan[Joe MacMillan] + +== Lists + +// https://docs.asciidoctor.org/asciidoc/latest/lists/ordered/#styles +[decimal] +. numbered + +.. bulleted + +* one +* two + +// https://docs.asciidoctor.org/asciidoc/latest/macros/url-macro/#link-text +.. with colored symbols (colors defined as https://docs.asciidoctor.org/pdf-converter/latest/roles/[roles] in `themes/basic-theme.yml`) ++ +// https://docs.asciidoctor.org/asciidoc/latest/lists/unordered/#custom-markers +[unstyled] +// https://docs.asciidoctor.org/pdf-converter/latest/theme/custom-role/ +** [.green]#▲# positive +** ▶︎ neutral +** [.red]#▼# negative + +// https://docs.asciidoctor.org/asciidoc/latest/lists/separating/#using-a-line-comment +//- + +[arabic] +. separate two consecutive lists with `//-`. +// https://docs.asciidoctor.org/asciidoc/latest/lists/continuation/#list-continuation ++ +more content for the same item ++ +[source,java] +---- +System.out.println("YAY!"); +---- ++ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut odio augue. Nam tristique rhoncus tortor, vitae sollicitudin risus hendrerit. + +. definition lists + +.. Question/Answer ++ +// https://docs.asciidoctor.org/asciidoc/latest/lists/qanda/ +[qanda] +What is the answer?:: +42 + +Computer says?:: +Is it safe?:: +No. + +.. on next line ++ +// https://docs.asciidoctor.org/asciidoc/latest/lists/description/ +e.g.:: for example ++ +[CAUTION] +==== +Do not confuse with <> +==== +[#abbrev-ie] +i.e.:: that is +et al.:: and others + +.. on same line +// https://docs.asciidoctor.org/asciidoc/latest/lists/horizontal/ +[horizontal] +small:: ++ +// https://docs.asciidoctor.org/asciidoc/latest/macros/image-size/ +image::dragonfly.jpg[,100] + +normal:: ++ +image::dragonfly.jpg[,200] + +large:: ++ +image::dragonfly.jpg[] + +. includes with parameters ++ +[disc] +// https://docs.asciidoctor.org/asciidoc/latest/directives/include-list-item-content/ +* {empty} ++ +-- +// https://docs.asciidoctor.org/asciidoc/latest/directives/include-multiple-times-in-same-document/ +:contact_id: chowe +:name: Cameron Howe +:email: c.howe@mutiny.com + +include::_includes/contact.adoc[] +-- ++ +* {empty} ++ +-- +:contact_id: jmacmillan +:name: Joe MacMillan +:email: j.macmillan@calnect.com + +include::_includes/contact.adoc[] +-- + +== Tables + +=== Simple + +// https://docs.asciidoctor.org/asciidoc/latest/tables/build-a-basic-table/#add-a-header-row-to-the-table +// https://docs.asciidoctor.org/asciidoc/latest/tables/format-cell-content/ +// https://docs.asciidoctor.org/asciidoc/latest/tables/align-by-cell/#horizontal-operators +[%header,cols="1,^1,>2m"] +|=== + +| First +| Last +| Money ($) + +| Homer +| Simpson +|-12.76 + +| Marge +| Simpson +| 4,538.90 + +|=== + +=== Inline CSV + +// https://docs.asciidoctor.org/asciidoc/latest/tables/striping/ +[stripes=odd] +,=== +1,2,3 +4,5,6 +7,8,9 +,=== + +=== Included CSV + +// https://docs.asciidoctor.org/asciidoc/latest/tables/data-format/#csv-and-tsv +[%header,format=csv] +|=== +include::src/csv/data.csv[] +|=== + +=== Cell Content + +// https://docs.asciidoctor.org/asciidoc/latest/tables/format-cell-content/#cell-styles-and-their-operators +[cols="1,2a"] +|=== +| Col 1 | Col 2 + +// https://docs.asciidoctor.org/asciidoc/latest/tables/align-by-cell/#vertical-operators +.>| Source Code +| + +[source,java] +---- +List collectorCollection = + productList.stream().map(Product::getName).collect(Collectors.toList()); +---- + +.^| List +| + +. one +. two +.. two-one +. three + +.<| Table in Table +| + +[cols="2,1a"] +!=== +! Col1 ! Col2 + +! C11 +! C12 + +!=== + +|=== + +== Diagrams + +[#mindmap] +=== MindMap + +// https://docs.asciidoctor.org/diagram-extension/latest/diagram_types/plantuml/ +[plantuml,diagram-mindmap,svg] +.... +@startmindmap + +* Colors +**[#lightgreen] Green + +left side + +**[#ffbbcc] Rose + +right side + +**[#lightblue] Blue + +@endmindmap +.... + +https://plantuml.com/mindmap-diagram[MindMap] + +=== Class Diagram + +[plantuml,diagram-classes,svg] +.... +@startuml + +hide members +hide circle + +interface Repository <> +abstract AbstractDbRepository +class FileRepository +class SQLiteRepository +class PostgreSQLRepository + +Repository <|-- AbstractDbRepository +Repository <|-- FileRepository +AbstractDbRepository <|-- PostgreSQLRepository +AbstractDbRepository <|-- SQLiteRepository + +@enduml +.... + +https://plantuml.com/class-diagram[Class Diagram] + +=== Sequence Diagram + +[plantuml,diagram-sequence,svg] +.... +@startuml + +skinparam responseMessageBelowArrow true + +autonumber + +Alice -> Bob: Wassup? +... +...5 minutes later... +... +Alice <- Bob: AAK + +@enduml +.... + +https://plantuml.com/sequence-diagram[Sequence Diagram] + +=== Activity Diagram + +[plantuml,diagram-activity,svg] +.... +@startuml + +start +if (condition A) then (yes) + :Text 1; +elseif (condition B) then (yes) + fork + :A; + fork again + :B; + end fork {or} + :Text 2; + end +else (no) + fork + :C; + fork again + :D; + end merge + :Text 3; +endif +:Text 4; +stop + +@enduml +.... + +https://plantuml.com/activity-diagram-beta[Activity Diagram] + +[#c4-diagram] +=== C4 Diagram + +[plantuml,diagram-c4,svg] +---- +@startuml + +!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml + +HIDE_STEREOTYPE() + +Person(s, "Support") +Person(c, "Customer") + +System(t, "Test System") +System(p, "Prod System") +SystemDb_Ext(i, "Issue Tracker") + +Rel(s, i, "Uses", "https") +Rel(s, t, "Uses", "https") +Rel_L(s, p, "Uses", "https") + +Rel_R(c, p, "Uses", "https") +Rel(c, i, "Uses", "https") + +@enduml +---- + +https://github.com/plantuml-stdlib/C4-PlantUML?tab=readme-ov-file#system-context--system-landscape-diagrams[C4-PlantUML] + +// https://docs.asciidoctor.org/asciidoc/latest/blocks/breaks/#page-breaks +<<< + +=== Tree Diagram + +[plantuml,diagram-tree,svg] +.... +@startuml + +skinparam Legend { + BackgroundColor transparent + BorderColor transparent +} +legend +Root +|_ 1 + |_ a + |_ b +|_ 2 + |_ a +end legend + +@enduml +.... + +=== Math Diagrams + +[cols=".^1a,.^1a"] +|=== + +| + +[plantuml,diagram-math1,svg] +.... +@startmath +f(t)=(a_0)/2 + sum_(n=1)^ooa_ncos((npit)/L)+sum_(n=1)^oo b_n\ sin((npit)/L) +@endmath +.... + +| + +[plantuml,diagram-math2,svg] +.... +@startmath +[[a,b\],[c,d\]\]((n),(k)) +@endmath +.... + +|=== + +https://plantuml.com/ascii-math[Math Diagram] + +=== Gantt Diagrams + +// https://docs.asciidoctor.org/asciidoc/latest/macros/image-position/#positioning-attributes +[plantuml,diagram-gant1,svg,align="center"] +.... +@startgantt + +hide footbox + +saturday are closed +sunday are closed + +Project starts 2024-09-16 +Print between 2024-09-16 and 2024-10-25 + +[Review 1] as [R1] happens at 2024-09-25 +[Review 2] as [R2] happens on 14 days after [R1]'s end +[Review 3] as [R3] happens on 14 days after [R2]'s end + +@endgantt +.... + +// https://docs.asciidoctor.org/asciidoc/latest/macros/image-size/#width-and-height-attributes +[plantuml,diagram-gant2,svg,align="center",width=560] +.... +@startgantt + +language de + +hide footbox + +saturday are closed +sunday are closed + +Project starts 2024-09-16 +Print between 2024-09-16 and 2024-10-25 + +[Review 1] as [R1] happens at 2024-09-25 +[Review 2] as [R2] happens on 14 days after [R1]'s end +[Review 3] as [R3] happens on 14 days after [R2]'s end + +@endgantt +.... + +[plantuml,diagram-gant3,svg,align="center"] +.... +@startgantt + + + +hide footbox + +[Task1] as [T1] requires 4 days +[T1] is colored in Orange + +then [Task2] as [T2] requires 6 days +[T2] is colored in Orange + +-- Phase 2 -- + +then [Task3] as [T3] requires 10 days +[T3] is colored in Orange + +[Task4] as [T4] requires 5 day + +[T2] -> [T4] + +-- Phase 3 -- + +[Task 6] as [T6] requires 4 days +[T6] is colored in Orange +[T3] -> [T6] + +legend +|= Color |= Task Type | +|<#Orange>| Critical Path | +end legend + +@endgantt +.... + +https://plantuml.com/gantt-diagram[Gantt Diagram] diff --git a/scripts/asciidoc/example-pdf/src/src/csv/data.csv b/scripts/asciidoc/example-pdf/src/src/csv/data.csv new file mode 100644 index 000000000..f11ba0a41 --- /dev/null +++ b/scripts/asciidoc/example-pdf/src/src/csv/data.csv @@ -0,0 +1,4 @@ +Height,Weight +15,23.4 +17,26.7 +23,45 diff --git a/scripts/asciidoc/example-pdf/src/src/java/Main.java b/scripts/asciidoc/example-pdf/src/src/java/Main.java new file mode 100644 index 000000000..b7b42f780 --- /dev/null +++ b/scripts/asciidoc/example-pdf/src/src/java/Main.java @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: © 2024 Sebastian Davids +// SPDX-License-Identifier: Apache-2.0 + +class Main { + // tag::main[] <1> + void main() { + System.out.println("Hello, World!"); + } + // end::main[] <2> +} diff --git a/scripts/asciidoc/example-pdf/src/themes/basic-plantuml.cfg b/scripts/asciidoc/example-pdf/src/themes/basic-plantuml.cfg new file mode 100644 index 000000000..8c2cb4045 --- /dev/null +++ b/scripts/asciidoc/example-pdf/src/themes/basic-plantuml.cfg @@ -0,0 +1,5 @@ +' SPDX-FileCopyrightText: © 2024 Sebastian Davids +' SPDX-License-Identifier: Apache-2.0 + +' https://docs.asciidoctor.org/pdf-converter/latest/image-paths-and-formats/#svg +skinparam defaultFontName SourceSans3 diff --git a/scripts/asciidoc/example-pdf/src/themes/basic-theme.yml b/scripts/asciidoc/example-pdf/src/themes/basic-theme.yml new file mode 100644 index 000000000..7373da7d2 --- /dev/null +++ b/scripts/asciidoc/example-pdf/src/themes/basic-theme.yml @@ -0,0 +1,62 @@ +--- +# SPDX-FileCopyrightText: © 2024 Sebastian Davids +# SPDX-License-Identifier: Apache-2.0 + +# https://github.com/asciidoctor/asciidoctor-pdf/blob/main/docs/theming-guide.adoc + +extends: default +page: + margin: [2cm, 2.5cm, 1.5cm, 2cm] # DIN 5008 +footer: + border_width: 0 +font: + catalog: + MPlus1mn: # needed for circled numbers (callouts) + normal: MPlus1mn-Regular.ttf + italic: MPlus1mn-Italic.ttf + bold: MPlus1mn-Bold.ttf + bold_italic: MPlus1mn-BoldItalic.ttf + SourceCodePro: + normal: SourceCodePro-Regular.ttf + italic: SourceCodePro-Italic.ttf + bold: SourceCodePro-Bold.ttf + bold_italic: SourceCodePro-BoldItalic.ttf + SourceSans3: + normal: SourceSans3-Regular.ttf + italic: SourceSans3-Italic.ttf + bold: SourceSans3-Bold.ttf + bold_italic: SourceSans3-BoldItalic.ttf + SourceSerif4: + normal: SourceSerif4-Regular.ttf + italic: SourceSerif4-Italic.ttf + bold: SourceSerif4-Bold.ttf + bold_italic: SourceSerif4-BoldItalic.ttf + NotoEmoji: NotoEmoji-Regular.ttf + fallbacks: [NotoEmoji] +base: + font-family: SourceSerif4 +codespan: + font-family: SourceCodePro + font-color: '#000000' +code: + font-family: SourceCodePro +conum: + font-family: MPlus1mn +heading: + font-family: SourceSans3 +kbd: + font-family: SourceCodePro +title-page: + font-family: SourceSans3 +admonition: + icon: + caution: + name: fas-exclamation + stroke-color: '#bf6900' + tip: + stroke-color: '#ffd300' +role: + red: + font_color: '#ff0000' + green: + font_color: '#00aa00'