狮身人面像“嵌入”延伸

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集合属性值   java字符串==运算符是否比较引用?   java是否存在过太多的ListView或适配器?   json获取java中类路径中下载的文件   我可以用java代码解决数据库并发问题吗?   在多个线程中使用forEach()或使用forEach()和lambdas进行java集合迭代   java输出JFrame中的整个循环   java禁用高度详细的日志记录   java在没有特定属性的对象中访问模型的值   java Smack xmpp建立连接   处理过时域对象引起的并发问题的java策略(Grails/GORM/Hibernate)   java从ObservableList中提取元素   使用图像进行java相似图像搜索   java ListView和图像:我快疯了   在Java中,如何从毫秒时间戳中提取一天的周期?   java我需要这样的设计,但我面临两个问题   java如何获取JGoodies FormLayout中的单元格大小   Spring引导生成的java War文件未部署到Weblogic 12c