summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2015-03-08 07:32:43 +0100
committerGeorg Brandl <georg@python.org>2015-03-08 07:32:43 +0100
commit0ed4dae05a85dd67e6190cc7027a830e89e7465d (patch)
treeb490b8bdcde5b3d30000fe93a306d79c165e5e58
parent48eb4ba2f472b5d3edaf8446f7bc127a5272c46f (diff)
downloadpygments-0ed4dae05a85dd67e6190cc7027a830e89e7465d.tar.gz
Added Algol and Algol_nu style (#1090).
-rw-r--r--CHANGES2
-rw-r--r--pygments/lexers/modula2.py2
-rw-r--r--pygments/styles/__init__.py2
-rw-r--r--pygments/styles/algol.py63
-rw-r--r--pygments/styles/algol_nu.py63
5 files changed, 130 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 6a8aceba..5c96ba6f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,10 +15,12 @@ Version 2.1
* Emacs Lisp (PR#431)
* Arduino (PR#442)
+ * Modula-2 with multi-dialect support (#1090)
- Added styles:
* Lovelace (PR#456)
+ * Algol and Algol-nu (#1090)
Version 2.0.3
diff --git a/pygments/lexers/modula2.py b/pygments/lexers/modula2.py
index eec913b6..d32bb5bb 100644
--- a/pygments/lexers/modula2.py
+++ b/pygments/lexers/modula2.py
@@ -1564,5 +1564,3 @@ class Modula2Lexer(RegexLexer):
# return result
yield index, token, value
-
-# end of modula2.py
diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py
index 2c69714f..d7a0564a 100644
--- a/pygments/styles/__init__.py
+++ b/pygments/styles/__init__.py
@@ -39,6 +39,8 @@ STYLE_MAP = {
'paraiso-light': 'paraiso_light::ParaisoLightStyle',
'paraiso-dark': 'paraiso_dark::ParaisoDarkStyle',
'lovelace': 'lovelace::LovelaceStyle',
+ 'algol': 'algol::AlgolStyle',
+ 'algol_nu': 'algol_nu::Algol_NuStyle',
}
diff --git a/pygments/styles/algol.py b/pygments/styles/algol.py
new file mode 100644
index 00000000..a8726009
--- /dev/null
+++ b/pygments/styles/algol.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.styles.algol
+ ~~~~~~~~~~~~~~~~~~~~~
+
+ Algol publication style.
+
+ This style renders source code for publication of algorithms in
+ scientific papers and academic texts, where its format is frequently used.
+
+ It is based on the style of the revised Algol-60 language report[1].
+
+ o No colours, only black, white and shades of grey are used.
+ o Keywords are rendered in lowercase underline boldface.
+ o Builtins are rendered in lowercase boldface italic.
+ o Docstrings and pragmas are rendered in dark grey boldface.
+ o Library identifiers are rendered in dark grey boldface italic.
+ o Comments are rendered in grey italic.
+
+ To render keywords without underlining, refer to the `Algol_Nu` style.
+
+ For lowercase conversion of keywords and builtins in languages where
+ these are not or might not be lowercase, a supporting lexer is required.
+ The Algol and Modula-2 lexers automatically convert to lowercase whenever
+ this style is selected.
+
+ [1] `Revised Report on the Algorithmic Language Algol-60 <http://www.masswerk.at/algol60/report.htm>`
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.style import Style
+from pygments.token import Keyword, Name, Comment, String, Error, Operator
+
+
+class AlgolStyle(Style):
+
+ background_color = "#ffffff"
+ default_style = ""
+
+ styles = {
+ Comment: "italic #888",
+ Comment.Preproc: "bold noitalic #888",
+ Comment.Special: "bold noitalic #888",
+
+ Keyword: "underline bold",
+ Keyword.Declaration: "italic",
+
+ Name.Builtin: "bold italic",
+ Name.Builtin.Pseudo: "bold italic",
+ Name.Namespace: "bold italic #666",
+ Name.Class: "bold italic #666",
+ Name.Function: "bold italic #666",
+ Name.Variable: "bold italic #666",
+ Name.Constant: "bold italic #666",
+
+ Operator.Word: "bold",
+
+ String: "italic #666",
+
+ Error: "border:#FF0000"
+ }
diff --git a/pygments/styles/algol_nu.py b/pygments/styles/algol_nu.py
new file mode 100644
index 00000000..392838f2
--- /dev/null
+++ b/pygments/styles/algol_nu.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+"""
+ pygments.styles.algol_nu
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Algol publication style without underlining of keywords.
+
+ This style renders source code for publication of algorithms in
+ scientific papers and academic texts, where its format is frequently used.
+
+ It is based on the style of the revised Algol-60 language report[1].
+
+ o No colours, only black, white and shades of grey are used.
+ o Keywords are rendered in lowercase boldface.
+ o Builtins are rendered in lowercase boldface italic.
+ o Docstrings and pragmas are rendered in dark grey boldface.
+ o Library identifiers are rendered in dark grey boldface italic.
+ o Comments are rendered in grey italic.
+
+ To render keywords with underlining, refer to the `Algol` style.
+
+ For lowercase conversion of keywords and builtins in languages where
+ these are not or might not be lowercase, a supporting lexer is required.
+ The Algol and Modula-2 lexers automatically convert to lowercase whenever
+ this style is selected.
+
+ [1] `Revised Report on the Algorithmic Language Algol-60 <http://www.masswerk.at/algol60/report.htm>`
+
+ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+from pygments.style import Style
+from pygments.token import Keyword, Name, Comment, String, Error, Operator
+
+
+class Algol_NuStyle(Style):
+
+ background_color = "#ffffff"
+ default_style = ""
+
+ styles = {
+ Comment: "italic #888",
+ Comment.Preproc: "bold noitalic #888",
+ Comment.Special: "bold noitalic #888",
+
+ Keyword: "bold",
+ Keyword.Declaration: "italic",
+
+ Name.Builtin: "bold italic",
+ Name.Builtin.Pseudo: "bold italic",
+ Name.Namespace: "bold italic #666",
+ Name.Class: "bold italic #666",
+ Name.Function: "bold italic #666",
+ Name.Variable: "bold italic #666",
+ Name.Constant: "bold italic #666",
+
+ Operator.Word: "bold",
+
+ String: "italic #666",
+
+ Error: "border:#FF0000"
+ }