diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:33:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:33:32 +0000 |
commit | 1f403ad2197fc7442409f434ee574f3e6b46fb73 (patch) | |
tree | 0299c6dd11d5edfa918a29b6456bc1875f1d288c /doc/_templates | |
parent | Initial commit. (diff) | |
download | pygments-upstream.tar.xz pygments-upstream.zip |
Adding upstream version 2.14.0+dfsg.upstream/2.14.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | doc/_templates/demo.html | 97 | ||||
-rw-r--r-- | doc/_templates/demo_sidebar.html | 1 | ||||
-rw-r--r-- | doc/_templates/docssidebar.html | 3 | ||||
-rw-r--r-- | doc/_templates/index_with_try.html | 0 | ||||
-rw-r--r-- | doc/_templates/indexsidebar.html | 18 | ||||
-rw-r--r-- | doc/_templates/styles.html | 55 |
6 files changed, 174 insertions, 0 deletions
diff --git a/doc/_templates/demo.html b/doc/_templates/demo.html new file mode 100644 index 0000000..8e2a7c6 --- /dev/null +++ b/doc/_templates/demo.html @@ -0,0 +1,97 @@ +{% extends "layout.html" %} +{% set sidebars = sidebars + ["demo_sidebar.html"] %} + +{% block extrahead %} +{{ super() }} +<link rel="stylesheet" type="text/css" href="{{ pathto("_static/demo.css", 1) }}"> +{% endblock %} + +{% block htmltitle %}<title>Demo{{ titlesuffix }}</title>{% endblock %} + +{% block body %} +{{ body }} + +<h1>Try out Pygments!</h1> + +<noscript> + <h2>This website requires JavaScript (and WebAssembly)</h2> + + You can also try out pygments locally by running <code>pip install pygments</code>. + Then you can use <a href="{{pathto('docs/cmdline')}}">the command-line interface</a>. +</noscript> + +<div id="try"> + <p> + <label>Language + <select id="lang" autofocus> + <option value="">guess the language</option> + {% for name, info, _, _ in lexers %} + <option value="{{info.0}}">{{name}}</option> + {% endfor %} + </select> + </label> + <span id=guessed-lexer></span> + </p> + <p> + <label> + Enter some code: + <textarea id="code" rows="1" cols="60" spellcheck="false"></textarea> + </label> + </p> + <p> + <label> + Alternatively you can upload a file: + <input type="file" id="file"> + </label> + <button id="reset-file">Reset</button> + </p> + <div id="format-settings"> + <label> + Formatter + <select id=formatter> + <option value=html>HTML</option> + <option value=tokens>tokens</option> + </select> + </label> + <label>Style + <select id="style"> + <optgroup label="Good contrast"> + {% for style in styles_aa %} + <option data-wcag=aa>{{style.name}}</option> + {% endfor %} + </optgroup> + <optgroup label="Suboptimal contrast"> + {% for style in styles_sub_aa %} + <option>{{style.name}}</option> + {% endfor %} + </optgroup> + </select> + </label> + <span id=contrast-warning hidden>style may have poor contrast</span> + </div> + </form> +</div> + +<div id="loading" hidden> + <img src="{{ pathto("_static/spinner.gif", 1) }}" width="20"> + <span id="loading-text">loading Python...</span> +</div> + +<style id=css-style></style> + +<div id="hlcode"></div> + +<div id="code-header" hidden> + <div class=flex-grow-1></div> + <button onclick="download_code()">Download</button> + <a id="copylink" role="button">Copy link</a> + <span hidden id="uri-too-long">(Copy link unavailable because code too long)</span> +</div> + +<p>The highlighting here is performed in-browser using + a WebAssembly translation of the latest Pygments master branch, courtesy of + <a href="https://github.com/iodide-project/pyodide">Pyodide</a>.</p> +<p>Your content is neither sent over the web nor stored anywhere.</p> + +<script type="text/javascript" src="{{ pathto("_static/demo.js", 1) }}"></script> +{% endblock %} diff --git a/doc/_templates/demo_sidebar.html b/doc/_templates/demo_sidebar.html new file mode 100644 index 0000000..3f2a86c --- /dev/null +++ b/doc/_templates/demo_sidebar.html @@ -0,0 +1 @@ +<p><a href="#try">Back to top</a></p> diff --git a/doc/_templates/docssidebar.html b/doc/_templates/docssidebar.html new file mode 100644 index 0000000..913acaa --- /dev/null +++ b/doc/_templates/docssidebar.html @@ -0,0 +1,3 @@ +{% if pagename != 'docs/index' %} +<strong>« <a href="{{ pathto('docs/index') }}">Back to docs index</a></strong> +{% endif %} diff --git a/doc/_templates/index_with_try.html b/doc/_templates/index_with_try.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/_templates/index_with_try.html diff --git a/doc/_templates/indexsidebar.html b/doc/_templates/indexsidebar.html new file mode 100644 index 0000000..5aa5019 --- /dev/null +++ b/doc/_templates/indexsidebar.html @@ -0,0 +1,18 @@ +<section> +<h3>Download</h3> +<p>Current version: <b>{{ version }}</b><br><a href="{{ pathto('docs/changelog') }}">Changelog</a></p> +<p>Get Pygments from the <a href="https://pypi.python.org/pypi/Pygments">Python Package + Index</a>, or install it with:</p> +<pre>pip install Pygments</pre> +</section> +<section> +<h3>Questions? Suggestions?</h3> + +<p><img src="{{ pathto("_static/github.png", 1) }}" width="24" /> + Clone at <a href="https://github.com/pygments/pygments">GitHub</a>.</p> +<p>You can also open an issue at the + <a href="https://github.com/pygments/pygments/issues">tracker</a>.</p> +</section> + +<p class="logo">A <a href="https://www.pocoo.org/"> + <img src="{{ pathto("_static/pocoo.png", 1) }}" /></a> project</a></p> diff --git a/doc/_templates/styles.html b/doc/_templates/styles.html new file mode 100644 index 0000000..137fa24 --- /dev/null +++ b/doc/_templates/styles.html @@ -0,0 +1,55 @@ +{% extends "layout.html" %} + +{% block htmltitle %}<title>Styles{{ titlesuffix }}</title>{% endblock %} + +{% block body %} +<style> +.style-gallery { + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +h2 { + margin-top: 2em; +} +.style-gallery h3 { + margin-bottom: 0.1em; +} +.style-gallery pre { + background-color: inherit; +} +</style> +{{ body }} + +<h1>Styles</h1> + +<p>Pygments comes with the following builtin styles. +For more information about styles refer to <a href="{{ pathto('docs/styles') }}">the documentation</a>. +</p> + +<div class=style-gallery> +{% for style in styles_aa %} + <div> + <h3 id="{{style.name}}">{{style.name}}</h3> + {{style.html|safe}} + </div> +{% endfor %} +</div> + +<h2>Styles with a lower contrast</h2> +<p> +The following styles do not meet the <a href="https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html">WCAG 2.1 AA contrast minimum</a>, +so they might be difficult to read for people with suboptimal vision. +If you want your highlighted code to be well readable for other people, you +should use one of the earlier styles instead. +</p> +<div class=style-gallery> + {% for style in styles_sub_aa %} + <div> + <h3 id="{{style.name}}">{{style.name}}</h3> + {{style.html|safe}} + </div> + {% endfor %} +</div> + +{% endblock %} |