Skip to content

Commit 9c22d74

Browse files
authored
doc: make pandoc optional (#2866)
Since it's currently unavailable on RHEL 9.
1 parent e0b5eee commit 9c22d74

11 files changed

+55
-35
lines changed

doc/Cite.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="Cite.md">
4+
<refentry id="Cite">
55

66

77
<para>

doc/Examples.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="Examples.md">
4+
<refentry id="Examples">
55

66

77
<para>

doc/How-it-opens-files.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="How-it-opens-files.md">
4+
<refentry id="How-it-opens-files">
55

66

77
<para>

doc/How-it-works.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="How-it-works.md">
4+
<refentry id="How-it-works">
55

66

77
<para>
@@ -55,7 +55,7 @@ VipsPel *pixel = VIPS_REGION_ADDR( region, x, y );
5555
g_object_unref( region );
5656
</programlisting>
5757
<para>
58-
The action that <literal>vips_region_prepare()</literal> takes varies with the type of image. If the image is a file on disc, for example, then VIPS will arrange for a refsect3 of the file to be read in.
58+
The action that <literal>vips_region_prepare()</literal> takes varies with the type of image. If the image is a file on disc, for example, then VIPS will arrange for a section of the file to be read in.
5959
</para>
6060
<para>
6161
(* there is an image access mode where you can just use a pointer, but it’s rarely used)
@@ -136,7 +136,7 @@ g_object_unref( region );
136136
<emphasis role="strong">Data sources</emphasis>
137137
</para>
138138
<para>
139-
VIPS has data sources which can supply pixels for processing from a variety of sources. VIPS can stream images from files in VIPS native format, from tiled TIFF files, from binary PPM/PGM/PBM/PFM, from Radiance (HDR) files, from FITS images and from tiled OpenEXR images. VIPS will automatically unpack other formats to temporary disc files for you but this can obviously generate a lot of disc traffic. It also has a special sequential mode for streaming operations on non-random-access formats. Another refsect3 in these docs explains <ulink url="How-it-opens-files.md.html">how libvips opens a file</ulink>. One of the sources uses the <ulink
139+
VIPS has data sources which can supply pixels for processing from a variety of sources. VIPS can stream images from files in VIPS native format, from tiled TIFF files, from binary PPM/PGM/PBM/PFM, from Radiance (HDR) files, from FITS images and from tiled OpenEXR images. VIPS will automatically unpack other formats to temporary disc files for you but this can obviously generate a lot of disc traffic. It also has a special sequential mode for streaming operations on non-random-access formats. Another section in these docs explains <ulink url="How-it-opens-files.md.html">how libvips opens a file</ulink>. One of the sources uses the <ulink
140140
url="http://www.imagemagick.org">ImageMagick</ulink> (or optionally <ulink
141141
url="http://www.graphicsmagick.org">GraphicsMagick</ulink> library, so VIPS can read any image format that these libraries can read.
142142
</para>

doc/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ HTML_IMAGES = \
127127
# pandoc makes section headers, we want refsect3 for gtk-doc
128128
.md.xml:
129129
pandoc -s --template="$(realpath pandoc-docbook-template.docbook)" --wrap=none -V title="$<" -f markdown+smart -t docbook -o $@ $<
130-
sed -e s/section/refsect3/g < $@ > x.$@ && mv x.$@ $@
130+
sed -i -e 's|<section|<refsect3|g' -e 's|</section|</refsect3|g' $@
131131

132132
# Our markdown source files
133133
markdown_content_files = \

doc/Making-image-pyramids.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="Making-image-pyramids.md">
4+
<refentry id="Making-image-pyramids">
55

66

77
<para>
@@ -66,7 +66,7 @@ operation flags: sequential nocache
6666
You can also call <literal>vips_dzsave()</literal> from any language with a libvips binding, or by using <literal>.dz</literal> or <literal>.szi</literal> as an output file suffix.
6767
</para>
6868
<refsect3 xml:id="writing-deepzoom-pyramids">
69-
<title>Writing <link xlink:href="http://en.wikipedia.org/wiki/Deep_Zoom">DeepZoom</link> pyramids</title>
69+
<title>Writing DeepZoom pyramids</title>
7070
<para>
7171
The <literal>--layout</literal> option sets the basic mode of operation. With no <literal>--layout</literal>, dzsave writes DeepZoom pyramids. For example:
7272
</para>
@@ -102,7 +102,7 @@ $ vips dzsave huge.tif myzoom --layout zoomify
102102
</para>
103103
</refsect3>
104104
<refsect3 xml:id="writing-google-maps-pyramids">
105-
<title>Writing <link xlink:href="https://developers.google.com/maps/">Google Maps</link> pyramids</title>
105+
<title>Writing Google Maps pyramids</title>
106106
<para>
107107
Use <literal>--layout google</literal> to write Google maps-style pyramids. These are compatible with <ulink url="http://leafletjs.com">Leaflet</ulink>. For example:
108108
</para>

doc/Using-vipsthumbnail.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="Using-vipsthumbnail.md">
4+
<refentry id="Using-vipsthumbnail">
55

66

77
<para>
@@ -56,7 +56,7 @@ $ cat k2.jpg | \
5656
$ vipsthumbnail *.jpg
5757
</programlisting>
5858
<para>
59-
will make a thumbnail for every jpeg in the current directory.  See the <link linkend="output-directory">Output directory</link> refsect3 below to see how to change where thumbnails are written.
59+
will make a thumbnail for every jpeg in the current directory.  See the <link linkend="output-directory">Output directory</link> section below to see how to change where thumbnails are written.
6060
</para>
6161
<para>
6262
<literal>vipsthumbnail</literal> will process images one after the other. You can get a good speedup by running several <literal>vipsthumbnail</literal>s in parallel, depending on how much load you want to put on your system. For example:

doc/binding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ the method-missing hook and attempt to run any method calls not implemented by
169169
the `Image` class as libvips operators. In effect, the binding is generated at
170170
runtime.
171171

172-
# Dynamic langauge without FFI
172+
# Dynamic language without FFI
173173

174174
PHP does not have a useful FFI, unfortunately, so for this language a small
175175
C module implements the general `vips_call()` function for PHP language

doc/binding.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="binding.md">
4+
<refentry id="binding">
55

66

77
<para>
@@ -173,8 +173,8 @@ VImage VImage::invert( VOption *options )
173173
Since these languages are dynamic, they can add another trick: they intercept the method-missing hook and attempt to run any method calls not implemented by the <literal>Image</literal> class as libvips operators. In effect, the binding is generated at runtime.
174174
</para>
175175
</refsect3>
176-
<refsect3 xml:id="dynamic-langauge-without-ffi">
177-
<title>Dynamic langauge without FFI</title>
176+
<refsect3 xml:id="dynamic-language-without-ffi">
177+
<title>Dynamic language without FFI</title>
178178
<para>
179179
PHP does not have a useful FFI, unfortunately, so for this language a small C module implements the general <literal>vips_call()</literal> function for PHP language types, and a larger pure PHP layer makes it convenient to use.
180180
</para>

doc/libvips-from-C++.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
33
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4-
<refentry id="libvips-from-C++.md">
4+
<refentry id="libvips-from-C++">
55

66

77
<para>

doc/meson.build

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,45 @@ markdown_content_files = files(
6767
'Making-image-pyramids.md',
6868
)
6969

70-
markdown_content_files_docbook = []
71-
foreach markdown_content_file : markdown_content_files
70+
pandoc = find_program('pandoc', required: false)
71+
72+
if pandoc.found()
7273
# we have some files in markdown ... convert to docbook for gtk-doc
73-
# pandoc makes section headers, we want refsect3 for gtk-doc
74-
markdown_content_files_docbook += configure_file(
75-
input: markdown_content_file,
76-
command: [
77-
find_program('pandoc'),
74+
gen = generator(pandoc,
75+
output: '@BASENAME@.xml',
76+
arguments: [
7877
'@INPUT@',
79-
'--template', files('pandoc-docbook-template.docbook'),
78+
'--template=@0@'.format(join_paths(meson.current_source_dir(), 'pandoc-docbook-template.docbook')),
8079
'--wrap=none',
8180
'-V', 'title=@BASENAME@',
8281
'-f', 'markdown+smart',
8382
'-t', 'docbook',
8483
'-o', '@OUTPUT@',
85-
],
86-
output: '@BASENAME@.xml',
84+
]
8785
)
88-
endforeach
86+
87+
markdown_content_files_generated = gen.process(markdown_content_files)
88+
89+
# pandoc makes section headers, we want refsect3 for gtk-doc
90+
markdown_content_files_docbook = custom_target('gen-docs',
91+
output: 'generated',
92+
input: markdown_content_files_generated,
93+
command: [ 'sed', '-i', '-e', 's|<section|<refsect3|g', '-e', 's|</section|</refsect3|g', '@INPUT@' ],
94+
build_by_default: true
95+
)
96+
else
97+
# use the pre-generated docbook files when pandoc is not available
98+
markdown_content_files_docbook = files(
99+
'How-it-works.xml',
100+
'libvips-from-C++.xml',
101+
'Using-vipsthumbnail.xml',
102+
'How-it-opens-files.xml',
103+
'Examples.xml',
104+
'Cite.xml',
105+
'binding.xml',
106+
'Making-image-pyramids.xml',
107+
)
108+
endif
89109

90110
content_files = files(
91111
'using-command-line.xml',
@@ -124,18 +144,18 @@ gnome.gtkdoc('libvips',
124144
],
125145
dependencies: libvips_dep,
126146
scan_args: [
127-
'--ignore-headers=' + ' '.join(private_headers),
128-
'--rebuild-types',
147+
'--ignore-headers=' + ' '.join(private_headers),
148+
'--rebuild-types',
129149
],
130150
mkdb_args: [ '--default-includes=vips/vips.h' ],
131151
fixxref_args: [
132-
'--html-dir=@0@'.format(docpath),
133-
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
134-
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
135-
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
152+
'--html-dir=@0@'.format(docpath),
153+
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
154+
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
155+
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
136156
],
137157
content_files: [ content_files, markdown_content_files_docbook ],
138-
expand_content_files: [ content_files, markdown_content_files_docbook ],
158+
expand_content_files: [ content_files ],
139159
html_assets: images,
140160
install: true
141161
)

0 commit comments

Comments
 (0)