[gegl] docs: migrate from enscript to source-highlight for doc source code highlighting as this can be call



commit fff34777fec5ff343055ce17eb58616bf278a400
Author: John Marshall <jtm home gmail com>
Date:   Wed Feb 3 23:24:42 2021 +0000

    docs: migrate from enscript to source-highlight
    for doc source code highlighting as this can be
    called directly from within asciidoc

 docs/hello-world.txt.in           |   6 +-
 docs/source-overview.txt          | 116 +++++++++++++++++++-------------------
 docs/website/meson.build          |  85 ++++++++++++++--------------
 docs/website/src-no-highlight.txt |   7 +++
 docs/website/src.txt              |   8 +++
 meson.build                       |  97 ++++++++++++++++---------------
 6 files changed, 169 insertions(+), 150 deletions(-)
---
diff --git a/docs/hello-world.txt.in b/docs/hello-world.txt.in
index 9f99d7376..0885d7e58 100644
--- a/docs/hello-world.txt.in
+++ b/docs/hello-world.txt.in
@@ -9,6 +9,8 @@ This example and others can be found in the
 link:http://git.gnome.org/browse/gegl/tree/examples/[examples subdir of the GEGL
 distribution].
 
----------------------------
+.hello-world.c
+[source, c]
+---------------------------------------------
 include::@top_srcdir@/examples/hello-world.c[]
----------------------------
+---------------------------------------------
diff --git a/docs/source-overview.txt b/docs/source-overview.txt
index b00d4188f..b29864ce0 100644
--- a/docs/source-overview.txt
+++ b/docs/source-overview.txt
@@ -1,61 +1,61 @@
 Source overview
 ---------------
 
- gegl-dist-root
-  │
-  │
-  ├──gegl               core source of GEGL, library init/deinit,
-  │   │
-  │   ├──buffer         contains the implementation of GeglBuffer
-  │   │                  - sparse (tiled)
-  │   │                  - recursivly subbuffer extendable
-  │   │                  - clipping rectangle (defaults to bounds when making
-  │   │                    subbuffers)
-  │   │                  - storage in any babl supported pixel format
-  │   │                  - read/write rectangular region as linear buffer for
-  │   │                    any babl supported pixel format.
-  │   ├──graph          graph storage and manipulation code.
-  │   ├──module         The code to load plug-ins located in a colon separated
-  │   │                 list of paths from the environment variable GEGL_PATH
-  │   ├──opencl         The GEGL base class for OpenCL.
-  │   ├──operation      The GeglOperation base class, and subclasses that act
-  │   │                 as baseclasses for implementing different types of
-  │   │                 operation plug-ins.
-  │   ├──process        The code controlling data processing.
-  │   └──property-types specialized classes/paramspecs for GeglOperation
-  │                     properties.
-  │
-  ├──examples ⊙        hello-world and other example uses of the GEGL API.
-  │
-  ├──tests             various tests used to maintain stability when developing
-  │                    GEGL.
-  │
-  ├──opencl            OpenCL implementation of plug-ins.
-  │
-  ├──operations        Runtime loaded plug-ins for image processing operations.
-  │   │
-  │   ├──core          Basic operations tightly coupled with GEGL.
-  │   ├──transform     Transforming operations (rotate/scale/translate)
-  │   ├──generated     Operations generated from scripts (currently
-  │   ├──external      Operations with external dependencies.
-  │   ├──common        Other operations.
-  │   └──workshop      Works in progress, (you must pass --enable-workshop
-  │       │            when configuring to build these by default, you can enter
-  │       │            the directory manually and type make && sudo make install
-  │       │            as well.
-  │       │
-  │       ├──external  operations in the workshop with external dependencies.
-  │       └──generated generated operations that are in the workshop.
-  │
-  ├──perf              The GEGL framework tests for tracking performance
-  │                    development (ruby is required).
-  │
-  ├──docs              The GEGL website (this documentation), built for your
-  │                    the corresponding sourcetree with correct documentation
-  │                    etc.
-  │
-  ├──bin               gegl binary, a commandline too for running chains of
-  │                    operations as well as a media browser and manipulation
-  │                    ui written with cairo/microraptor gui.
-  │
-  └──tools             some small utilities to help the build.
+[source, txt]
+----
+gegl-dist-root
+│
+├──gegl               core source of GEGL, library init/deinit,
+│   │
+│   ├──buffer         contains the implementation of GeglBuffer
+│   │                  - sparse (tiled)
+│   │                  - recursivly subbuffer extendable
+│   │                  - clipping rectangle (defaults to bounds when making
+│   │                    subbuffers)
+│   │                  - storage in any babl supported pixel format
+│   │                  - read/write rectangular region as linear buffer for any
+│   │                    babl supported pixel format.
+│   ├──graph          graph storage and manipulation code.
+│   ├──module         The code to load plug-ins located in a colon separated
+│   │                 list of paths from the environment
+│   │                 variable GEGL_PATH
+│   ├──opencl         The GEGL base class for OpenCL.
+│   ├──operation      The GeglOperation base class, and subclasses that act as
+│   │                 base classes for implementing different types of operation
+│   │                 plug-ins.
+│   ├──process        The code controlling data processing.
+│   └──property-types specialized classes/paramspecs for GeglOperation
+│                     properties.
+│
+├──bin                gegl binary, a command-line too for running chains of
+│                     operations as well as a media browser and manipulation ui
+│                     written with cairo/microraptor gui.
+│
+├──docs               The GEGL website (this documentation), built for your the
+│                     corresponding source tree with correct documentation etc.
+│
+├──examples           hello-world and other example uses of the GEGL API.
+│
+├──opencl             OpenCL implementation of plug-ins.
+│
+├──operations         Runtime loaded plug-ins for image processing operations.
+│   │
+│   ├──core           Basic operations tightly coupled with GEGL.
+│   ├──transform      Transforming operations (rotate/scale/translate)
+│   ├──generated      Operations generated from scripts (currently
+│   ├──external       Operations with external dependencies.
+│   ├──common         Other operations.
+│   └──workshop       Work in progress, (you must pass -Dworkshop=true when
+│       │             configuring meson to build these operations by default).
+│       │
+│       ├──external   operations in the workshop with external dependencies.
+│       └──generated  generated operations that are in the workshop.
+│
+├──perf               The GEGL framework tests for tracking performance
+│                     development (ruby is required).
+│
+├──tests              various tests used to maintain stability when developing
+│                     GEGL.
+│
+└──tools              some small utilities to help the build.
+----
diff --git a/docs/website/meson.build b/docs/website/meson.build
index 91267dcac..9642f7d98 100644
--- a/docs/website/meson.build
+++ b/docs/website/meson.build
@@ -48,53 +48,50 @@ foreach _file: website_asciidoc_files
 endforeach
 index_html = _tgt[0]
 
-# enscript html files
-enscript_files = {
-  'gegl.h' :
-    project_source_root / 'gegl',
-  'gegl-plugin.h' :
-    project_source_root / 'gegl',
-  'gegl-operation.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-composer.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-area-filter.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-filter.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-meta.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-point-composer.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-temporal.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-point-filter.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-point-render.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-sink.h' :
-    project_source_root / 'gegl' / 'operation',
-  'gegl-operation-source.h' :
-    project_source_root / 'gegl' / 'operation',
-  'brightness-contrast.c' :
+# Source files
+src_gegl = project_source_root / 'gegl'
+src_gegl_operation =  src_gegl / 'operation'
+source_files = {
+  'gegl.h' : src_gegl,
+  'gegl-plugin.h' : src_gegl,
+  'gegl-operation.h' : src_gegl_operation,
+  'gegl-operation-composer.h' : src_gegl_operation,
+  'gegl-operation-area-filter.h' : src_gegl_operation,
+  'gegl-operation-filter.h' : src_gegl_operation,
+  'gegl-operation-meta.h' : src_gegl_operation,
+  'gegl-operation-point-composer.h' : src_gegl_operation,
+  'gegl-operation-temporal.h' : src_gegl_operation,
+  'gegl-operation-point-filter.h' : src_gegl_operation,
+  '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' : 
     project_source_root / 'operations' / 'common',
 }
 
-if enscript.found()
-  foreach _file, _path : enscript_files
-    custom_target('@0@.html'.format(_file).underscorify(),
-      input: files(_path / _file),
-      output: '@PLAINNAME@.html',
-      command: [
-        enscript,
-        '-E', '--color', '--language=html', '-p', '@OUTPUT@', '@INPUT@'
-        ],
-      build_by_default: true,
-    )
-  endforeach
-else
-  warning('enscript required to generate website code examples')
-endif
+# 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,
+    output: '@0@.html'.format(_file),
+    command: [
+      asciidoc,
+      '--unsafe',
+      '-o', '@OUTPUT@',
+      '-a', 'stylesheet=@0@'.format(
+        meson.current_build_dir() / 'gegl.css'
+      ),
+      '-a', 'name=@0@'.format(_file),
+      '-a', 'full_path=@0@'.format(_path / _file),
+      '-a', 'quirks!',
+      '@INPUT@',
+    ],
+    build_by_default: true,
+  )
+endforeach
+
 
 subdir('images')
 subdir('operations')
diff --git a/docs/website/src-no-highlight.txt b/docs/website/src-no-highlight.txt
new file mode 100644
index 000000000..36743384f
--- /dev/null
+++ b/docs/website/src-no-highlight.txt
@@ -0,0 +1,7 @@
+GEGL Operation API
+------------------
+
+.{name}
+----
+include::{full_path}[]
+----
\ No newline at end of file
diff --git a/docs/website/src.txt b/docs/website/src.txt
new file mode 100644
index 000000000..5269f8885
--- /dev/null
+++ b/docs/website/src.txt
@@ -0,0 +1,8 @@
+GEGL Operation API
+------------------
+
+[source, c]
+.{name}
+----
+include::{full_path}[]
+----
\ No newline at end of file
diff --git a/meson.build b/meson.build
index 34c71dd79..cff29267f 100644
--- a/meson.build
+++ b/meson.build
@@ -205,16 +205,22 @@ add_project_arguments(cpp.get_supported_arguments(cflags_cpp), language: 'cpp')
 ################################################################################
 # Build Utilities
 
-env          = find_program('env')
-
-asciidoc     = find_program('asciidoc',      required: false, native: true)
-dot          = find_program('dot',           required: false, native: true)
-enscript     = find_program('enscript',      required: false, native: true)
-gtkdoc_scan  = find_program('gtkdoc-scan',   required: false, native: true)
-rsvg_convert = find_program('rsvg-convert',  required: false, native: true)
-ruby         = find_program('ruby',          required: false, native: true)
-w3m          = find_program('w3m',           required: false, native: true)
-
+env               = find_program('env')
+
+asciidoc          = find_program('asciidoc',
+                     required: false, native: true)
+dot               = find_program('dot',
+                     required: false, native: true)
+gtkdoc_scan       = find_program('gtkdoc-scan',
+                     required: false, native: true)
+rsvg_convert      = find_program('rsvg-convert',
+                     required: false, native: true)
+ruby              = find_program('ruby',
+                     required: false, native: true)
+source_highlight  = find_program('source-highlight',
+                     required: false, native: true)
+w3m               = find_program('w3m',
+                     required: false, native: true)
 
 ################################################################################
 # Required Dependencies
@@ -549,49 +555,48 @@ summary(
 )
 summary(
   {
-    'Build workshop'  : get_option('workshop'),
-    'Introspection'   : g_ir.found(),
-    'Vala support'    : vapigen.found(),
+    'Build workshop'    : get_option('workshop'),
+    'Introspection'     : g_ir.found(),
+    'Vala support'      : vapigen.found(),
   }, section: 'Optional features'
 )
 summary(
   {
-    'asciidoc'        : asciidoc.found(),
-    'dot'             : dot.found(),
-    'enscript'        : enscript.found(),
-    'pygobject'       : pygobject3.found(),
-    'rsvg-convert'    : rsvg_convert.found(),
-    'Ruby'            : ruby.found(),
-    'w3m'             : w3m.found(),
+    'asciidoc'          : asciidoc.found(),
+    'dot'               : dot.found(),
+    'pygobject'         : pygobject3.found(),
+    'rsvg-convert'      : rsvg_convert.found(),
+    'Ruby'              : ruby.found(),
+    'source-highlight'  : source_highlight.found(),
+    'w3m'               : w3m.found(),
   }, section: 'Optional build utilities'
 )
 summary(
   {
-    'avlibs'          : avlibs_found,
-    'Cairo'           : cairo.found(),
-    'GDKPixbuf'       : gdk_pixbuf.found(),
-    'gexiv2'          : gexiv2.found(),
-    'Jasper'          : jasper.found(),
-    'JPEG'            : libjpeg.found(),
-    'lcms'            : lcms.found(),
-    'libnsgif'        : libnsgif.found(),
-    'libraw'          : libraw.found(),
-    'Luajit'          : lua.found(),
-    'maxflow'         : maxflow.found(),
-    'mrg'             : mrg.found(),
-    'Pango'           : pango.found(),
-    'pangocairo'      : pangocairo.found(),
-    'poly2tri-c'      : poly2tri_c.found(),
-    'poppler'         : poppler.found(),
-    'OpenEXR'         : openexr.found(),
-    'rsvg'            : librsvg.found(),
-    'SDL1'            : sdl1.found(),
-    'SDL2'            : sdl2.found(),
-    'spiro'           : libspiro.found(),
-    'TIFF'            : libtiff.found(),
-    'umfpack'         : libumfpack.found(),
-    'V4L'             : libv4l1.found(),
-    'V4L2'            : libv4l2.found(),
-    'webp'            : libwebp.found(),
+    'avlibs'            : avlibs_found,
+    'Cairo'             : cairo.found(),
+    'GDKPixbuf'         : gdk_pixbuf.found(),
+    'gexiv2'            : gexiv2.found(),
+    'Jasper'            : jasper.found(),
+    'lcms'              : lcms.found(),
+    'libnsgif'          : libnsgif.found(),
+    'libraw'            : libraw.found(),
+    'Luajit'            : lua.found(),
+    'maxflow'           : maxflow.found(),
+    'mrg'               : mrg.found(),
+    'Pango'             : pango.found(),
+    'pangocairo'        : pangocairo.found(),
+    'poly2tri-c'        : poly2tri_c.found(),
+    'poppler'           : poppler.found(),
+    'OpenEXR'           : openexr.found(),
+    'rsvg'              : librsvg.found(),
+    'SDL1'              : sdl1.found(),
+    'SDL2'              : sdl2.found(),
+    'spiro'             : libspiro.found(),
+    'TIFF'              : libtiff.found(),
+    'umfpack'           : libumfpack.found(),
+    'V4L'               : libv4l1.found(),
+    'V4L2'              : libv4l2.found(),
+    'webp'              : libwebp.found(),
   }, section: 'Optional dependencies'
 )


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