diff options
| author | Matthäus G. Chajdas <dev@anteru.net> | 2022-10-24 21:54:24 +0200 |
|---|---|---|
| committer | Matthäus G. Chajdas <dev@anteru.net> | 2022-10-24 21:54:24 +0200 |
| commit | e2aa606da2341e708b8e091e2c8338a62f9a41bf (patch) | |
| tree | 9ff61f5043d07bdf333a02c49822a85d9dddb154 /doc | |
| parent | 5d521a619880723c8fafb9345a51e10c1d560948 (diff) | |
| download | pygments-git-e2aa606da2341e708b8e091e2c8338a62f9a41bf.tar.gz | |
Improve the languages list.
* Move the generation into sphinext, similar to other overviews we have.
* Generate a table instead of the plain list. This table contains links
to the lexer class now.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/_templates/languages.html | 31 | ||||
| -rw-r--r-- | doc/conf.py | 12 | ||||
| -rw-r--r-- | doc/languages.rst | 19 |
3 files changed, 16 insertions, 46 deletions
diff --git a/doc/_templates/languages.html b/doc/_templates/languages.html deleted file mode 100644 index e046a906..00000000 --- a/doc/_templates/languages.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "layout.html" %} - -{% block htmltitle %}<title>Languages {{ titlesuffix }}</title>{% endblock %} - -{% block body %} - -<h1>Languages</h1> - -<ul> -{% for language in languages %} -<li> - {% if language.url %} - <a href="{{language.url}}">{{language.name}}</a> - {% else %} - {{language.name}} - {% endif %} -</li> -{% endfor %} -</ul> -{{ body }} - -<h1>... that's all?</h1> - -Well, why not write your own? Contributing to Pygments is easy and fun. Take a -look at the <a href="{{ pathto('docs/lexerdevelopment') }}">docs on lexer development</a>. Pull -requests are welcome on <a href="https://github.com/pygments/pygments">GitHub</a>. - -Note: the languages listed here are supported in the development version. The -latest release may lack a few of them. - -{% endblock %} diff --git a/doc/conf.py b/doc/conf.py index 0023585d..f42c3553 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -134,7 +134,6 @@ html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']} # template names. html_additional_pages = { 'styles': 'styles.html', - 'languages': 'languages.html' } if os.environ.get('WEBSITE_BUILD'): @@ -233,17 +232,8 @@ rst_prolog = '.. |language_count| replace:: {}'.format(len(list(pygments.lexers. def pg_context(app, pagename, templatename, ctx, event_arg): ctx['demo_active'] = bool(os.environ.get('WEBSITE_BUILD')) - if pagename in ('demo', 'languages'): - all_lexers = sorted(pygments.lexers.get_all_lexers(plugins=False), key=lambda x: x[0].lower()) if pagename == 'demo': - ctx['lexers'] = all_lexers - - if pagename == 'languages': - lexer_name_url = [] - for entry in all_lexers: - lexer_cls = pygments.lexers.find_lexer_class(entry[0]) - lexer_name_url.append({'name': entry[0], 'url': lexer_cls.url}) - ctx['languages'] = lexer_name_url + ctx['lexers'] = sorted(pygments.lexers.get_all_lexers(plugins=False), key=lambda x: x[0].lower()) if pagename in ('styles', 'demo'): with open('examples/example.py') as f: diff --git a/doc/languages.rst b/doc/languages.rst index a39b94f1..2e9f1ff3 100644 --- a/doc/languages.rst +++ b/doc/languages.rst @@ -1,5 +1,16 @@ -:orphan: +Languages +========= -This file is overridden by _templates/languages.html and just exists to -allow the language list to be reliably linked from the documentation -(since its location varies between `make html` and `make dirhtml`). +.. pygmentsdoc:: lexers_overview + +... that's all? +--------------- + +Well, why not write your own? Contributing to Pygments is easy and fun. Take a +look at the :doc:`docs on lexer development <lexerdevelopment>`. Pull +requests are welcome on <a href="https://github.com/pygments/pygments">GitHub</a>. + +.. note:: + + The languages listed here are supported in the development version. The + latest release may lack a few of them. |
