mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-29 12:23:42 +03:00
22 lines
530 B
Python
22 lines
530 B
Python
# -*- 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)
|
|
|