Skip to content

Commit

Permalink
Display SWISH query boxes: copy button + syntax highlight
Browse files Browse the repository at this point in the history
1. Display SWISH query box code syntax highlighting
2. SWISH query box CSS stylesheet correction (_static/lpn.css)
3. Display SWISH query box copy button -- no need to enable the custom class
   by setting the `copybutton_selector` configuration variable to
   `"div.highlight pre, div.extract.swish pre.swish.query"`
   since the code syntax highlighting embeds an extra `div` element
   and the outer element id is no longer overwritten
   (see <executablebooks/sphinx-copybutton#115>)
  • Loading branch information
So-Cool committed Jan 8, 2021
1 parent 2d5d26a commit ac1a9e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions _config.yml
Expand Up @@ -53,14 +53,14 @@ sphinx:
figure: "Figure %s"
numfig_secnum_depth: 2
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
# Allow copy buttons in SWISH query boxes
# Configure Sphinx-copybutton
# <https://sphinx-copybutton.readthedocs.io/en/latest/>
# NOTE: it is disabled for now since it overwrites the code block id
# <https://github.com/executablebooks/sphinx-copybutton/issues/115>
# copybutton_selector: "div.highlight pre, div.extract.swish pre.swish.query"
copybutton_prompt_text: "?-"
copybutton_prompt_text: "\\s*\\?\\s*-\\s*"
copybutton_prompt_is_regexp: true
copybutton_only_copy_prompt_lines: false
copybutton_remove_prompts: true
# copybutton_selector: "div.highlight pre, div.extract.swish pre.swish.query"
# Configure SL-Sphinx <https://github.com/simply-logical/SL-Sphinx>
sl_exercise_directory: /src/ex/
sl_code_directory: /src/code/
sl_swish_url: https://swish.simply-logical.space/
2 changes: 1 addition & 1 deletion _ext
Submodule _ext updated from c8246b to 6a9206
14 changes: 8 additions & 6 deletions _static/lpn.css
Expand Up @@ -34,11 +34,12 @@ pre.query, pre.source, pre.verbatim {
outline: 1px dotted green;
}

div.query {
position: relative;
width: 80%;
display: inline-block;
}
/* div.query {
* position: relative;
* width: 80%;
* display: inline-block;
* }
*/

div.open-prolog {
width: auto;
Expand All @@ -55,7 +56,8 @@ div.open-prolog div.load {
right: -37px;
}

div.source.swish, div.query.swish {
/* div.query.swish, */
div.source.swish {
padding: 8px 8px;
}

Expand Down

0 comments on commit ac1a9e7

Please sign in to comment.