我有一个包含我的项目的工作目录,它位于版本控制系统中.我想doc在我的项目中创建一个只包含重组文本文件的目录sphinx.
也就是说,我不想sphinx在我的项目中构建html文件,而是将它们放在外面,这样它们就不会被置于版本控制之下.
我有一个带有chapters嵌套的XML文档sections.我试图找到第一个二级部分祖先的任何部分.这是ancestor-or-self轴中倒数第二个部分.伪代码:
<chapter><title>mychapter</title>
<section><title>first</title>
<section><title>second</title>
<more/><stuff/>
</section>
</section>
</chapter>
Run Code Online (Sandbox Code Playgroud)
我的选择器:
<xsl:apply-templates
select="ancestor-or-self::section[last()-1]" mode="title.markup" />
Run Code Online (Sandbox Code Playgroud)
当然直到last() - 1没有定义(当前节点是first节).
如果当前节点低于该second部分,我想要标题second.否则我想要标题first.
使用以下代码,我Cannot connect to host ...:443 ssl:True在使用异步时获得aiohttp.当我使用同步时requests,它会成功.
该whitehouse.gov链接失败,但google.com成功的两个异步和同步情况.
出了什么问题?这是在FreeBSD8上的python 3.4.2,aiohttp 0.14.4,请求2.5.3
import asyncio
import aiohttp
import requests
urls = [
'http://www.whitehouse.gov/cea/',
'http://www.whitehouse.gov/omb',
'http://www.google.com']
def test_sync():
for url in urls:
r = requests.get(url)
print(r.status_code)
def test_async():
for url in urls:
try:
r = yield from aiohttp.request('get', url)
except aiohttp.errors.ClientOSError as e:
print('bad eternal link %s: %s' % (url, e))
else:
print(r.status)
if __name__ == '__main__':
print('async')
asyncio.get_event_loop().run_until_complete(test_async())
print('sync')
test_sync()
Run Code Online (Sandbox Code Playgroud)
这个输出是:
async
bad …Run Code Online (Sandbox Code Playgroud) 我遇到了麻烦pexpect。我试图tralics从中读取乳胶方程的输出并发出 MathML 表示,如下所示:
1 ~/ % tralics --interactivemath
This is tralics 2.14.5, a LaTeX to XML translator, running on tlocal
Copyright INRIA/MIAOU/APICS/MARELLE 2002-2012, Jos\'e Grimm
Licensed under the CeCILL Free Software Licensing Agreement
Starting translation of file texput.tex.
No configuration file.
> $x+y=z$
<formula type='inline'><math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi> <mo>+</mo><mi>y</mi><mo>=</mo><mi>z</mi></mrow></math></formula>
>
Run Code Online (Sandbox Code Playgroud)
所以我尝试使用 pexpect 得到公式:
import pexpect
c = pexpect.spawn('tralics --interactivemath')
c.expect('>')
c.sendline('$x+y=z$')
s = c.read_nonblocking(size=2000)
print s
Run Code Online (Sandbox Code Playgroud)
输出具有公式,但开头是原始输入,结尾是一些控制字符:
"x+y=z$\r\n<formula type='inline'><math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>x</mi><mo>+</mo><mi>y</mi><mo>=</mo><mi>z</mi></mrow></math></formula>\r\n\r> \x1b[K"
Run Code Online (Sandbox Code Playgroud)
我可以清理输出字符串,但我必须缺少一些基本的东西。有没有更干净的方法来获得 MathML?
我对Sphinx很新,在服务器上记录我的项目.现在,一位同事看到了我一直在做的事情,她想做同样的事情 - 在同一台服务器上记录她的项目.
项目没有关系(他们不属于一个TOCtree),我不知道如何帮助她.我可以配置sphinx来构建单独的文档树吗?是否像制作Makefile的两个副本一样简单并让它设置不同的源/构建目录?
谢谢, - 蒂姆
我正在编写一个样式表以与“编译的帮助”文件一起使用。看起来CSS2通常可以使用,但是我不确定CSS选择器(例如>和)+。
CHM格式是否等同于IE 7?首先,我正在Windows 7上创作,并且已安装IE9。
我想使用嵌套子网格的jqgrid.但是,我发现的唯一示例是在主网格中填充一个url load-data调用和单独的调用来填充subgrids.
我的子网格数据作为嵌套文档存在于一个JSON结构中,如下面的代码段所示(我希望章节显示为书的子网格,文件是章节中的子网格).
我可以使用jqgrid从嵌套的JSON文档创建子网格吗?
{
_id: {"509403957ae7d3929edcb812"},
name: {"MYBOOK"},
layout: {
chapters [
{
name: "myfirstchapter",
sequence: 1,
title: "My First Chapter",
files: [
{
filetype: "tex",
name: "myfirstfile"
},
{
filetype: "tmpl",
name: "myfileb",
}
],
},
{
name: "mysecondchapter",
sequence: 2,
title: "My Second Chapter",
files: [
{
filetype: "tex",
name: "myintro"
},
{
filetype: "tex",
name: "myfilec",
}
],
],
}
}
Run Code Online (Sandbox Code Playgroud) 我正在学习jqGrid,希望最终将它连接到Redis数据库.作为第一步,我正在使用本地数据.这是我必须使用可排序的行(在网格中拖放行).网格显示并且看起来很好,列甚至可以排序,但我不能选择一行并移动它 - 我错过了什么?是因为数据是本地的吗?
加载css和js文件没有问题.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My First Grid</title>
<link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.23.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<script src="js/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
jQuery("#mytable").jqGrid({
datatype:"clientSide",
data:[ {"number": 1, "segment":"frontmatter", "name": "chap0"},
{"number": 2, "segment":"mainmatter", "name": "chap1"},
{"number": 3, "segment":"backmatter", "name": "chap2"},
],
colNames:['Chapter Name', 'Chapter Number', 'Document Segment'],
colModel:[
{name:'name'},
{name:'number', …Run Code Online (Sandbox Code Playgroud) 我有一个可重用的模态组件,与其他几个组件一起使用。
我使用的模态框架来自ng-bootstrap(NgbActiveModal)。
该模式仅列出一组来自调用它的父组件的字符串。
但是,我希望模式根据父组件的不同显示不同。例如,我可能需要它来显示表格而不是列表。我是这样拼凑的:
<div class="modal-body">
<div *ngIf="data.encoding !== undefined">
<p>Hello {{data.name}}. These are your badly encoded words:</p>
<ul><li *ngFor="let item of data.words">{{item}}</li></ul>
</div>
<div *ngIf="data.urls !== undefined">
<p>Hello {{data.name}}. These are your broken urls:</p>
<ul><li *ngFor="let item of data.urls">{{item}}</li></ul>
</div>
Run Code Online (Sandbox Code Playgroud)
这是可行的,但它确实很丑陋,并且完全依赖于来自父级的数据项。正确执行此操作的角度方法是什么?