显示/隐藏sphinx文件中的部分文本(问题/答案) [英] Show/hide part of text (question/answer) in sphinx file

查看:22
本文介绍了显示/隐藏sphinx文件中的部分文本(问题/答案)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以将指令添加到带有隐藏部分的狮身人面像文档中,该部分可以通过单击打开。

基本上可以找到https://realpython.com/pandas-python-explore-dataset/(搜索显示/隐藏):

推荐答案

这里是Mastering Plone Training documentation中的一个工作示例。

这里是source code

..  admonition:: Solution
    :class: toggle
    * Go to the dexterity-controlpanel (http://localhost:8080/Plone/@@dexterity-types)
    * Click on *Page* (http://127.0.0.1:8080/Plone/dexterity-types/Document)
    * Select the tab *Behaviors* (http://127.0.0.1:8080/Plone/dexterity-types/Document/@@behaviors)
    * Check the box next to *Lead Image* and save.

commit history显示已向主题添加了自定义的JavaScript和样式。

_Static/Custom.css

.toggle {
    background: none repeat scroll 0 0 #e7f2fa;
}

.toggle .admonition-title {
    display: block;
    clear: both;
}

.toggle .admonition-title:after {
    content: " ▼";
}

.toggle .admonition-title.open:after {
    content: " ▲";
}

_Templates/Page.html

{% set css_files = css_files + ["_static/custom.css"] %}

{%- block extrahead %}
 <script type="text/javascript">
    $(document).ready(function() {
        //
        //
        $(".toggle > *").hide();
        $(".toggle .admonition-title").show();
        $(".toggle .admonition-title").click(function() {
            $(this).parent().children().not(".admonition-title").toggle(400);
            $(this).parent().children(".admonition-title").toggleClass("open");
        })
    });
</script>
{% endblock %}

这篇关于显示/隐藏sphinx文件中的部分文本(问题/答案)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆