[gegl] docs: only use source-highlight if present



commit 54f52062868a7eaf664f89265fb19482a9fbd89f
Author: John <jtm home gmail com>
Date:   Sun Feb 14 23:11:12 2021 +0000

    docs: only use source-highlight if present

 docs/commandline.adoc                           | 20 ++++++++++++--------
 docs/development.adoc                           |  8 ++++++--
 docs/hello-world.adoc.in                        | 12 +++++++-----
 docs/meson.build                                |  4 +++-
 docs/website/meson.build                        | 17 ++++++++++-------
 docs/website/{src-no-highlight.txt => src.adoc} |  8 ++++++--
 6 files changed, 44 insertions(+), 25 deletions(-)
---
diff --git a/docs/commandline.adoc b/docs/commandline.adoc
index 19ced6637..07479aaa0 100644
--- a/docs/commandline.adoc
+++ b/docs/commandline.adoc
@@ -1,23 +1,27 @@
 gegl command-line
 -----------------
 
-In addition to installing a library, GEGL also installs gegl - a binary/program
-that permits doing image processing from the command-line as well as an aid
-during development of GEGL operations.
+In addition to installing a library, GEGL also installs gegl - a
+binary/program that permits doing image processing from the command-line
+as well as an aid during development of GEGL operations.
 
 Some examples:
 
-Render a composition to a PNG file, the composition can be in GEGLs XML format
-or the one-liner friendly terser link:gegl-chain.html[gegl-chain] format.
+Render a composition to a PNG file, the composition can be in GEGLs XML
+format or the one-liner friendly terser link:gegl-chain.html[gegl-chain]
+format.
 
- $ gegl composition -o composition.png
+ $ gegl composition.xml -o composition.png
 
 gegl usage
 ~~~~~~~~~~
 
-The following is the usage information of the gegl binary, this documentation
-might not be complete.
+The following is the usage information of the gegl binary, this
+documentation might not be complete.
 
+ifeval::["{highlight}" == "true"]
+[source, txt]
+endif::[]
 -------
 include::{gegl_usage}[gegl-usage.txt]
 -------
diff --git a/docs/development.adoc b/docs/development.adoc
index cae1a6358..5ad19d7ce 100644
--- a/docs/development.adoc
+++ b/docs/development.adoc
@@ -132,7 +132,11 @@ For creating the graph image:
 
 This is the gaussian-blur.xml file:
 
----------------------------------------------
+.gaussian-blur.xml
+ifeval::["{highlight}" == "true"]
+[source, xml]
+endif::[]
+-----
 <?xml version='1.0' encoding='UTF-8'?>
 <gegl>
   <node operation='gegl:gaussian-blur'>
@@ -147,7 +151,7 @@ This is the gaussian-blur.xml file:
     </params>
   </node>
 </gegl>
----------------------------------------------
+-----
 
 link:images/gaussian-blur-graph.png[Resulting graph].
 
diff --git a/docs/hello-world.adoc.in b/docs/hello-world.adoc.in
index 0885d7e58..ca3fdbd03 100644
--- a/docs/hello-world.adoc.in
+++ b/docs/hello-world.adoc.in
@@ -1,7 +1,7 @@
 Hello world
 -----------
-The following is a small sample GEGL application that animates a zoom on a
-mandelbrot fractal. compile it with:
+The following is a small sample GEGL application that animates a zoom on
+a mandelbrot fractal. compile it with:
 
  $ gcc hello-world.c `pkg-config --libs --cflags gegl` -o hello-world
 
@@ -10,7 +10,9 @@ link:http://git.gnome.org/browse/gegl/tree/examples/[examples subdir of the GEGL
 distribution].
 
 .hello-world.c
-[source, c]
----------------------------------------------
+ifeval::["{highlight}" == "true"]
+[source, txt]
+endif::[]
+-----
 include::@top_srcdir@/examples/hello-world.c[]
----------------------------------------------
+-----
diff --git a/docs/meson.build b/docs/meson.build
index 19ccca9e1..95f249406 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -56,7 +56,8 @@ asciidoc_files += [
 # asciidoc html files
 _tgt = []
 foreach _file: asciidoc_files
-  _tgt += custom_target('@0@.html'.format(_file).underscorify(),
+  _tgt += custom_target(
+    '@0@.html'.format(_file).underscorify(),
     output: '@BASENAME@.html',
     input: _file,
     command: [
@@ -66,6 +67,7 @@ foreach _file: asciidoc_files
       '-a', 'stylesheet=@0@'.format(
         meson.current_build_dir() / 'gegl.css'
       ),
+      '-a', 'highlight=@0@'.format(source_highlight.found()),
       '-a', 'quirks!',
       '@INPUT@',
     ],
diff --git a/docs/website/meson.build b/docs/website/meson.build
index 9642f7d98..01de760bf 100644
--- a/docs/website/meson.build
+++ b/docs/website/meson.build
@@ -10,7 +10,8 @@ endforeach
 
 # HTML files
 if env.found() and can_run_host_binaries
-  custom_target('class_hierarchy_html',
+  custom_target(
+    'class_hierarchy_html',
     output: 'class-hierarchy.html',
     command: [
       env,
@@ -28,7 +29,8 @@ endif
 # asciidoc html files
 _tgt = []
 foreach _file: website_asciidoc_files
-  _tgt += custom_target('@0@.html'.format(_file).underscorify(),
+  _tgt += custom_target(
+    '@0@.html'.format(_file).underscorify(),
     output: '@BASENAME@.html',
     input: _file,
     command: [
@@ -39,6 +41,7 @@ foreach _file: website_asciidoc_files
       '-a', 'stylesheet=@0@'.format(
         meson.current_build_dir() / 'gegl.css'
       ),
+      '-a', 'highlight=@0@'.format(source_highlight.found()),
       '-a', 'quirks!',
       '@INPUT@',
     ],
@@ -65,16 +68,15 @@ source_files = {
   'gegl-operation-point-render.h' : src_gegl_operation,
   'gegl-operation-sink.h' : src_gegl_operation,
   'gegl-operation-source.h' : src_gegl_operation,
-  'brightness-contrast.c' : 
+  'brightness-contrast.c' :
     project_source_root / 'operations' / 'common',
 }
 
 # asciidoc source files
-_input = source_highlight.found() ? 'src.txt' : 'src-no-highlight.txt' 
-# _input = 'src.txt'
 foreach _file, _path : source_files
-  custom_target('@0@.html'.format(_file).underscorify(),
-    input: _input,
+  custom_target(
+    '@0@.html'.format(_file).underscorify(),
+    input: 'src.adoc',
     output: '@0@.html'.format(_file),
     command: [
       asciidoc,
@@ -85,6 +87,7 @@ foreach _file, _path : source_files
       ),
       '-a', 'name=@0@'.format(_file),
       '-a', 'full_path=@0@'.format(_path / _file),
+      '-a', 'highlight=@0@'.format(source_highlight.found()),
       '-a', 'quirks!',
       '@INPUT@',
     ],
diff --git a/docs/website/src-no-highlight.txt b/docs/website/src.adoc
similarity index 50%
rename from docs/website/src-no-highlight.txt
rename to docs/website/src.adoc
index 36743384f..1d63d3ea0 100644
--- a/docs/website/src-no-highlight.txt
+++ b/docs/website/src.adoc
@@ -1,7 +1,11 @@
+
 GEGL Operation API
 ------------------
 
+ifeval::["{highlight}" == "true"]
+[source, c]
+endif::[]
 .{name}
-----
+-----
 include::{full_path}[]
-----
\ No newline at end of file
+-----
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]