跳转到主要内容

django CMS的样式插件

项目描述

Aldryn Style提供了一个插件,该插件通过在包含元素上放置类名来包装其他插件CSS样式。

安装

此插件需要正确安装django CMS 2.4或更高版本。

  • 在您的虚拟环境内运行 pip install aldryn-style

  • 'aldryn_style' 添加到您的 INSTALLED_APPS 设置中。

  • 运行 manage.py migrate aldryn_style

使用方法

您可以在settings.py中定义样式和标签类型

# define this lambda if it isn't already defined in your settings...
_ = lambda s: s

ALDRYN_STYLE_CLASS_NAMES = (
    ('info', _('info')),
    ('new', _('new')),
    ('hint', _('hint')),
)

ALDRYN_STYLE_ALLOWED_TAGS = [
    'div', 'p', 'span', 'article', 'section', 'header', 'footer',
]

默认情况下,如果未提供 ALDRYN_STYLE_ALLOWED_TAGS 或包含空列表,则将默认为以下列表,以与旧版本保持向后兼容

ALDRYN_STYLE_ALLOWED_TAGS = [
    'div', 'article', 'section', 'p', 'span',
    'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
    'header', 'footer',
]

注意

All tags included in this list should be "paired tags" that require a
closing tag. It does not make sense to attempt to use 'button', 'input',
'img', or other self-closing tag in this setting.

Also, the developer is advised to choose the tag-types wisely to avoid HTML
validation issues and/or unintentional security vulnerabilities. For
example, the 'script' tag should never be allowed in
``ALDRYN_STYLE_ALLOWED_TAGS`` (though, we do not prevent this). If you have
an application where you find yourself wishing to do this, please see
djangocms-snippet or aldryn-snippet as an alternative, but note these
projects also come with appropriate security warnings.

之后,您可以在该样式插件内部放置任意数量的其他插件。它将为包含的插件创建一个带有先前选择的类的div(或其他标签类型)。

翻译

如果您想帮助翻译该插件,请到Transifex上操作

https://www.transifex.com/projects/p/django-cms/resource/aldryn-style/

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

aldryn-style-1.1.4.tar.gz (19.9 kB 查看哈希值)

上传时间

支持者