Skip to content

Commit

Permalink
Merge pull request #3719 from masatake/docs--sphinx-minor-fixes
Browse files Browse the repository at this point in the history
docs(web): sphinx minor fixes
  • Loading branch information
masatake committed May 12, 2023
2 parents 882b6c7 + c734f17 commit af080b4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
17 changes: 12 additions & 5 deletions docs/_ext/lexers.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
from ctags_optlib_highlighter import CtagsOptlibLexer
from pygments.lexers.special import TextLexer
import sphinx

def setup(app):
def install(app, h, name):
v = sphinx.__version__.split('.')
if int(v[0]) > 3:
c = CtagsOptlibLexer
c = h
elif (int(v[0]) == 3) and (int(v[1]) > 3):
c = CtagsOptlibLexer
c = h
else:
c = CtagsOptlibLexer()
app.add_lexer('ctags', c)
c = h()
app.add_lexer(name, c)

def setup(app):
install(app, CtagsOptlibLexer, 'ctags')
# Setup stubs
for h in ['git', 'yacc', 'EmacsLisp', 'tags', 'Autoconf', 'SystemTap', 'RMarkdown']:
install(app, TextLexer, h)
8 changes: 4 additions & 4 deletions docs/man/ctags-lang-sql.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ is enabled.
The SQL parser looks for a token coming after ``LANGUAGE`` keyword in
the source code to choose a proper guest parser.

.. code-block:: SQL
.. code-block:: psql
... LANGUAGE plpythonu AS '... user-defined function ' ...
... AS $$ user-defined function $$ LANGUAGE plv8 ...
Expand All @@ -51,7 +51,7 @@ tagging code including a user-defined function in a string literal [GH3006]_:

"input.sql"

.. code-block:: SQL
.. code-block:: psql
CREATE OR REPLACE FUNCTION fun1() RETURNS VARCHAR AS '
DECLARE
Expand All @@ -77,7 +77,7 @@ tagging code including a user-defined function in a dollar quote [GH3006]_:

"input.sql"

.. code-block:: SQL
.. code-block:: psql
CREATE OR REPLACE FUNCTION fun2() RETURNS VARCHAR LANGUAGE plpgsql AS $$
DECLARE
Expand All @@ -101,7 +101,7 @@ with "--options=NONE -o - --sort=no --extras=+{guest} input.sql"
tagging code including a user-defined written in JavaScript:

.. code-block:: SQL
.. code-block:: psql
-- Derived from https://github.com/plv8/plv8/blob/r3.0alpha/sql/plv8.sql
CREATE FUNCTION test(keys text[], vals text[]) RETURNS text AS
Expand Down
8 changes: 4 additions & 4 deletions man/ctags-lang-sql.7.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ is enabled.
The SQL parser looks for a token coming after ``LANGUAGE`` keyword in
the source code to choose a proper guest parser.

.. code-block:: SQL
.. code-block:: psql

... LANGUAGE plpythonu AS '... user-defined function ' ...
... AS $$ user-defined function $$ LANGUAGE plv8 ...
Expand All @@ -51,7 +51,7 @@ tagging code including a user-defined function in a string literal [GH3006]_:

"input.sql"

.. code-block:: SQL
.. code-block:: psql

CREATE OR REPLACE FUNCTION fun1() RETURNS VARCHAR AS '
DECLARE
Expand All @@ -77,7 +77,7 @@ tagging code including a user-defined function in a dollar quote [GH3006]_:

"input.sql"

.. code-block:: SQL
.. code-block:: psql

CREATE OR REPLACE FUNCTION fun2() RETURNS VARCHAR LANGUAGE plpgsql AS $$
DECLARE
Expand All @@ -101,7 +101,7 @@ with "--options=NONE -o - --sort=no --extras=+{guest} input.sql"

tagging code including a user-defined written in JavaScript:

.. code-block:: SQL
.. code-block:: psql

-- Derived from https://github.com/plv8/plv8/blob/r3.0alpha/sql/plv8.sql
CREATE FUNCTION test(keys text[], vals text[]) RETURNS text AS
Expand Down

0 comments on commit af080b4

Please sign in to comment.