GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
LaTeX
Browse code
Merge branch 'master' of https://github.com/Otago-InfoSci-Database/LaTeX
master
commit
3ea5fcc9cca5bfbbf79a3130e027ecff2d01d9a9
2 parents
386d801
+
0b06eaf
Nigel Stanger
authored
on 27 Oct 2022
Patch
Showing
1 changed file
minted/postgresql.py
Ignore Space
Show notes
View
minted/postgresql.py
0 → 100644
# -*- coding: utf-8 -*- """ PostgreSQL SQL lexer """ from pygments.lexers.sql import SqlLexer from pygments.token import Name, Keyword __all__ = ['PostgreSQLLexer'] class PostgreSQLLexer(SqlLexer): name = 'PostgreSQL' aliases = ['postgresql', 'postgres'] filenames = ['*.sql'] # just to have one if you want to use EXTRA_KEYWORDS = ['partition', 'over', 'rank', 'ntile', 'first_value', 'last_value', 'row_number', 'nulls', 'range', 'unbounded', 'preceding', 'following', 'trunc', 'nth_value', 'dense_rank', 'lag', 'lead', 'round', 'make_interval', 'date_trunc'] def get_tokens_unprocessed(self, text): for index, token, value in SqlLexer.get_tokens_unprocessed(self, text): if token is Name and value in self.EXTRA_KEYWORDS: yield index, Keyword, value else: yield index, token, value
Show line notes below