狮身人面像“嵌入”延伸
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()
嵌入式超时
还有一个可选的配置变量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)
句柄嵌入“rich”类型,如slideshare。多亏了道格·赫尔曼。
从Bitbucket Repo移植到GitHub:
v0.1(2013-12-30)
- 初次发布。