'Edit on GitLab' on some pages only

28 views
Skip to first unread message

Martin Quinson

unread,
May 23, 2019, 1:41:47 PM5/23/19
to sphinx...@googlegroups.com
Hello,

I'm trying to disable the "Edit on GitLab" button on some specific
pages, because they are generated and don't exist in gitlab. In
particular, I'd do so for the pages generated by javasphinx-apidoc, as
well as search.html and genindex.html.

I was thinking of replacing "display_gitlab": True in my conf.py by a
conditional depending on the file name, but I have absolutely no clue
of how to do so, and I'm not even sure it's feasible, actually.

I tried googling around, but fail to find the right keywords.

Any hint, anyone?

Thanks in advance,
Mt.

--
Simplicity does not precede complexity, but follows it.
-- "Epigrams in Programming", by Alan J. Perlis of Yale University.
signature.asc

Jared Dillard

unread,
May 23, 2019, 2:24:01 PM5/23/19
to sphinx...@googlegroups.com
I use pagename to exclude putting a feedback form on some pages:

{% if pagename != "search" %}
<div class="feedback">
This is a feedback form
</div>
{% endif %}

--
You received this message because you are subscribed to the Google Groups "sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To post to this group, send email to sphinx...@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/20190523173737.GM22901%40nouzonket.
For more options, visit https://groups.google.com/d/optout.

Martin Quinson

unread,
May 24, 2019, 5:18:06 PM5/24/19
to sphinx...@googlegroups.com
Thanks a lot for your hint, it helps.

Is it also possible to exclude using regular expressions? I tried
{% if pagename != "search" and (not re.match(pagename, "java/org/simgrid")) %}

but it fails because the re module was not imported. I tried to import
it from my conf.py, but it's not enough.

Thanks in advance,
Mt.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAHoez_%3Dt2kCFnMF6DBu-EB6Yn3jR9iw-aLvgWjvEPq%3DA9S1SdQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
I have not failed. I've just found 10,000 ways that won't work.
-- Thomas Edison
signature.asc
Reply all
Reply to author
Forward
0 new messages