狮身人面像“嵌入”延伸

sphinxcontrib-embedl的Python项目详细描述


这是使用Embedly的狮身人面像扩展。

此扩展允许您嵌入Embedly支持的任何内容, 例如:

.. embedly:: http://www.youtube.com/watch?v=M_eYSuPKP3Y

安装

pip install sphinxcontrib-embedly

配置

狮身人面像

要在sphinx中启用此扩展,请将sphinxcontrib.embedlymodule添加到 conf.py文件中的extensions选项。

import os, sys

# Path to the folder where sphinxcontrib/embedly.py is
# NOTE: not needed if the package is installed in traditional way
# using setup.py, easy_install or pip
sys.path.append(os.path.abspath('/path/to/sphinxcontrib.embedly'))

# Enabled extensions
extensions = ['sphinxcontrib.embedly']

文件

如果您使用纯docutils项目,如鹈鹕,请随意添加 下面是您的代码:

from sphinxcontrib.embedly import setup_docutils
setup_docutils()

嵌入键

然后在 conf.py注册了 Embed产品。例如:

embedly_key = '<api-key-copied-from-your-account-page>'

嵌入式超时

还有一个可选的配置变量embedly_timeout 指定从中获取嵌入代码时使用的默认超时。 嵌入式(默认为60秒)。例如:

embedly_timeout = 120

用法

此指令获取给定url的嵌入代码并将其添加到 生成的文档。

示例:

.. embedly:: http://www.youtube.com/watch?v=M_eYSuPKP3Y

您可以为嵌入指定各种选项,如上所示。

示例:

.. embedly:: http://www.youtube.com/watch?v=M_eYSuPKP3Y
   :width: 450
   :autoplay:
   :frame:

选项

maxwidth:the maximum width of the embed in pixels (optional)
maxheight:the maximum height of the embed in pixels (optional)
width:the scaled width of rich and video embeds in pixels (optional)
wmode:the “wmode” parameter to flash objects, options are “window”, “opaque” and “transparent” (optional)
nostyle:boolean when given removes inline style elements from certain embeds to be able to style them yourself (optional)
autoplay:boolean when given tells the video and rich embeds to automatically play when the media is loaded (optional)
videosrc:boolean when given uses the ^{tt7}$ meta or Open Graph tag to create a video object to embed (optional, defaults to 50)
words:integer value of words to be returned as the description, as the closest sentence to that word count (optional)
chars:integer value of characters after which the description is blindly truncated and added “…” (optional)
frame:boolean when given will wrap all embeds in iframes to help prevent XSS attacks (optional, available in the paid products)
secure:boolean when given will serve embeds with a SSL connection (optional, available in the paid products)

更改日志

V0.2(2014-02-23)

v0.1(2013-12-30)

  • 初次发布。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
序列化反序列化java。awt。颜色>java。木卫一。InvalidClassException   java禁用多个日期范围jDateChooser   java为什么我的特例apper会被扔进泽西/灰熊?   JavaIntelliJ比较两个覆盖率数据   java什么是servletsdefault。你怎么办?   单击几下libgdx后java按钮没有响应   使用java将字符串转换为JSONArray   文件系统在java中刷新fileSystemViewer   java如何在hibernate中避免脏检查   java奇怪的问题,带有分号和“无法解决…”   java将值从子面板传递到父面板   HTML JTextPane CSS的Java FontSizeAction   java文件代码神秘地变成了一堆(0000)