Skip to content

Commit c6c4494

Browse files
committed
Introduce test of html and epub
This is an indirect way of checking the structure of the book, the asciidoc syntax and the external links.
1 parent be4296c commit c6c4494

File tree

11 files changed

+31
-19
lines changed

11 files changed

+31
-19
lines changed

Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ gem 'asciidoctor-pdf', '1.5.3'
1212
gem 'coderay', '1.1.3'
1313
gem 'pygments.rb', '1.2.1'
1414
gem 'thread_safe', '0.3.6'
15-
gem 'epubcheck', '3.0.1'
15+
gem 'epubcheck-ruby'
16+
gem 'html-proofer'

Rakefile

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
namespace :book do
2+
def exec_or_raise(command)
3+
puts `#{command}`
4+
if (! $?.success?)
5+
raise "'#{command}' failed"
6+
end
7+
end
8+
29
desc 'build basic book formats'
310
task :build do
411

@@ -16,10 +23,14 @@ namespace :book do
1623
`bundle exec asciidoctor #{params} -a data-uri progit.asc`
1724
puts " -- HTML output at progit.html"
1825

26+
exec_or_raise('htmlproofer --check-html progit.html')
27+
1928
puts "Converting to EPub..."
2029
`bundle exec asciidoctor-epub3 #{params} progit.asc`
2130
puts " -- Epub output at progit.epub"
2231

32+
exec_or_raise('epubcheck progit.epub')
33+
2334
# Commented out the .mobi file creation because the kindlegen dependency is not available.
2435
# For more information on this see: #1496.
2536
# This is a (hopefully) temporary fix until upstream asciidoctor-epub3 is fixed and we can offer .mobi files again.

book/03-git-branching/sections/workflows.asc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ It's generally easier to think about them as work silos, where sets of commits g
2323

2424
[[lrbranch_b]]
2525
.A "`silo`" view of progressive-stability branching
26-
image::images/lr-branches-2.png[A "`silo`" view of progressive-stability branching]
26+
image::images/lr-branches-2.png[A silo view of progressive-stability branching']
2727

2828
You can keep doing this for several levels of stability.
2929
Some larger projects also have a `proposed` or `pu` (proposed updates) branch that has integrated branches that may not be ready to go into the `next` or `master` branch.

book/04-git-server/sections/gitlab.asc

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ After you've logged in, click the "`Admin area`" icon in the menu at the top rig
3030

3131
[[gitlab_menu]]
3232
.The "`Admin area`" item in the GitLab menu
33-
image::images/gitlab-menu.png[The `"Admin area`" item in the GitLab menu]
33+
image::images/gitlab-menu.png[The Admin area item in the GitLab menu]
3434

3535
===== Users
3636

book/06-github/sections/1-setting-up-account.asc

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ If you don't already have one, see <<ch04-git-on-the-server#_generate_ssh_key>>.
3333
Open up your account settings using the link at the top-right of the window:
3434

3535
.The "`Account settings`" link
36-
image::images/account-settings.png[The "`Account settings`" link]
36+
image::images/account-settings.png[The Account settings link]
3737

3838
Then select the "`SSH keys`" section along the left-hand side.
3939

4040
.The "`SSH keys`" link.
41-
image::images/ssh-keys.png[The "`SSH keys`" link]
41+
image::images/ssh-keys.png[The SSH keys link]
4242

4343
From there, click the "`Add an SSH key`" button, give your key a name, paste the contents of your `~/.ssh/id_rsa.pub` (or whatever you named it) public-key file into the text area, and click "`Add key`".
4444

@@ -55,7 +55,7 @@ Next, if you wish, you can replace the avatar that is generated for you with an
5555
First go to the "`Profile`" tab (above the SSH Keys tab) and click "`Upload new picture`".
5656

5757
.The "`Profile`" link
58-
image::images/your-profile.png[The "`Profile`" link]
58+
image::images/your-profile.png[The Profile link]
5959

6060
We'll choose a copy of the Git logo that is on our hard drive and then we get a chance to crop it.
6161

book/06-github/sections/2-contributing.asc

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This opens up a discussion thread with code review, and the owner and the contri
2121
To fork a project, visit the project page and click the "`Fork`" button at the top-right of the page.
2222

2323
.The "`Fork`" button
24-
image::images/forkbutton.png[The "`Fork`" button]
24+
image::images/forkbutton.png[The Fork button]
2525

2626
After a few seconds, you'll be taken to your new project page, with your own writeable copy of the code.
2727

@@ -123,7 +123,7 @@ To https://github.com/tonychacon/blink
123123

124124
Now if we go back to our fork on GitHub, we can see that GitHub noticed that we pushed a new topic branch up and presents us with a big green button to check out our changes and open a Pull Request to the original project.
125125

126-
You can alternatively go to the "`Branches`" page at `https://github.com/<user>/<project>/branches` to locate your branch and open a new Pull Request from there.
126+
You can alternatively go to the "`Branches`" page at `\https://github.com/<user>/<project>/branches` to locate your branch and open a new Pull Request from there.
127127

128128
.Pull Request button
129129
image::images/blink-02-pr.png[Pull Request button]

book/06-github/sections/3-maintaining.asc

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ Let's create a new repository to share our project code with.
99
Start by clicking the "`New repository`" button on the right-hand side of the dashboard, or from the `+` button in the top toolbar next to your username as seen in <<_new_repo_dropdown>>.
1010

1111
.The "`Your repositories`" area
12-
image::images/newrepo.png[The "`Your repositories`" area]
12+
image::images/newrepo.png[The Your repositories area]
1313

1414
[[_new_repo_dropdown]]
1515
.The "`New repository`" dropdown
16-
image::images/new-repo.png[The "`new repository`" dropdown]
16+
image::images/new-repo.png[The new repository dropdown]
1717

1818
This takes you to the "`new repository`" form:
1919

2020
.The "`new repository`" form
21-
image::images/newrepoform.png[The "`new repository`" form]
21+
image::images/newrepoform.png[The new repository form]
2222

2323
All you really have to do here is provide a project name; the rest of the fields are completely optional.
2424
For now, just click the "`Create Repository`" button, and boom – you have a new repository on GitHub, named `<user>/<project_name>`.
@@ -27,7 +27,7 @@ Since you have no code there yet, GitHub will show you instructions for how to c
2727
We won't belabor this here; if you need a refresher, check out <<ch02-git-basics-chapter#ch02-git-basics-chapter>>.
2828

2929
Now that your project is hosted on GitHub, you can give the URL to anyone you want to share your project with.
30-
Every project on GitHub is accessible over HTTPS as `https://github.com/<user>/<project_name>`, and over SSH as `[email protected]:<user>/<project_name>`.
30+
Every project on GitHub is accessible over HTTPS as `\https://github.com/<user>/<project_name>`, and over SSH as `\[email protected]:<user>/<project_name>`.
3131
Git can fetch from and push to both of these URLs, but they are access-controlled based on the credentials of the user connecting to them.
3232

3333
[NOTE]

book/08-customizing-git/sections/attributes.asc

+3-3
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ These filters can be set to do all sorts of fun things.
198198

199199
[[filters_a]]
200200
.The "`smudge`" filter is run on checkout
201-
image::images/smudge.png[The "`smudge`" filter is run on checkout]
201+
image::images/smudge.png[The smudge filter is run on checkout]
202202

203203
[[filters_b]]
204204
.The "`clean`" filter is run when files are staged
205-
image::images/clean.png[The "`clean`" filter is run when files are staged]
205+
image::images/clean.png[The clean filter is run when files are staged]
206206

207207
The original commit message for this feature gives a simple example of running all your C source code through the `indent` program before committing.
208-
You can set it up by setting the filter attribute in your `.gitattributes` file to filter `*.c` files with the "`indent`" filter:
208+
You can set it up by setting the filter attribute in your `.gitattributes` file to filter `\*.c` files with the "`indent`" filter:
209209

210210
[source,ini]
211211
----

book/10-git-internals/sections/environment.asc

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ A "`pathspec`" refers to how you specify paths to things in Git, including the u
5555
These are used in the `.gitignore` file, but also on the command-line (`git add *.c`).
5656

5757
*`GIT_GLOB_PATHSPECS`* and *`GIT_NOGLOB_PATHSPECS`* control the default behavior of wildcards in pathspecs.
58-
If `GIT_GLOB_PATHSPECS` is set to 1, wildcard characters act as wildcards (which is the default); if `GIT_NOGLOB_PATHSPECS` is set to 1, wildcard characters only match themselves, meaning something like `*.c` would only match a file _named_ "`*.c`", rather than any file whose name ends with `.c`.
59-
You can override this in individual cases by starting the pathspec with `:(glob)` or `:(literal)`, as in `:(glob)*.c`.
58+
If `GIT_GLOB_PATHSPECS` is set to 1, wildcard characters act as wildcards (which is the default); if `GIT_NOGLOB_PATHSPECS` is set to 1, wildcard characters only match themselves, meaning something like `\*.c` would only match a file _named_ "`\*.c`", rather than any file whose name ends with `.c`.
59+
You can override this in individual cases by starting the pathspec with `:(glob)` or `:(literal)`, as in `:(glob)\*.c`.
6060

6161
*`GIT_LITERAL_PATHSPECS`* disables both of the above behaviors; no wildcard characters will work, and the override prefixes are disabled as well.
6262

book/A-git-in-other-environments/sections/visualstudio.asc

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This is a hub for performing Git actions; when you're _writing_ code, you'll pro
1818

1919
[[vs_home]]
2020
.The "Home" view for a Git repository in Visual Studio
21-
image::images/vs-2.png[The "`Home`" view for a Git repository in Visual Studio]
21+
image::images/vs-2.png[The Home view for a Git repository in Visual Studio]
2222

2323
Visual Studio now has a powerful task-focused UI for Git.
2424
It includes a linear history view, a diff viewer, remote commands, and many other capabilities.

book/B-embedding-git/sections/dulwich.asc

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ porcelain.log('.', max_entries=1)
4040

4141
==== Further Reading
4242

43-
* The official API documentation is available at https://www.dulwich.io/apidocs/dulwich.html[].
43+
* The official API documentation is available at https://www.dulwich.io/docs/api/
4444
* Official tutorial at https://www.dulwich.io/docs/tutorial[] has many examples of how to do specific tasks with Dulwich.

0 commit comments

Comments
 (0)