giblish 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +16 -0
- data/README.adoc +303 -170
- data/Rakefile +1 -8
- data/docgen/resources/css/adoc-colony.css +634 -0
- data/docgen/scripts/gen_adoc_org.sh +58 -0
- data/giblish.gemspec +6 -3
- data/lib/giblish-search.rb +107 -125
- data/lib/giblish/buildgraph.rb +24 -3
- data/lib/giblish/buildindex.rb +11 -7
- data/lib/giblish/cmdline.rb +42 -21
- data/lib/giblish/core.rb +76 -51
- data/lib/giblish/docconverter.rb +43 -51
- data/lib/giblish/indexheadings.rb +62 -9
- data/lib/giblish/utils.rb +71 -37
- data/lib/giblish/version.rb +1 -1
- metadata +12 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c845d2e0c00221f3474469a435157b178894d2af53f8e316f4a555d9480643c6
|
4
|
+
data.tar.gz: a1e5204459599f4d270342d0e8bcf72ee4d36b8440b2ff8499b2428fc543972d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c498054328dca32d192d16e7bbfea061417d7835e3ab80e86c998c1e705701cfef9d0ebdfd39cbfef23b954d56fb0d5e111b110def298fb96eddd7c6cecdd41
|
7
|
+
data.tar.gz: f8c52b147ff9a8134fb0829b69eb48cdade6518840253cf5e9b5ef66ea439a2b26d0d14a20b20a3b84b76c63408c59a52dab0363495f951da51d784d5b5b2335
|
data/Changelog
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
= giblish changelog
|
2
|
+
|
3
|
+
== v0.7.0
|
4
|
+
|
5
|
+
* *Breaking change* include the entire path in the -i and -j options
|
6
|
+
* *Breaking change* change the meaning of the -w flag (and rename the long form to --web-path)
|
7
|
+
and add the -mp flag.
|
8
|
+
This was done as a means to remove the hard-coded arguments to the search box html so that one
|
9
|
+
can generate html docs to a destination that is not the same as the one where they are deployed
|
10
|
+
on a web server.
|
11
|
+
* take the idprefix and idseparator into account when indexing sections for text search
|
12
|
+
* Add the font awesome css as link to search box and use the magnifying glass icon
|
13
|
+
* update README file
|
14
|
+
* handle the case where a 'index.adoc' file exists by making the basename configurable using the
|
15
|
+
'--index-basename' flag.
|
16
|
+
* update the dependencies to the latest asciidoctor-pdf release
|
data/README.adoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= giblish
|
2
|
-
|
2
|
+
:idseparator:-
|
3
|
+
:idprefix:
|
4
|
+
:numbered:
|
3
5
|
|
4
6
|
image::https://travis-ci.org/rillbert/giblish.svg?branch=master["Build Status", link="https://travis-ci.org/rillbert/giblish"]
|
5
7
|
|
@@ -7,26 +9,31 @@ image::https://travis-ci.org/rillbert/giblish.svg?branch=master["Build Status",
|
|
7
9
|
|
8
10
|
giblish is used to convert a source directory tree containing AsciiDoc files to
|
9
11
|
a destination directory tree containing the corresponding html or pdf files
|
10
|
-
and
|
12
|
+
and adds some handy tools for easier navigation of the resulting files.
|
11
13
|
|
12
|
-
|
14
|
+
An example of how giblish can generate the master branch of the official asciidoc.org
|
15
|
+
documentation git repo can be found at http://www.rillbert.se/adoc/examples/adocorg/master/myindex.html
|
13
16
|
|
14
|
-
|
17
|
+
The added tools include:
|
18
|
+
|
19
|
+
* An index page listing all rendered documents with clickable links.
|
20
|
+
* A (stripped-down but nonetheless useful) text-search of your (html) documents (requires
|
21
|
+
that you view your docs via a web-server.
|
22
|
+
* If the source directory tree is part of a git repository, giblish can generate
|
23
|
+
separate html/pdf trees for branches and/or tags that match a user specified
|
24
|
+
regexp (see examples below).
|
15
25
|
* Document ids - Note: the implementation of this is giblish-specific and thus
|
16
26
|
you need to render your adoc files using giblish to make this work as intended.
|
17
27
|
You can use document ids to:
|
18
28
|
** Reference one doc in the source tree from another doc without depending on file
|
19
|
-
names or relative paths. The referenced doc can thus be moved within the
|
29
|
+
names or relative paths. The referenced doc can thus be moved within the source
|
20
30
|
tree or change its file name and the reference will still be valid.
|
21
31
|
** Validate doc id references during document rendering and thus be alerted to
|
22
32
|
any invalid doc id references.
|
23
33
|
** Let giblish generate a clickable graph of all document references (requires
|
24
34
|
graphviz and the 'dot' tool).
|
25
|
-
|
26
|
-
|
27
|
-
* If the source directory tree is part of a git repository, giblish can generate
|
28
|
-
separate html/pdf trees for branches and/or tags that match a user specified
|
29
|
-
regexp (see examples below).
|
35
|
+
|
36
|
+
NOTE: giblish shall be considered stable from a usage perspective, please report bugs to the issue tracker. It's API however, is to be considered alpha, meaning that future versions may break the current usage of cmd line flags, generated artifacts, styling or other functionality.
|
30
37
|
|
31
38
|
== Dependencies and credits
|
32
39
|
|
@@ -37,168 +44,40 @@ Thank you @mojavelinux and others for making these brilliant tools available!!
|
|
37
44
|
|
38
45
|
gem install giblish
|
39
46
|
|
40
|
-
|
47
|
+
Want to get started straight away? Go directly to the <<usage_examples>>.
|
48
|
+
|
49
|
+
=== Some caveats
|
41
50
|
|
42
51
|
When using giblish for generating docs the following applies:
|
43
52
|
|
44
53
|
* giblish *will overwrite* files with the same name in the destination directory.
|
45
|
-
*
|
46
|
-
|
54
|
+
* giblish requires that the git working tree and index of the repo containing source
|
55
|
+
documents are clean when generating documentation.
|
47
56
|
* giblish will make explicit check-outs of all the branches or tags that matches
|
48
57
|
the selection criteria. The working dir of the source git repo will thus have
|
49
58
|
the last branch that giblish checked-out as the current branch after doc
|
50
59
|
generation.
|
51
60
|
|
52
|
-
== Usage Examples
|
53
|
-
|
54
|
-
.Get available options
|
55
|
-
====
|
56
|
-
giblish -h
|
57
|
-
====
|
58
|
-
|
59
|
-
.Giblish 'hello world'
|
60
|
-
====
|
61
|
-
giblish my_src_root my_dst_root
|
62
|
-
|
63
|
-
The above will convert all .adoc or .ADOC files under the dir `my_src_root` to
|
64
|
-
html and place the resulting files under the `my_dst_root` dir. An index page
|
65
|
-
named `index.html` is generated in the `my_dst_root` dir containing links and
|
66
|
-
some info about the converted files.
|
67
|
-
|
68
|
-
The default asciidoctor css will be used in the html conversion.
|
69
|
-
====
|
70
|
-
|
71
|
-
.Using a different css
|
72
|
-
====
|
73
|
-
giblish -r ./path/to/my/resources -s mylayout my_src_root my_dst_root
|
74
|
-
|
75
|
-
The above will convert all .adoc or .ADOC files under the dir `my_src_root` to
|
76
|
-
html and place the resulting files under the `my_dst_root` dir. An index page
|
77
|
-
named `index.html` is generated in the `my_dst_root` dir containing links and
|
78
|
-
some info about the converted files.
|
79
|
-
|
80
|
-
A css named mylayout.css must be found in the dir
|
81
|
-
`<working_dir/path/to/my/resources/css`. The resulting html files will link
|
82
|
-
to this css. Fonts and images used from the css must be found under
|
83
|
-
`<working_dir/path/to/my/resources/fonts` and
|
84
|
-
`<working_dir/path/to/my/resources/images` respectively.
|
85
|
-
====
|
86
|
-
|
87
|
-
.Generate html from multiple git branches
|
88
|
-
====
|
89
|
-
giblish -g "feature" my_src_root my_dst_root
|
90
|
-
|
91
|
-
The above will check-out all branches matching the regexp "feature" and convert
|
92
|
-
the .adoc or .ADOC files under the dir `my_src_root` to html and place the
|
93
|
-
resulting files under the `my_dst_root/<branch_name>` dir.
|
94
|
-
|
95
|
-
An index page named `index.html` is generated in each `my_dst_root/<branch_name`
|
96
|
-
dir containing links and some info about the converted files.
|
97
|
-
|
98
|
-
A summary page containing links to all branches will be generated directly in
|
99
|
-
the `my_dst_root` dir.
|
100
|
-
====
|
101
|
-
|
102
|
-
.Generate html from giblish git repo using giblish css
|
103
|
-
====
|
104
|
-
Assuming you have cloned this git repo to `~/github/giblish` you can do:
|
105
|
-
|
106
|
-
giblish -g "master" -r ~/github/giblish/resources ~/github/giblish my_dst_root
|
107
|
-
|
108
|
-
The above will check-out all branches matching the regexp "master" and convert
|
109
|
-
the .adoc or .ADOC files under the dir `my_src_root` to html and place the
|
110
|
-
resulting files under the `my_dst_root/<branch_name>` dir.
|
111
|
-
|
112
|
-
An index page named `index.html` is generated in each `my_dst_root/<branch_name`
|
113
|
-
dir containing links and some info about the converted files.
|
114
|
-
|
115
|
-
A summary page containing links to all branches will be generated directly in
|
116
|
-
the `my_dst_root` dir.
|
117
|
-
====
|
118
|
-
|
119
|
-
.Generate pdf from giblish git repo using the giblish pdf theme
|
120
|
-
====
|
121
|
-
Assuming you have cloned this git repo to `~/github/giblish` you can do:
|
122
|
-
|
123
|
-
giblish -f pdf -g "master" -r ~/github/giblish/resources ~/github/giblish my_dst_root
|
124
|
-
|
125
|
-
The above will check-out all branches matching the regexp "master" and convert
|
126
|
-
the .adoc or .ADOC files under the dir `my_src_root` to pdf and place the
|
127
|
-
resulting files under the `my_dst_root/<branch_name>` dir.
|
128
|
-
|
129
|
-
An index page named `index.pdf` is generated in each `my_dst_root/<branch_name`
|
130
|
-
dir containing links and some info about the converted files.
|
131
|
-
|
132
|
-
A summary page containing links to all branches will be generated directly in
|
133
|
-
the `my_dst_root` dir.
|
134
|
-
====
|
135
|
-
|
136
|
-
.Advanced usage; Publish a static html site from a git repo with search capabilities
|
137
|
-
====
|
138
|
-
giblish can be used to inject a tree of html docs suitable for serving via a web
|
139
|
-
server (e.g. Apache). Below is an example how to create such a tree. If you
|
140
|
-
combine this with a server side git hook that invokes this script after push,
|
141
|
-
you will have a way of auto publish your latest documents and/or documents at
|
142
|
-
specific git tags. A document management system including nice index pages and
|
143
|
-
text search capabilities
|
144
|
-
|
145
|
-
Assumptions:
|
146
|
-
|
147
|
-
* You have a running web server that serves pages from directory root
|
148
|
-
`/var/www/html`
|
149
|
-
* You want to access the generated docs from http://your_web_site.com/proddocs
|
150
|
-
* The git repo containing the source docs has its working dir at `~/gh/myrepo`
|
151
|
-
* You only want to publish the documents in the subfolder `common/Documents` in
|
152
|
-
your git repo.
|
153
|
-
* You want to use your own css named `mylayout.css` that internally references
|
154
|
-
fonts and images using relative paths.
|
155
|
-
* You have the css and its referenced fonts and images in subfolders
|
156
|
-
of the git repo at `common/resources/css common/resources/fonts common/resources/images`
|
157
|
-
* You want to publish the documentation as it looked for your release tags
|
158
|
-
myprod-v1.0-final, myprod-v2.0-final, ...
|
159
|
-
|
160
|
-
giblish -m -t "-final$" -r ~/gh/myrepo/common/resources -s mylayout -w /var/www/html ~/gh/myrepo/common/Documents /var/www/html/proddocs
|
161
|
-
|
162
|
-
The above will create a tree of html docs under `/var/www/html/proddocs`. Each
|
163
|
-
tag will get its own subdir (e.g. `/var/www/html/proddocs/myprod_v1.0_final`).
|
164
|
-
The css and referenced assets will be copied to a 'web_assets' dir for each
|
165
|
-
subdir and also to the .../proddocs dir.
|
166
|
-
|
167
|
-
The `-w` switch above will strip the `/var/www/html` from the css link so that
|
168
|
-
the paths to the css will be correct in the context of the serving of the
|
169
|
-
pages via the web server.
|
170
|
-
|
171
|
-
The `-m` switch above will build a database (JSON file) with enough information
|
172
|
-
to enable a cgi-script to provide a text-search capability for your users. The
|
173
|
-
cgi-script must be located at http://your_web_site.com/cgi-bin/giblish-search.cgi
|
174
|
-
and this gem provides a default implementation that you can copy from the .../lib
|
175
|
-
folder to the correct destination.
|
176
|
-
====
|
177
|
-
|
178
61
|
== Text search implementation
|
179
62
|
|
180
63
|
The text search enables a user to search for a text string and receive matching
|
181
64
|
sections in the documentation tree.
|
182
65
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
This gem contains an example implementation of a server side script. It is implemented
|
199
|
-
in ruby and uses 'grep' to parse the search data. It then generates a result page where
|
200
|
-
each matching section is shown and when clicked, will navigate the user to that section
|
201
|
-
in the corresponding document.
|
66
|
+
giblish ties together the following three pieces to enable the text search:
|
67
|
+
|
68
|
+
. the source text of all adoc files together with a JSON file that maps sections to
|
69
|
+
their line numbers.
|
70
|
+
** giblish collects this 'search data' when it generates the
|
71
|
+
html files to the destination directory. The JSON file and all adoc source files
|
72
|
+
are copied to a well-known place in the destination tree (see below).
|
73
|
+
. an html form somewhere on the rendered pages where the user can input search queries and
|
74
|
+
initiate a search.
|
75
|
+
** giblish injects such an html form in the generated index page when the user
|
76
|
+
specifies the '-m' switch.
|
77
|
+
. a server side script that handles a user request to search the documents for a specific
|
78
|
+
text string and presents the result to the user.
|
79
|
+
** this gem contains an implementation of such a server side script. It is intended to be
|
80
|
+
run as a cgi script and requires ruby and grep to be installed on the server where it runs.
|
202
81
|
|
203
82
|
=== Search data and html form parameters
|
204
83
|
|
@@ -225,9 +104,6 @@ root. This is illustrated below.
|
|
225
104
|
| |- branch_2_top_dir
|
226
105
|
| | ...
|
227
106
|
|
228
|
-
assume that the file tree looks like this when not
|
229
|
-
rendering a git branch:
|
230
|
-
|
231
107
|
.When rendering documents not in a git branch
|
232
108
|
dst_root_dir
|
233
109
|
|- index.html
|
@@ -243,13 +119,270 @@ rendering a git branch:
|
|
243
119
|
| | |- file2.adoc
|
244
120
|
| |- ...
|
245
121
|
|
246
|
-
|
247
|
-
|
122
|
+
== Document ids and the reference graph
|
123
|
+
|
124
|
+
NOTE: This is a non-standard extension of asciidoc. If you use this feature, you will
|
125
|
+
need to generate your documents using giblish to make this work as intended.
|
126
|
+
|
127
|
+
giblish extends the cross reference concept in asciidoc with a _document id_ mechanism.
|
128
|
+
To use this, you need to:
|
129
|
+
|
130
|
+
. Add a `:docid:` entry in your document's header section. The doc id can consist of
|
131
|
+
up to 10 characters and must be unique within the set of documents generated by
|
132
|
+
giblish.
|
133
|
+
. Refer to a document using the syntax pass:[<<:docid:#DOC_ID#>>].
|
134
|
+
. Run giblish with the -d switch when generating documents.
|
135
|
+
|
136
|
+
Using doc ids makes it possible for giblish to do two things:
|
137
|
+
|
138
|
+
. Make the reference from one document to another work even if one of the documents
|
139
|
+
have been moved within the source tree.
|
140
|
+
. Produce a clickable 'map' of the generated documents where the different references
|
141
|
+
are clearly seen (this feature require that the 'dot' tool, part of the graphwiz package
|
142
|
+
is installed on the machine where giblish is run).
|
143
|
+
|
144
|
+
The use of the -d switch makes giblish parse the document twice, once to map up the doc ids and
|
145
|
+
all references to them, once to actually generate the output documentation. Thus, you pay a
|
146
|
+
performance penalty but this should not be a big inconvenience since the generation is quite
|
147
|
+
fast in itself.
|
148
|
+
|
149
|
+
=== Example of using the docid feature
|
150
|
+
|
151
|
+
Consider that you have two documents located somewhere in the same folder tree, document one and
|
152
|
+
document two. You could then use the docid feature of giblish to refer to one document from the
|
153
|
+
other as in the example below.
|
154
|
+
|
155
|
+
Example document one::
|
156
|
+
|
157
|
+
[source,asciidoc]
|
158
|
+
----
|
159
|
+
= Document one
|
160
|
+
:toc:
|
161
|
+
:numbered:
|
162
|
+
:docid: D-001
|
163
|
+
|
164
|
+
== Purpose
|
165
|
+
|
166
|
+
To illustrate the use of doc id.
|
167
|
+
----
|
168
|
+
|
169
|
+
Example document two::
|
170
|
+
[source,asciidoc]
|
171
|
+
----
|
172
|
+
= Document two
|
173
|
+
:toc:
|
174
|
+
:numbered:
|
175
|
+
:docid: D-002
|
176
|
+
|
177
|
+
== Purpose
|
178
|
+
|
179
|
+
To illustrate the use of doc id. You can refer to document one as <<:docid:D-001>>.
|
180
|
+
This will display a clickable link with the doc id (D-001 in this case).
|
181
|
+
|
182
|
+
You can basically follow the same syntax as the normal asciidoc cross-ref, such as:
|
183
|
+
|
184
|
+
* <<:docid:D-002#purpose>> to refer to a specific section or anchor.
|
185
|
+
* <<:docid:D-002#purpose,The purpose section>> to refer to a specific section and
|
186
|
+
display a specific text for the link.
|
187
|
+
----
|
188
|
+
|
189
|
+
The above reference will work even if either document changes location or file name as long
|
190
|
+
as both documents are parsed by giblish in the same run.
|
191
|
+
|
192
|
+
[[usage_examples]]
|
193
|
+
== Usage Examples
|
194
|
+
|
195
|
+
Here follows a number of usages for giblish in increasing order of complexity.
|
196
|
+
|
197
|
+
=== Get available options
|
198
|
+
|
199
|
+
giblish -h
|
200
|
+
|
201
|
+
=== Giblish html 'hello world'
|
202
|
+
|
203
|
+
giblish my_src_root my_dst_root
|
204
|
+
|
205
|
+
* convert all .adoc or .ADOC files under the dir `my_src_root` to
|
206
|
+
html and place the resulting files under the `my_dst_root` dir.
|
207
|
+
* generate an index page named `index.html` that contains links and
|
208
|
+
some info about the converted files. The file is placed in the `my_dst_root` dir.
|
209
|
+
|
210
|
+
The default asciidoctor css will be used in the html conversion.
|
211
|
+
|
212
|
+
=== Giblish pdf 'hello world'
|
213
|
+
|
214
|
+
giblish -f pdf my_src_root my_dst_root
|
215
|
+
|
216
|
+
* convert all .adoc or .ADOC files under the dir `my_src_root` to
|
217
|
+
pdf and place the resulting files under the `my_dst_root` dir.
|
218
|
+
* generate an index page named `index.pdf` that contains links and
|
219
|
+
some info about the converted files. The file is placed in the `my_dst_root` dir.
|
220
|
+
|
221
|
+
The default asciidoctor pdf theme will be used in the pdf conversion.
|
222
|
+
|
223
|
+
=== Using a custom css for the generated html
|
224
|
+
|
225
|
+
Generate html that can be browsed locally from file:://<my_dst_root>.
|
226
|
+
|
227
|
+
giblish -r path/to/my/resources -s mylayout my_src_root my_dst_root
|
228
|
+
|
229
|
+
* convert all .adoc or .ADOC files under the dir `my_src_root` to
|
230
|
+
html and place the resulting files under the `my_dst_root` dir.
|
231
|
+
* generate an index page named `index.html` that contains links and
|
232
|
+
some info about the converted files. The file is placed in the `my_dst_root` dir.
|
233
|
+
* copy the `css`, `fonts` and `images` directories found under
|
234
|
+
`<working_dir>/path/to/my/resources` to `my_dst_root/web_assets`
|
235
|
+
* link all generated html files to the css found at
|
236
|
+
`/web_assets/css/mylayout.css`
|
237
|
+
|
238
|
+
|
239
|
+
=== Using a custom pdf theme for the generated pdfs
|
240
|
+
|
241
|
+
giblish -f pdf -r path/to/my/resources -s mylayout my_src_root my_dst_root
|
242
|
+
|
243
|
+
* convert all .adoc or .ADOC files under the dir `my_src_root` to
|
244
|
+
pdf and place the resulting files under the `my_dst_root` dir.
|
245
|
+
* generate an index page named `index.pdf` that contains links and
|
246
|
+
some info about the converted files. The file is placed in the `my_dst_root` dir.
|
247
|
+
* the generated pdf will use the theme found at
|
248
|
+
`<working_dir>/path/to/my/resources/themes/mylayout.yml`
|
249
|
+
|
250
|
+
=== Generate html from multiple git branches
|
251
|
+
|
252
|
+
giblish -g "feature" my_src_root my_dst_root
|
253
|
+
|
254
|
+
* check-out each branch matching the regexp "feature" in turn
|
255
|
+
* for each checked-out branch,
|
256
|
+
** convert the .adoc or .ADOC files under the dir `my_src_root` to html.
|
257
|
+
** place the resulting files under the `my_dst_root/<branch_name>` dir.
|
258
|
+
** generate an index page named `index.html` that contains links and
|
259
|
+
some info about the converted files. The file is placed in the
|
260
|
+
`my_dst_root/<branch_name` dir.
|
261
|
+
* generate a summary page containing links to a all branches and place it in
|
262
|
+
the `my_dst_root` dir.
|
263
|
+
|
264
|
+
=== Publish the asciidoctor.org documents with text search
|
265
|
+
|
266
|
+
giblish can be used to generate html docs suitable for serving via a web
|
267
|
+
server (e.g. Apache). You can use the cgi script included in the giblish
|
268
|
+
gem to provide text search capabilities.
|
269
|
+
|
270
|
+
Here is an example of how to publish the docs in the official asciidoctor.org git
|
271
|
+
repo to a web server, including index pages and text search.
|
272
|
+
|
273
|
+
NOTE: No consideration has been taken to how permissions are set up on the web server.
|
274
|
+
Just running the below commands as-is on e.g.a standard apache set-up will bail out
|
275
|
+
with 'permission denied' errors.
|
276
|
+
|
277
|
+
==== Generating the html documents
|
278
|
+
|
279
|
+
The example assumes that you have one machine where you generate the documents and another
|
280
|
+
machine that runs a web server to which you have ssh access.
|
281
|
+
|
282
|
+
The generated docs shall be accessible via _www.example.com/adocorg/with_search_
|
283
|
+
|
284
|
+
You need to provide two pieces of deployment info to giblish when generating the documents:
|
285
|
+
|
286
|
+
* the uri path where to access the deployed docs (/adocorg/with_search in this example)
|
287
|
+
* the path in the local file system on the web server where the search data can be accessed
|
288
|
+
(/var/www/html/site_1/adocorg/with_search in this example)
|
289
|
+
|
290
|
+
The following commands will generate the asciidoctor.org documentation and deploy the result
|
291
|
+
to the web server.
|
292
|
+
|
293
|
+
. Clone the asciidoctor doc repo to your development machine
|
294
|
+
+
|
295
|
+
git clone https://github.com/asciidoctor/asciidoctor.org.git
|
296
|
+
|
297
|
+
. Generate the html documentation with the correct deployment info
|
298
|
+
+
|
299
|
+
giblish -j '^.*_include.*' -m -mp /var/www/html/site_1/adocorg/with_search -w /adocorg/with_search -g master --index-basename "myindex" asciidoctor.org/docs ./generated_docs
|
300
|
+
+
|
301
|
+
Explanation of the parameters and arguments::
|
302
|
+
* *pass:[-j '^.*_include.*']* - exclude everything in the __include_ directory. (the
|
303
|
+
asciidoctor.org repo stores partial docs here).
|
304
|
+
* *-m* - assemble the necessary search data to support text search and include this data as part of
|
305
|
+
the generated documents.
|
306
|
+
* *-mp /var/www/html/site_1/adocorg/with_search* - the file system path on the deployment machine where
|
307
|
+
the search data is located
|
308
|
+
* *-w /adocorg/with_search* - the uri path to the deployed docs
|
309
|
+
* *-g master* - publish all git branches that matches the regexp 'master' (i.e. only the 'master'
|
310
|
+
branch).
|
311
|
+
* *--index-basename "myindex"* - change the default name (index) that giblish uses for the generated
|
312
|
+
index page. This is needed since asciidoctor.org contains an
|
313
|
+
"index.adoc" file that would otherwise be overwritten by giblish.
|
314
|
+
* *asciidoctor.org/docs* - the root of the source document tree.
|
315
|
+
* *./generated_docs* - a temporary storage for the generated html docs on the local system.
|
316
|
+
+
|
317
|
+
|
318
|
+
. Copy the generated files to the web server
|
319
|
+
|
320
|
+
scp -r ./generated_docs rillbert@my.web.server.org:/var/www/adocorg/with_search/.
|
321
|
+
+
|
322
|
+
|
323
|
+
|
324
|
+
==== Copy the text search script to the web server
|
325
|
+
|
326
|
+
This only needs to be done once (or if a new version of giblish breaks the currently used API).
|
327
|
+
|
328
|
+
IMPORTANT: The current version of giblish expects the script to be found at the URI path
|
329
|
+
`/cgi-bin/giblish-search.cgi`. This might be customizable in future versions but is currently
|
330
|
+
hard-coded. Thus, if your web-server serves pages at www.mywebsite.com, the search script must be
|
331
|
+
accessible at www.mywebsite.com/cgi-bin/giblish-search.cgi
|
332
|
+
|
333
|
+
. Find the server side script that implements text search that is included with
|
334
|
+
giblish
|
335
|
+
|
336
|
+
gem which giblish
|
337
|
+
+
|
338
|
+
|
339
|
+
In my case this returns `/var/lib/ruby/gems/2.4.0/gems/giblish-0.5.2/lib/giblish.rb`. This means that I will find the script in the same directory, i.e. `/var/lib/ruby/gems/2.4.0/gems/giblish-0.5.2/lib`.
|
340
|
+
|
341
|
+
. Copy the server side script to the /cgi-bin dir on the web server. In this example the cgi-bin dir
|
342
|
+
is configured to be /var/www/cgi-bin
|
343
|
+
+
|
344
|
+
scp /var/lib/ruby/gems/2.4.0/gems/giblish-0.5.2/lib/giblish-search.rb rillbert@my.web.server.org:/var/www/cgi-bin/giblish-search.cgi
|
345
|
+
|
346
|
+
////
|
347
|
+
|
348
|
+
If you
|
349
|
+
combine this with a server side git hook that invokes this script after push,
|
350
|
+
you will have a way of auto publish your latest documents and/or documents at
|
351
|
+
specific git tags. A document management system including nice index pages and
|
352
|
+
text search capabilities
|
353
|
+
|
354
|
+
=== Generate html from giblish git repo using giblish css
|
355
|
+
|
356
|
+
Assuming you have cloned this git repo to `~/github/giblish` you can do:
|
357
|
+
|
358
|
+
giblish -g "master" -r ~/github/giblish/resources ~/github/giblish my_dst_root
|
359
|
+
|
360
|
+
The above will check-out all branches matching the regexp "master" and convert
|
361
|
+
the .adoc or .ADOC files under the dir `my_src_root` to html and place the
|
362
|
+
resulting files under the `my_dst_root/<branch_name>` dir.
|
363
|
+
|
364
|
+
An index page named `index.html` is generated in each `my_dst_root/<branch_name`
|
365
|
+
dir containing links and some info about the converted files.
|
366
|
+
|
367
|
+
A summary page containing links to all branches will be generated directly in
|
368
|
+
the `my_dst_root` dir.
|
369
|
+
====
|
370
|
+
|
371
|
+
.Generate pdf from giblish git repo using the giblish pdf theme
|
372
|
+
====
|
373
|
+
Assuming you have cloned this git repo to `~/github/giblish` you can do:
|
374
|
+
|
375
|
+
giblish -f pdf -g "master" -r ~/github/giblish/resources ~/github/giblish my_dst_root
|
376
|
+
|
377
|
+
The above will check-out all branches matching the regexp "master" and convert
|
378
|
+
the .adoc or .ADOC files under the dir `my_src_root` to pdf and place the
|
379
|
+
resulting files under the `my_dst_root/<branch_name>` dir.
|
380
|
+
|
381
|
+
An index page named `index.pdf` is generated in each `my_dst_root/<branch_name`
|
382
|
+
dir containing links and some info about the converted files.
|
383
|
+
|
384
|
+
A summary page containing links to all branches will be generated directly in
|
385
|
+
the `my_dst_root` dir.
|
386
|
+
====
|
387
|
+
////
|
248
388
|
|
249
|
-
* searchphrase -> the text string to search for
|
250
|
-
* ignorecase -> wether to ignore case or not
|
251
|
-
* useregexp -> wether the searchphrase above is treated as a regexp or
|
252
|
-
ordinary text
|
253
|
-
* css -> the css file name to use when styling the search result page
|
254
|
-
* topdir -> the absolute path to the root of the generated document tree
|
255
|
-
* reltop -> <clarify this>
|