- Shell 100%
https://gitlab.com/fedora/docs/templates/fedora-docs-template Initial Commit switch to Antora Preview of the whole site preview.sh: Allow preview.sh keep running for multiple build.sh calls antora deletes and recreates public/ every time the docs are rebuilt; mounting public/ directly meant that when build.sh, the existing nginx container didn't see the new docs. Instead of mounting public/ directly into the nginx default webroot, mount the parent directory at /antora, and install a tiny nginx configuration file to point the webroot at the right place. fix preview.sh for macOS Issue 3 - Check if sudo is really required to run docker Provide better messages on the command line deduplicate and in build.sh Use podman as an option for local build/preview docs The podman binary is an alternative to docker that might be used by some people in preference. In this use case it's a drop in replacement, we can just check for it, else we just use docker as before. Signed-off-by: Peter Robinson <pbrobinson@gmail.com> using podman on Fedora — root not required anymore Add workaround for --directory flag breaking in preview.sh script Closes #13. authors example Add LICENSE It's oven not owen Replace test == operator with = The == operator of test (invoked as [) is a Bash extension. Use the = operator of [POSIX test] for string equality. [POSIX test]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html Signed-off-by: Kevin Locke <kevin@kevinlocke.name> Quote command substitution which may have spaces If $(pwd) or $(uname -s) contain spaces, their output will undergo word splitting and be passed as multiple arguments, which would cause the programs receiving them to misbehave. Avoid this by quoting. Signed-off-by: Kevin Locke <kevin@kevinlocke.name> Fix misspellings build.sh: fix misspelling and replace tab with spaces Some lines had tabs, others had spaces. Uniformizing for spaces. Add proper partials and examples directories with usage notes Fix typo in README Update build script for Aarch64 and local antora installs Fix if conditions in build.sh Earlier comment removed quotation from around command substitions $(). This is not a good idea, because if the substitution produces whitespace, without the quotes, the result is not interpreted as a single string. Pattern 'if [ $(uname) == "foo" ]' is replaced with 'uname | grep -iwq foo' here. Apart from following good shell scripting practices, this commit fixes the problem where the script failed if the current working directory's patch contained whitespace. Fix the Linux docker branch of build.sh There were multiple problems in the Linux docker branch of build.sh: - Intendation was wrong - There was a reference to undefined variable $runtime, leading to corrupted output. - Output had strange linebreaks. Fix intendation in build.sh error branch Use `version: ~` in antora.yml Antora 3 has deprecated `version: master`. Replacing it with a current alternative. Update configuration for Antora 3.0 Whitespace and formating cleanup build.sh: Properly quote all variables Fix overquoting for ${cmd} Fixes: ``` $ ./build.sh This build script is using Podman to run the build in an isolated environment. antora: option '--html-url-extension-style <choice>' argument 'indexify site.yml' is invalid. Allowed choices are default, drop, indexify. ``` update antora playbook add preview pages remove indexify extension from args build.sh: Fix overquoting again Missed in 7d3a02b add content related issue template update antora config & CI workflow Update and correct licensing information site.yaml: Use indexify mode for URLs Official Fedora docs use that extension thus keep using it for local preview. Fixes: https://gitlab.com/fedora/docs/templates/fedora-docs-template/-/issues/4 This reworks commit bca134e1c05d93db7acecacdfefc4afabd8a1223. Improve .gitignore The intent of existing .gitignore was to ignore some directories at repository root. Instead, it was ignoring any file or directory by given names, anywhere in the tree. Improve rules to only match the intended cases. feat: add new builder script feat(docsbuilder.sh): add MIT license Fixes https://gitlab.com/fedora/docs/templates/fedora-docs-template/-/issues/5 docsbuilder: chmod a+x Update README.md with docsbuilder command Adding podman to the description. docsbuilder: Use command to find binaries in PATH Do not assume that commands are installed in a specific PATH and use `command` instead to find them. This makes running this inside toolbox works. README: Re-add nginx.conf and update for osbuilder script Use custom Antora image |
||
|---|---|---|
| modules/ROOT | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| antora.yml | ||
| docsbuilder.sh | ||
| LICENSE | ||
| nginx.conf | ||
| README.md | ||
| site.yml | ||
Fedora Docs Template
This repository contains a minimal source structure for a new Fedora Docs source.
Structure
|-- README.md
|-- antora.yml ....................... 1.
|-- docsbuilder.sh ................... 2.
|-- nginx.conf ....................... 3.
|-- site.yml ......................... 4.
`-- modules
`-- ROOT ......................... 5.
|-- assets
| `-- images ............... 6.
| `-- *
|-- nav.adoc ................. 7.
`-- pages .................... 8.
`-- *.adoc
- Metadata definition.
- A script that does a local build. It shows a preview of the site in a web browser by running a local web server. Uses podman or Docker.
- A configuration file used by the local preview web server.
- A definition file for the build script.
- A "root module of this documentation component". Please read below for an explanation.
- Images to be used on any page.
- Menu definition. Also defines the hierarchy of all the pages.
- Pages with the actual content. They can be also organised into subdirectories if desired.
Components and Modules
Antora introduces two new terms:
- Component — Simply put, a component is a part of the documentation website with its own menu. Components can also be versioned. In the Fedora Docs, we use separate components for user documentation, the Fedora Project, Fedora council, Mindshare, FESCO, but also subprojects such as CommOps or Modularity.
- Module — A component can be broken down into multiple modules. Modules still share a single menu on the site, but their sources can be stored in different git repositories, even owned by different groups. The default module is called "ROOT" (that's what is in this example). If you don't want to use multiple modules, only use "ROOT". But to define more modules, simply duplicate the "ROOT" directory and name it anything you want. You can store modules in one or more git repositories.
Local preview
This repo includes a script to build and preview the contents of this repository.
NOTE: Please note that if you reference pages from other repositories, such links will be broken in this local preview as it only builds this repository. If you want to rebuild the whole Fedora Docs site, please see the Fedora Docs build repository for instructions.
The script works on Fedora (using Podman or Docker) and macOS (using Docker).
To build and preview the site, run:
$ ./docsbuilder.sh -p
The result will be available at http://localhost:8080
To stop the preview:
$ ./docsbuilder.sh -k
Installing Podman on Fedora
Fedora Workstation doesn't come with Podman preinstalled by default — so you might need to install it using the following command:
$ sudo dnf install podman
Preview as a part of the whole Fedora Docs site
You can also build the whole Fedora Docs site locally to see your changes in the whole context.
This is especially useful for checking if your xref links work properly.
To do this, you need to clone the main Fedora Docs build repository, modify the site.yml file to reference a repo with your changes, and build it.
Steps:
Clone the main repository and cd into it:
$ git clone https://pagure.io/fedora-docs/docs-fp-o.git
$ cd docs-fp-o
Find a reference to the repository you're changing in the site.yml file, and change it so it points to your change.
So for example, if I made a modification to the Modularity docs, I would find:
...
- url: https://pagure.io/fedora-docs/modularity.git
branches:
- master
...
And replaced it with a pointer to my fork:
...
- url: https://pagure.io/forks/asamalik/fedora-docs/modularity.git
branches:
- master
...
I could also point to a local repository, using HEAD as a branch to preview the what's changed without the need of making a commit.
Note: I would need to move the repository under the docs-fp-o directory, because the builder won't see anything above.
So I would need to create a repositories directory in docs-fp-o and copy my repository into it.
...
- url: ./repositories/modularity
branches:
- HEAD
...
To build the whole site, I would run the following in the docs-fp-o directory.
$ ./docsbuilder.sh -p
License
SPDX-License-Identifier: CC-BY-SA-4.0