|
1 # -*- coding: utf-8 -*- |
|
2 """ |
|
3 pygments.styles.algol |
|
4 ~~~~~~~~~~~~~~~~~~~~~ |
|
5 |
|
6 Algol publication style. |
|
7 |
|
8 This style renders source code for publication of algorithms in |
|
9 scientific papers and academic texts, where its format is frequently used. |
|
10 |
|
11 It is based on the style of the revised Algol-60 language report[1]. |
|
12 |
|
13 o No colours, only black, white and shades of grey are used. |
|
14 o Keywords are rendered in lowercase underline boldface. |
|
15 o Builtins are rendered in lowercase boldface italic. |
|
16 o Docstrings and pragmas are rendered in dark grey boldface. |
|
17 o Library identifiers are rendered in dark grey boldface italic. |
|
18 o Comments are rendered in grey italic. |
|
19 |
|
20 To render keywords without underlining, refer to the `Algol_Nu` style. |
|
21 |
|
22 For lowercase conversion of keywords and builtins in languages where |
|
23 these are not or might not be lowercase, a supporting lexer is required. |
|
24 The Algol and Modula-2 lexers automatically convert to lowercase whenever |
|
25 this style is selected. |
|
26 |
|
27 [1] `Revised Report on the Algorithmic Language Algol-60 <http://www.masswerk.at/algol60/report.htm>` |
|
28 |
|
29 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. |
|
30 :license: BSD, see LICENSE for details. |
|
31 """ |
|
32 |
|
33 from pygments.style import Style |
|
34 from pygments.token import Keyword, Name, Comment, String, Error, Operator |
|
35 |
|
36 |
|
37 class AlgolStyle(Style): |
|
38 |
|
39 background_color = "#ffffff" |
|
40 default_style = "" |
|
41 |
|
42 styles = { |
|
43 Comment: "italic #888", |
|
44 Comment.Preproc: "bold noitalic #888", |
|
45 Comment.Special: "bold noitalic #888", |
|
46 |
|
47 Keyword: "underline bold", |
|
48 Keyword.Declaration: "italic", |
|
49 |
|
50 Name.Builtin: "bold italic", |
|
51 Name.Builtin.Pseudo: "bold italic", |
|
52 Name.Namespace: "bold italic #666", |
|
53 Name.Class: "bold italic #666", |
|
54 Name.Function: "bold italic #666", |
|
55 Name.Variable: "bold italic #666", |
|
56 Name.Constant: "bold italic #666", |
|
57 |
|
58 Operator.Word: "bold", |
|
59 |
|
60 String: "italic #666", |
|
61 |
|
62 Error: "border:#FF0000" |
|
63 } |