Skip to content

Commit 7df3874

Browse files
committed
switch to pygments
1 parent f1b25ae commit 7df3874

File tree

4 files changed

+76
-5
lines changed

4 files changed

+76
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SOURCES := $(wildcard *.asciidoc)
22
HTML_PAGES := $(patsubst %.asciidoc, %.html, ${SOURCES})
33
TESTS := $(patsubst %.asciidoc, test_%, ${SOURCES})
44

5-
RUN_ASCIIDOCTOR = asciidoctor -a source-highlighter=coderay -a stylesheet=asciidoctor.css -a linkcss -a icons=font -a compat-mode -a '!example-caption' -a last-update-label='License: Creative Commons <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode">CC-BY-NC-ND</a>. Last updated:'
5+
RUN_ASCIIDOCTOR = asciidoctor -a source-highlighter=pygments -a pygments-style=default -a stylesheet=asciidoctor.css -a linkcss -a icons=font -a compat-mode -a '!example-caption' -a last-update-label='License: Creative Commons <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode">CC-BY-NC-ND</a>. Last updated:'
66
RUN_OREILLY_FLAVOURED_ASCIIDOCTOR = ./asciidoc/asciidoctor/bin/asciidoctor -v --trace -d book --safe -b htmlbook --template-dir ./asciidoc/asciidoctor-htmlbook/htmlbook
77

88
export PYTHONHASHSEED = 0

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ and under CC license. And you'll also be able to buy an ebook or print version
1212
if you feel like it.*
1313

1414
These sources are being made available for the purposes of curiosity
15-
(others writing books may be interested in the test suite for example)
16-
and collaboration (typo-fixes by pull request are very much encouraged).
15+
(although if you're curious about the way the listings are tested,
16+
i would definitely recommend https://github.com/cosmicpython/book instead)
17+
and collaboration (typo-fixes by pull request are very much encouraged!).
1718

1819

1920
# Building the book as HTML
2021

21-
- install [asciidoctor](http://asciidoctor.org/), and the *coderay* gem.
22+
- install [asciidoctor](http://asciidoctor.org/), and the *pygments/pygmentize* gem.
2223
- `make build` will build each chapter as its own html file
2324
- `make book.html` will create a single file
2425
- `make chapter_05_post_and_database.html`, eg, will build chapter 5

book.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:doctype: book
22
:bookseries: pythonbook
3-
:source-highlighter: coderay
3+
:source-highlighter: pygments
4+
:pygments-style: manni
45
:icons: font
56

67
= Test-Driven Development with Python

pygments-default.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
pre.pygments .hll { background-color: #ffffcc }
2+
pre.pygments { background: #f8f8f8; }
3+
pre.pygments .tok-c { color: #3D7B7B; font-style: italic } /* Comment */
4+
pre.pygments .tok-err { border: 1px solid #FF0000 } /* Error */
5+
pre.pygments .tok-k { color: #008000; font-weight: bold } /* Keyword */
6+
pre.pygments .tok-o { color: #666666 } /* Operator */
7+
pre.pygments .tok-ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
8+
pre.pygments .tok-cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
9+
pre.pygments .tok-cp { color: #9C6500 } /* Comment.Preproc */
10+
pre.pygments .tok-cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
11+
pre.pygments .tok-c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
12+
pre.pygments .tok-cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
13+
pre.pygments .tok-gd { color: #A00000 } /* Generic.Deleted */
14+
pre.pygments .tok-ge { font-style: italic } /* Generic.Emph */
15+
pre.pygments .tok-gr { color: #E40000 } /* Generic.Error */
16+
pre.pygments .tok-gh { color: #000080; font-weight: bold } /* Generic.Heading */
17+
pre.pygments .tok-gi { color: #008400 } /* Generic.Inserted */
18+
pre.pygments .tok-go { color: #717171 } /* Generic.Output */
19+
pre.pygments .tok-gp { color: #000080; font-weight: bold } /* Generic.Prompt */
20+
pre.pygments .tok-gs { font-weight: bold } /* Generic.Strong */
21+
pre.pygments .tok-gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22+
pre.pygments .tok-gt { color: #0044DD } /* Generic.Traceback */
23+
pre.pygments .tok-kc { color: #008000; font-weight: bold } /* Keyword.Constant */
24+
pre.pygments .tok-kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
25+
pre.pygments .tok-kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
26+
pre.pygments .tok-kp { color: #008000 } /* Keyword.Pseudo */
27+
pre.pygments .tok-kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
28+
pre.pygments .tok-kt { color: #B00040 } /* Keyword.Type */
29+
pre.pygments .tok-m { color: #666666 } /* Literal.Number */
30+
pre.pygments .tok-s { color: #BA2121 } /* Literal.String */
31+
pre.pygments .tok-na { color: #687822 } /* Name.Attribute */
32+
pre.pygments .tok-nb { color: #008000 } /* Name.Builtin */
33+
pre.pygments .tok-nc { color: #0000FF; font-weight: bold } /* Name.Class */
34+
pre.pygments .tok-no { color: #880000 } /* Name.Constant */
35+
pre.pygments .tok-nd { color: #AA22FF } /* Name.Decorator */
36+
pre.pygments .tok-ni { color: #717171; font-weight: bold } /* Name.Entity */
37+
pre.pygments .tok-ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
38+
pre.pygments .tok-nf { color: #0000FF } /* Name.Function */
39+
pre.pygments .tok-nl { color: #767600 } /* Name.Label */
40+
pre.pygments .tok-nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
41+
pre.pygments .tok-nt { color: #008000; font-weight: bold } /* Name.Tag */
42+
pre.pygments .tok-nv { color: #19177C } /* Name.Variable */
43+
pre.pygments .tok-ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
44+
pre.pygments .tok-w { color: #bbbbbb } /* Text.Whitespace */
45+
pre.pygments .tok-mb { color: #666666 } /* Literal.Number.Bin */
46+
pre.pygments .tok-mf { color: #666666 } /* Literal.Number.Float */
47+
pre.pygments .tok-mh { color: #666666 } /* Literal.Number.Hex */
48+
pre.pygments .tok-mi { color: #666666 } /* Literal.Number.Integer */
49+
pre.pygments .tok-mo { color: #666666 } /* Literal.Number.Oct */
50+
pre.pygments .tok-sa { color: #BA2121 } /* Literal.String.Affix */
51+
pre.pygments .tok-sb { color: #BA2121 } /* Literal.String.Backtick */
52+
pre.pygments .tok-sc { color: #BA2121 } /* Literal.String.Char */
53+
pre.pygments .tok-dl { color: #BA2121 } /* Literal.String.Delimiter */
54+
pre.pygments .tok-sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
55+
pre.pygments .tok-s2 { color: #BA2121 } /* Literal.String.Double */
56+
pre.pygments .tok-se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
57+
pre.pygments .tok-sh { color: #BA2121 } /* Literal.String.Heredoc */
58+
pre.pygments .tok-si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
59+
pre.pygments .tok-sx { color: #008000 } /* Literal.String.Other */
60+
pre.pygments .tok-sr { color: #A45A77 } /* Literal.String.Regex */
61+
pre.pygments .tok-s1 { color: #BA2121 } /* Literal.String.Single */
62+
pre.pygments .tok-ss { color: #19177C } /* Literal.String.Symbol */
63+
pre.pygments .tok-bp { color: #008000 } /* Name.Builtin.Pseudo */
64+
pre.pygments .tok-fm { color: #0000FF } /* Name.Function.Magic */
65+
pre.pygments .tok-vc { color: #19177C } /* Name.Variable.Class */
66+
pre.pygments .tok-vg { color: #19177C } /* Name.Variable.Global */
67+
pre.pygments .tok-vi { color: #19177C } /* Name.Variable.Instance */
68+
pre.pygments .tok-vm { color: #19177C } /* Name.Variable.Magic */
69+
pre.pygments .tok-il { color: #666666 } /* Literal.Number.Integer.Long */

0 commit comments

Comments
 (0)