mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-12 07:10:33 +03:00
Added docutils SQL role.
This commit is contained in:
parent
5491dd8db0
commit
6ea6d48f5d
10
doc/_static/psycopg.css
vendored
10
doc/_static/psycopg.css
vendored
|
@ -9,3 +9,13 @@ div.dbapi-extension {
|
||||||
background-color: #f5ffd4;
|
background-color: #f5ffd4;
|
||||||
border: 1px solid #bda;
|
border: 1px solid #bda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tt.sql {
|
||||||
|
font-size: 1em;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
a > tt.sql:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
21
doc/sql_role.py
Normal file
21
doc/sql_role.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
sql role
|
||||||
|
~~~~~~~~
|
||||||
|
|
||||||
|
An interpreted text role to style SQL syntax in Psycopg documentation.
|
||||||
|
|
||||||
|
:copyright: Copyright 2010 by Daniele Varrazzo.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from docutils import nodes, utils
|
||||||
|
from docutils.parsers.rst import roles
|
||||||
|
|
||||||
|
def sql_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
|
text = utils.unescape(text)
|
||||||
|
options['classes'] = ['sql']
|
||||||
|
return [nodes.literal(rawtext, text, **options)], []
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
roles.register_local_role('sql', sql_role)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user