forked from tajmone/ST4-Asciidoctor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
86 lines (69 loc) · 2.06 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
=begin "Rakefile" v0.3.0 | 2024/02/03| by Tristano Ajmone
================================================================================
Rake automation for the Sublime Asciidoctor package.
================================================================================
=end
# Custom helpers ...
require './_assets/rake/globals.rb'
require './_assets/rake/asciidoc.rb'
# ==============================================================================
# -------------------------------{ T A S K S }--------------------------------
# ==============================================================================
task :default => [:guide, :tests_html]
## Clean & Clobber
##################
require 'rake/clean'
CLOBBER.include('Tests/**/*.html')
CLOBBER.include('docs/*.html')
## Syntax Tests to HTML
#######################
desc "Convert syntax test to HTML"
task :tests_html
# We use the @ precedence modifier so that document-defined
# attributes will always override CLI definitions.
TESTS_ADOC_OPTS = <<~HEREDOC
--failure-level WARN \
--verbose \
--timings \
--safe-mode unsafe \
-a experimental@ \
-a toc@=left \
-a sectanchors@ \
-a reproducible@ \
-a icons@=font \
-a !caption=@
HEREDOC
TEST_DOCS = FileList['Tests/**/*.asciidoc'].exclude(
'__*.*',
'**/_syntax_test_*.*'
).each do |f|
html_doc = f.ext('.html').sub('syntax_test_', '')
task :tests_html => html_doc
file html_doc => f do |t|
AsciidoctorConvert(t.source, html_doc.pathmap("%f"), TESTS_ADOC_OPTS)
end
end
## Build Documentation
######################
desc "Build HTML user guide"
task :guide
GUIDE_SRC = 'docs-src/index.asciidoc'
GUIDE_HTM = 'docs/index.html'
GUIDE_DEPS = FileList[
GUIDE_SRC,
'docs-src/*.adoc',
'_assets/rake/*.rb'
]
GUIDE_ADOC_OPTS = <<~HEREDOC
-a source-highlighter=rouge \
-a rouge-style=thankful_eyes \
--failure-level WARN \
--verbose \
--timings \
--safe-mode unsafe \
--destination-dir=../docs
HEREDOC
task :guide => GUIDE_HTM
file GUIDE_HTM => GUIDE_DEPS do |f|
AsciidoctorConvert(GUIDE_SRC, "index.html", GUIDE_ADOC_OPTS)
end