Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DOCTOOLS.README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Documentation tools cheatsheet for beginners

CFEngine technical documentation is written using a Markdown formatting (see [Markdown Cheatsheet][Markdown Cheatsheet]) and published using a combination of Jekyll and various plugins (see [CFEngine Documentation][CFEngine Documentation]).
CFEngine technical documentation is written using a Markdown formatting (see [Markdown Cheatsheet][Markdown Cheatsheet]) and published using Hugo and our own pre- and post-processing scripts (see [CFEngine Documentation][CFEngine Documentation]).

The various Markdown and other files (e.g. images) that make up the volume of CFEngine documentation are held in a master source code repository. Contributors to the documentation make their own changes in local copies of the documentation Markdown on their own machines and then push those changes to a remote branch.

From there a request is made to merge the modifications back into the mainline, from which the Jekyll tooling will be triggered to import and then render the final documentation in HTML.
From there a request is made to merge the modifications back into the mainline, from which the Hugo tooling will be triggered to import and then render the final documentation in HTML.

## Git and GitHub

Expand Down
15 changes: 4 additions & 11 deletions cheatsheet.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ SELECT
+* always run it through Pygments plus the appropriate lexer
+
+Most important are the `cf3` lexer, as well as `bash`, `console`,
+`diff`, `shell-session` and `postgresql`. But Jekyll supports
+`diff`, `shell-session` and `postgresql`. But Hugo supports
+[many more lexers](http://pygments.org/docs/lexers/)
+
* avoid custom color schemes and hand-coded HTML
Expand All @@ -397,7 +397,7 @@ index 92555a2..b49c0bb 100644
+* always run it through Pygments plus the appropriate lexer
+
+Most important are the `cf3` lexer, as well as `bash`, `console`,
+`diff`, `shell-session` and `postgresql`. But Jekyll supports
+`diff`, `shell-session` and `postgresql`. But Hugo supports
+[many more lexers](http://pygments.org/docs/lexers/)
+
* avoid custom color schemes and hand-coded HTML
Expand Down Expand Up @@ -582,18 +582,11 @@ updated with each new version.

Variables that are defined in the front matter (thats the content between the
three dashes at the top) or in
[\_config.yaml](https://github.com/cfengine/documentation/blob/master/generator/_config.yml)
[hugo/config.toml](https://github.com/cfengine/documentation/blob/master/hugo/config.toml)
can be used directly within markdown.

For example this is the '{{< params "CFE_manuals_version" >}}' version of the
documentation. That variable comes from \_config.yaml.

Since liquid variables look a lot like mustache variables any time you want to
show the actual variables will need to be inside of raw tags.

{% raw %}
site.CFE_manuals_version {{ site.CFE_manuals_version }}
{% endraw %}
documentation. That variable comes from hugo/config.toml.

## Testing

Expand Down
81 changes: 12 additions & 69 deletions generator/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -15,85 +15,29 @@ formatting examples including usage of our custom extensions.
:END:

For a given branch it can be useful to define variables that can be expanded
anywhere in the documentation. Variables can be defined in [[./_config.yml][=_config.yml=]] and
then referenced in markdown. Jekyll uses the [[https://github.com/Shopify/liquid/wiki][Liquid templating language]] to
process templates.

[[https://github.com/cfengine/documentation/commit/1793bf6fe8a632e5bb290290cd6044695728f2a6][This commit]] shows liquid variables in use.
anywhere in the documentation. Variables are defined under =[params]= in
[[../hugo/config.toml][=hugo/config.toml=]] and referenced in markdown with the =params= shortcode, for
example ={{< params "CFE_manuals_version" >}}=.

* Building Documentation
:PROPERTIES:
:ID: 4e51b3c2-0970-438d-9587-6a54369533a6
:END:

The documentation is rendered using [[https://jekyllrb.com/][jekyll]]. Jekyll is a ruby based static site
generator and is the engine used by GitHub Pages.
The documentation is rendered using [[https://gohugo.io/][Hugo]]. The Hugo site lives in [[../hugo][=hugo/=]]
and the version used by the build is installed by [[./build/install_hugo.sh][=build/install_hugo.sh=]].

** Build Environment Setup
** Building Locally
:PROPERTIES:
:ID: 6b24605a-c9f6-481a-9af5-97aafb68115e
:END:

*Note:* The documentation build environment has very particular requirements for
*old* libraries and environment.

*** Installation
:PROPERTIES:
:ID: 8a488c3a-6870-463d-bb6a-eba032727aba
:END:

This installation was tested on ubuntu 10.04 with vagrant, ruby 1.9.3 and
Java 7. Make sure your machine has everything according to jekyll requirements:
https://github.com/mojombo/jekyll.

=git= is required to checkout documentation.

You also need:
- =java= - for closure compiler
- =python-pygments= 1.5 or later for the code highlighting

Gems:
- =jekyll-asset-pipeline=
- =closure-compiler=
- =yui-compressor=
- =redcarpet=
- =albino=
- =uglifier=
- =execjs=
- =sanitize=

If =pandoc= is used:
- =pandoc-ruby=
- =rdiscount=


- [[./_setup/start.sh][=_setup/start.sh=]] is a shell script to install these dependencies. It needs to
be reviewed and adjusted to your environment accordingly. Clean setup

- Review steps described in file [[./_setup/step2.txt][=_setup/step2.txt=]]

- Create pages folder and checkout [[https://github.com/cfengine/documentation.git][CFEngine documentation]] inside.

- All *content* files should be inside [[./pages][=pages=]] folder.
- All files must have *=meta=* data on top. See (Page meta data section).
- Templates are saved in the [[./_layouts][=_layouts=]] folder.
- Images and other materials saved in *media* folder.
- JS and css saved in _assets folder. To include new files open
[[./_includes/head.html][=_includes/head.html=]] file.
- Make sure you set correct settings in =_config.yml= for =CFE_OUTPUT= and
=CFE_DIR=

To build the project change into to the project root folder and run =jekyll=.
Your can find the finished rendered files inside [[./pages][=pages=]] folder

Run local server and automatically build changes to pages:
Change into the project root folder and run =jekyll --auth --server 4000=
where =4000= is the local port number to run the webserver on.

*Note:* you must restart server after changes in =_config.yml=.
The easiest way to build the documentation locally is [[../build-locally.sh][=build-locally.sh=]] in the
repository root. It clones the other repositories the build needs into =tmp/=
and runs the same Docker-based pipeline as CI. See the comments at the top of
the script for the available options.

To configure jekyll edit =_config.yml=. See the [[https://github.com/mojombo/jekyll/wiki/Configuration][jekyll Configuration Wiki]] for a
description of all available options.
See [[./build/README.md][=build/README.md=]] for running the container build manually.

** CI Pipelines for Documentation
:PROPERTIES:
Expand Down Expand Up @@ -125,7 +69,6 @@ After all repositories are updated and available the following is executed.

#+BEGIN_SRC sh
export WRKDIR=`pwd`
$WRKDIR/documentation/generator/_scripts/cfdoc_bootstrap.py master
cd $WRKDIR/core
NO_CONFIGURE=1 ./autogen.sh
#+END_SRC
Expand Down Expand Up @@ -174,7 +117,7 @@ Once the syntax map has been regenerated [[https://github.com/cfengine/documenta
(whatever that means), resolving links, expanding our custom macros and creating
printable (dead trees) versions of the documentation.

After pre-processing is complete [[https://github.com/cfengine/documentation/blob/master/generator/_scripts/_run.sh][_run.sh]] performs the =jekyll= build,
After pre-processing is complete [[https://github.com/cfengine/documentation/blob/master/generator/_scripts/_run.sh][_run.sh]] performs the Hugo build and
post processes the build with [[https://github.com/cfengine/documentation/blob/master/generator/_scripts/cfdoc_postprocess.py][cfdoc_postprocess.py]]

*** Publishing
Expand Down
48 changes: 0 additions & 48 deletions generator/_config.yml

This file was deleted.

65 changes: 0 additions & 65 deletions generator/_scripts/_create_pdf.sh

This file was deleted.

45 changes: 0 additions & 45 deletions generator/_scripts/bootstrap-build.sh

This file was deleted.

39 changes: 0 additions & 39 deletions generator/_scripts/cfdoc_bootstrap.py

This file was deleted.

18 changes: 1 addition & 17 deletions generator/_scripts/cfdoc_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,7 @@ def validate(branch):
config["include_directories"].append(config["WORKDIR"] + "/core/tests")

config["reference_path"] = config["project_directory"] + "/_references.md"
config["config_path"] = config["project_directory"] + "/_config.yml"

with open(config["config_path"], "r") as config_file:
lines = config_file.readlines()
for line in lines:
comment = line.find("#")
if comment != -1:
line = line[:comment]
assign = line.split(":")
if assign.__len__() != 2:
continue
if assign[1] == "" or assign[1] == "\n":
continue
key = assign[0].lstrip().rstrip()
value = assign[1].lstrip().rstrip()

config[key] = value
config["CFE_DIR"] = "_site"

print("cfdoc_environment: cwd = " + os.getcwd())
print(" config = ")
Expand Down
Loading
Loading