Skip to content

Commit 41238ec

Browse files
authored
Only build with --direct_html (#1659)
This removes support for building docs without direct_html. You no longer need to specify `--direct_html` on the command line or `direct_html` in conf.yaml for it ot build with direct_html. This doesn't drop the configuration from conf.yaml or the change tracker or all of the files that we need to build with docbook. We'll do that in a followup.
1 parent 0b9fed0 commit 41238ec

File tree

8 files changed

+98
-377
lines changed

8 files changed

+98
-377
lines changed

README.asciidoc

+1-4
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,7 @@ Words.
354354
----
355355
--
356356

357-
. If the doc is built with DocBook then you *must* use
358-
a pass block with `<titleabbrev>`. If the doc is built
359-
with `--direct_html` then you *may* use the pass block
360-
but it isn't recommended:
357+
. You *may* use the pass block but it isn't recommended:
361358
+
362359
--
363360
[source,asciidoc]

build_docs.pl

+8-21
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ BEGIN
6969
forever in honor of our success but otherwise doesn't do anything.
7070
MSG
7171
}
72+
if ( $Opts->{direct_html} ) {
73+
say <<MSG
74+
The direct_html migration is complete! --direct_html will emit this message
75+
forever in honor of our success but otherwise doesn't do anything.
76+
MSG
77+
}
7278

7379
init_env();
7480

@@ -887,7 +893,6 @@ sub command_line_opts {
887893
# Options only compatible with --doc
888894
'doc=s',
889895
'alternatives=s@',
890-
'direct_html',
891896
'chunk=i',
892897
'lang=s',
893898
'lenient',
@@ -917,6 +922,7 @@ sub command_line_opts {
917922
# Options that do *something* for either --doc or --all or --preview
918923
'asciidoctor',
919924
'conf=s',
925+
'direct_html',
920926
'in_standard_docker',
921927
'open',
922928
'procs=i',
@@ -937,8 +943,6 @@ sub usage {
937943
--chunk 1 Also chunk sections into separate files
938944
--alternatives <source_lang>:<alternative_lang>:<dir>
939945
Examples in alternative languages.
940-
--direct_html Generate html directly from Asciidoctor without
941-
using docbook.
942946
--lang Defaults to 'en'
943947
--lenient Ignore linking errors
944948
--out dest/dir/ Defaults to ./html_docs.
@@ -981,30 +985,14 @@ sub usage {
981985
--asciidoctor Emit a happy message.
982986
--conf <ymlfile> Use your own configuration file, defaults to the
983987
bundled conf.yaml
988+
--direct_html Emit a happy message.
984989
--in_standard_docker
985990
Specified by build_docs when running in
986991
its container
987992
--open Open the docs in a browser once built.
988993
--procs Number of processes to run in parallel, defaults
989994
to 3
990995
--verbose Output more logs
991-
992-
Self Test:
993-
994-
build_docs --self-test <args to pass to make>
995-
996-
`--self-test` is a wrapper around `make` which is used exclusively for
997-
testing. Like `make`, the current directory selects the `Makefile` and
998-
you can make specific targets. Some examples:
999-
1000-
Execute all tests:
1001-
build_docs --self-test
1002-
1003-
Execute all of the tests for our extensions to Asciidoctor:
1004-
build_docs --self-test -C resources/asciidoctor
1005-
1006-
Run rubocop on our extensions to Asciidoctor:
1007-
build_docs --self-test -C resources/asciidoctor rubocop
1008996
USAGE
1009997
}
1010998

@@ -1015,7 +1003,6 @@ sub check_opts {
10151003
die('--alternatives only compatible with --doc') if $Opts->{alternatives};
10161004
die('--chunk only compatible with --doc') if $Opts->{chunk};
10171005
# Lang will be 'en' even if it isn't specified so we don't check it.
1018-
die('--direct_html only compatible with --doc') if $Opts->{direct_html};
10191006
die('--lenient only compatible with --doc') if $Opts->{lenient};
10201007
die('--out only compatible with --doc') if $Opts->{out};
10211008
die('--resource only compatible with --doc') if $Opts->{resource};

integtest/spec/all_books_change_detection_spec.rb

-28
Original file line numberDiff line numberDiff line change
@@ -444,34 +444,6 @@ def chapter(index)
444444
include_examples 'second build is not a noop'
445445
include_examples 'second build only changes chapter2'
446446
end
447-
context 'because the book changes from docbook to direct_html' do
448-
build_one_book_out_of_one_repo_twice(
449-
before_first_build: lambda do |src, _config|
450-
book = src.book 'Test'
451-
book.single = true
452-
book.direct_html = false
453-
end,
454-
before_second_build: lambda do |src, _config|
455-
book = src.book 'Test'
456-
book.direct_html = true
457-
end
458-
)
459-
include_examples 'second build is not a noop'
460-
end
461-
context 'because the book changes from direct_html to docbook' do
462-
build_one_book_out_of_one_repo_twice(
463-
before_first_build: lambda do |src, _config|
464-
book = src.book 'Test'
465-
book.direct_html = true
466-
book.single = true
467-
end,
468-
before_second_build: lambda do |src, _config|
469-
book = src.book 'Test'
470-
book.direct_html = false
471-
end
472-
)
473-
include_examples 'second build is not a noop'
474-
end
475447
context 'because there is a target_branch and we have changes' do
476448
# We always fork the target_branch from master so if the target
477449
# branch contains any changes from master we rebuild them every time.

integtest/spec/helper/console_alternative_examples.rb

+49-99
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ module ConsoleExamples
3737
end
3838

3939
RSpec.shared_examples 'README-like console alternatives' do |raw_path, path|
40-
# NOTE: this class has lots of `if direct_html ... else ... end` going on.
41-
# That is because direct_html outputs classes in a different order than
42-
# docbook and adds many extra newlines.
4340
page_context "#{path}/chapter.html" do
4441
let(:has_classes) { 'has-js has-csharp' }
4542
let(:console_widget) do
@@ -48,112 +45,65 @@ module ConsoleExamples
4845
HTML
4946
end
5047
it 'contains the js listing followed by the csharp listing' do
51-
if direct_html
52-
expect(body).to include(<<~HTML.strip)
53-
<div class="pre_wrapper lang-js alternative">
54-
<pre class="programlisting prettyprint lang-js alternative">const result = await client.search({
55-
body: { query: 'foo bar' } <a id="A0-CO1-1"></a><i class="conum" data-value="1"></i>
56-
})</pre>
57-
</div>
58-
<div class="pre_wrapper lang-csharp alternative">
59-
HTML
60-
else
61-
expect(body).to include(<<~HTML.strip)
62-
<div class="pre_wrapper alternative lang-js"><pre class="alternative programlisting prettyprint lang-js">const result = await client.search({
63-
body: { query: 'foo bar' } <a id="A0-CO1-1"></a><i class="conum" data-value="1"></i>
64-
})</pre></div><div class="pre_wrapper alternative lang-csharp">
65-
HTML
66-
end
48+
expect(body).to include(<<~HTML.strip)
49+
<div class="pre_wrapper lang-js alternative">
50+
<pre class="programlisting prettyprint lang-js alternative">const result = await client.search({
51+
body: { query: 'foo bar' } <a id="A0-CO1-1"></a><i class="conum" data-value="1"></i>
52+
})</pre>
53+
</div>
54+
<div class="pre_wrapper lang-csharp alternative">
55+
HTML
6756
end
6857
it 'contains the csharp listing followed by the default listing' do
69-
if direct_html
70-
expect(body).to include(<<~HTML.strip)
71-
<div class="pre_wrapper lang-csharp alternative">
72-
<pre class="programlisting prettyprint lang-csharp alternative">var searchResponse = _client.Search&lt;Project&gt;(s =&gt; s
73-
.Query(q =&gt; q
74-
.QueryString(m =&gt; m
75-
.Query("foo bar") <a id="A1-CO1-1"></a><i class="conum" data-value="1"></i>
76-
)
77-
)
78-
);</pre>
79-
</div>
80-
<div class="pre_wrapper lang-console default #{has_classes}">
81-
HTML
82-
else
83-
expect(body).to include(<<~HTML.strip)
84-
<div class="pre_wrapper alternative lang-csharp"><pre class="alternative programlisting prettyprint lang-csharp">var searchResponse = _client.Search&lt;Project&gt;(s =&gt; s
85-
.Query(q =&gt; q
86-
.QueryString(m =&gt; m
87-
.Query("foo bar") <a id="A1-CO1-1"></a><i class="conum" data-value="1"></i>
88-
)
89-
)
90-
);</pre></div><div class="pre_wrapper default #{has_classes} lang-console">
91-
HTML
92-
end
58+
expect(body).to include(<<~HTML.strip)
59+
<div class="pre_wrapper lang-csharp alternative">
60+
<pre class="programlisting prettyprint lang-csharp alternative">var searchResponse = _client.Search&lt;Project&gt;(s =&gt; s
61+
.Query(q =&gt; q
62+
.QueryString(m =&gt; m
63+
.Query("foo bar") <a id="A1-CO1-1"></a><i class="conum" data-value="1"></i>
64+
)
65+
)
66+
);</pre>
67+
</div>
68+
<div class="pre_wrapper lang-console default #{has_classes}">
69+
HTML
9370
end
9471
it 'contains the default listing followed by the console widget' do
95-
if direct_html
96-
expect(body).to include(<<~HTML.strip)
97-
<div class="pre_wrapper lang-console default #{has_classes}">
98-
<pre class="programlisting prettyprint lang-console default #{has_classes}">GET /_search
99-
{
100-
"query": "foo bar" <a id="CO1-1"></a><i class="conum" data-value="1"></i>
101-
}</pre>
102-
</div>
103-
#{console_widget}
104-
HTML
105-
else
106-
expect(body).to include(<<~HTML.strip)
107-
<div class="pre_wrapper default #{has_classes} lang-console"><pre class="default #{has_classes} programlisting prettyprint lang-console">GET /_search
108-
{
109-
"query": "foo bar" <a id="CO1-1"></a><i class="conum" data-value="1"></i>
110-
}</pre></div>#{console_widget}
111-
HTML
112-
end
72+
expect(body).to include(<<~HTML.strip)
73+
<div class="pre_wrapper lang-console default #{has_classes}">
74+
<pre class="programlisting prettyprint lang-console default #{has_classes}">GET /_search
75+
{
76+
"query": "foo bar" <a id="CO1-1"></a><i class="conum" data-value="1"></i>
77+
}</pre>
78+
</div>
79+
#{console_widget}
80+
HTML
11381
end
11482
it 'contains the console widget followed by the js calloutlist' do
115-
if direct_html
116-
expect(body).to include(<<~HTML.strip)
117-
#{console_widget}
118-
<div class="calloutlist alternative lang-js">
119-
HTML
120-
else
121-
expect(body).to include(<<~HTML.strip)
122-
#{console_widget}<div class="alternative lang-js calloutlist">
123-
HTML
124-
end
83+
expect(body).to include(<<~HTML.strip)
84+
#{console_widget}
85+
<div class="calloutlist alternative lang-js">
86+
HTML
12587
end
12688
it 'contains the js calloutlist followed by the csharp calloutlist' do
127-
if direct_html
128-
expect(body).to include(<<~HTML.strip)
129-
js</p>
130-
</td>
131-
</tr>
132-
</table>
133-
</div>
134-
<div class="calloutlist alternative lang-csharp">
135-
HTML
136-
else
137-
expect(body).to include(<<~HTML.strip)
138-
js</p></td></tr></table></div><div class="alternative lang-csharp calloutlist">
139-
HTML
140-
end
89+
expect(body).to include(<<~HTML.strip)
90+
js</p>
91+
</td>
92+
</tr>
93+
</table>
94+
</div>
95+
<div class="calloutlist alternative lang-csharp">
96+
HTML
14197
end
14298
it 'contains the csharp calloutlist followed by the default calloutlist' do
143-
if direct_html
144-
expect(body).to include(<<~HTML.strip)
145-
csharp</p>
146-
</td>
147-
</tr>
148-
</table>
149-
</div>
150-
<div class="calloutlist default #{has_classes} lang-console">
151-
HTML
152-
else
153-
expect(body).to include(<<~HTML.strip)
154-
csharp</p></td></tr></table></div><div class="default #{has_classes} lang-console calloutlist">
155-
HTML
156-
end
99+
expect(body).to include(<<~HTML.strip)
100+
csharp</p>
101+
</td>
102+
</tr>
103+
</table>
104+
</div>
105+
<div class="calloutlist default #{has_classes} lang-console">
106+
HTML
157107
end
158108
context 'the initial js state' do
159109
it 'contains the available alternatives' do

lib/ES/Book.pm

-2
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ sub _build_book {
279279
branch => $branch,
280280
roots => $roots,
281281
relativize => 1,
282-
direct_html => $self->{direct_html},
283282
);
284283
}
285284
else {
@@ -304,7 +303,6 @@ sub _build_book {
304303
branch => $branch,
305304
roots => $roots,
306305
relativize => 1,
307-
direct_html => $self->{direct_html},
308306
);
309307
}
310308
$checkout->rmtree;

lib/ES/Toc.pm

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ sub write {
4545
branch => '', # TOCs don't have a branch but it is a required arg
4646
relativize => 1,
4747
extra => $extra,
48-
direct_html => 1,
4948
);
5049
$adoc_file->remove;
5150
}

0 commit comments

Comments
 (0)