Docs: css tweaks

* Add vertical space between items in "open" lists
  (rtfd/sphinx_rtd_theme#590)
* Distinguish shell prompts in console examples,
  and omit them if the code is copied
* Add css and js extras directly from Sphinx conf.py
  (no need to override template)
This commit is contained in:
medmunds
2018-03-16 12:16:57 -07:00
parent b06d684dd5
commit 0c3e3e9bad
4 changed files with 37 additions and 13 deletions

21
docs/_static/anymail-theme.css vendored Normal file
View File

@@ -0,0 +1,21 @@
/* Anymail modifications to sphinx-rtd-theme styles */
/* List item spacing: https://github.com/rtfd/sphinx_rtd_theme/issues/590 */
.rst-content .section ol li p:last-child,
.rst-content .section ul li p:last-child {
margin-bottom: 24px;
}
/* Pygments shell/console prompt: */
.highlight .gp {
/* The RTD theme shows prompts the same color as other code.
We want to distinguish them (like most Pygments themes do). */
color: #d14;
/* Exclude prompt characters when copying from highlighted code. */
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}

View File

@@ -1,3 +0,0 @@
{% extends "!layout.html" %}
{% set script_files = script_files + ["_static/version-alert.js"] %}

View File

@@ -145,6 +145,11 @@ html_static_path = ['_static']
# typographically correct entities. # typographically correct entities.
# html_use_smartypants = True # html_use_smartypants = True
# If true, a list all whose items consist of a single paragraph and/or a
# sub-list all whose items etc… (recursive definition) will not use the <p>
# element for any of its items. This is standard docutils behavior.
# html_compact_lists = True
# Custom sidebar templates, maps document names to template names. # Custom sidebar templates, maps document names to template names.
# html_sidebars = {} # html_sidebars = {}
@@ -272,6 +277,9 @@ intersphinx_mapping = {
def setup(app): def setup(app):
app.add_stylesheet("anymail-theme.css")
app.add_javascript("version-alert.js")
# Django-specific roles, from https://github.com/django/django/blob/master/docs/_ext/djangodocs.py: # Django-specific roles, from https://github.com/django/django/blob/master/docs/_ext/djangodocs.py:
app.add_crossref_type( app.add_crossref_type(
directivename="setting", directivename="setting",

View File

@@ -118,23 +118,21 @@ To use batch sending with Anymail (for ESPs that support it):
or with some ESPs you can use merge fields directly in your or with some ESPs you can use merge fields directly in your
:class:`~django.core.mail.EmailMessage` (meaning the message itself :class:`~django.core.mail.EmailMessage` (meaning the message itself
is treated as an on-the-fly template). is treated as an on-the-fly template).
* Set the message's :attr:`~AnymailMessage.merge_data` attribute to define merge field * Set the message's :attr:`~AnymailMessage.merge_data` attribute to define merge field
substitutions for each recipient, and optionally set :attr:`~AnymailMessage.merge_global_data` substitutions for each recipient, and optionally set :attr:`~AnymailMessage.merge_global_data`
to defaults or values to use for all recipients. to defaults or values to use for all recipients.
* Specify all of the recipients for the batch in the message's `to` list. * Specify all of the recipients for the batch in the message's `to` list.
.. caution:: .. caution::
It's critical to set the :attr:`~AnymailMessage.merge_data` attribute: It's critical to set the :attr:`~AnymailMessage.merge_data` attribute:
this is how Anymail recognizes the message as a batch send. this is how Anymail recognizes the message as a batch send.
When you provide merge_data, Anymail will tell the ESP to send an individual customized When you provide merge_data, Anymail will tell the ESP to send an individual customized
message to each "to" address. Without it, you may get a single message to everyone, message to each "to" address. Without it, you may get a single message to everyone,
exposing all of the email addresses to all recipients. exposing all of the email addresses to all recipients.
(If you don't have any per-recipient customizations, but still want individual messages, (If you don't have any per-recipient customizations, but still want individual messages,
just set merge_data to an empty dict.) just set merge_data to an empty dict.)
The exact syntax for merge fields varies by ESP. It might be something like The exact syntax for merge fields varies by ESP. It might be something like
`*|NAME|*` or `-name-` or `<%name%>`. (Check the notes for `*|NAME|*` or `-name-` or `<%name%>`. (Check the notes for