是否有相应的markdown语法:
Take me to <a href="#pookie">pookie</a>
...
<a name="pookie">this is pookie</a>
Run Code Online (Sandbox Code Playgroud) 到目前为止,我只使用了database.yml,每个参数都显式调出,在下面的文件中使用了一些我不理解的字符.每行和符号(&,*,<<)的含义是什么,我如何阅读此文件?
development: &default
adapter: postgresql
database: dev_development
test: &test
<<: *default
database: test_test
cucumber:
<<: *test
production:
<<: *default
database: test_production
Run Code Online (Sandbox Code Playgroud) alias yaml database-connection ruby-on-rails cross-reference
我目前正在写下markdown的文档,我想从我的文本中引用一个图像.
this is my text, I want a reference to my image1 [here]. blablabla

Run Code Online (Sandbox Code Playgroud)
我想做那个参考,因为在将我的降价转换为pdf之后,图像会放在一页或两页之后,文档没有任何意义.
更新:
[image]: image.png "Image Title"
![Alt text][image]
A reference to the [image](#image).
Run Code Online (Sandbox Code Playgroud)
应该产生:
\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{i mage.png}
\caption{Alt text}
\label{image}
\end{figure}
A reference to the image (\autoref{image}).
Run Code Online (Sandbox Code Playgroud)
相反,我获得:
\begin{figure}[htbp]
\centering
\includegraphics{image.png}
\caption{Alt text}
\end{figure}
A reference to the \href{\#image}{image}.
Run Code Online (Sandbox Code Playgroud)
我注意到两个问题:
\label{image} 没有出现:没有创建引用.(\autoref{image})变为\href{\#image}{image}:未检测到交叉引用.然后,当我将其转换为pdf时,它显然没有链接到图像.有一个链接,但它没有链接到任何东西.
任何帮助将非常感激!!
所以,我知道我可以这样做:
sitelist: &sites
- www.foo.com
- www.bar.com
anotherlist: *sites
Run Code Online (Sandbox Code Playgroud)
并拥有sitelist和anotherlist都包含www.foo.com和www.bar.com.不过,我真正想要的是anotherlist对还包含www.baz.com,而无需重复www.foo.com和www.baz.com.
这样做会在YAML解析器中出现语法错误:
sitelist: &sites
- www.foo.com
- www.bar.com
anotherlist: *sites
- www.baz.com
Run Code Online (Sandbox Code Playgroud)
只使用锚和别名,似乎不可能做我想要的而不添加另一级子结构,例如:
sitelist: &sites
- www.foo.com
- www.bar.com
anotherlist:
- *sites
- www.baz.com
Run Code Online (Sandbox Code Playgroud)
这意味着此YAML文件的使用者必须了解它.
有一种纯粹的YAML方式做这样的事情吗?或者我是否必须使用一些后YAML处理,例如实现变量替换或自动提升某些类型的子结构?我已经在进行那种后处理来处理其他一些用例,所以我并不完全厌恶它.但我的YAML文件将由人类编写,而不是由机器生成,因此我希望尽量减少用户在标准YAML语法之上需要记忆的规则数量.
我也希望能够用地图做类似的事情:
namedsites: &sites
Foo: www.foo.com
Bar: www.bar.com
moresites: *sites
Baz: www.baz.com
Run Code Online (Sandbox Code Playgroud)
我有一个搜索YAML规范,但找不到任何东西,所以我怀疑答案只是"不,你不能这样做".但是,如果有人有任何想法会很棒.
编辑:由于没有答案,我假设没有人发现我在YAML规范中没有的任何东西,并且这不能在YAML层完成.所以我打开了一个问题,想要对YAML进行后处理以帮助解决这个问题,以防将来有人发现这个问题.
我试图在用knitr/rmarkdown制作的PDF中交叉引用数字和表格.关于SO和tex.stackexchange(这里和这里,例如)有一些问题,建议内联的方法是添加\ref{fig:my_fig},my_fig块标签在哪里.但是,当我在我的rmarkdown文档中尝试时,我会得到??图号应该在哪里.我想了解如何使交叉引用正常工作.
可重复的例子如下.有两个文件:rmarkdown文件加上header.tex我包含的文件,以防它影响答案(尽管我是否包含header.tex文件也有同样的问题).
在该rmarkdown文件中有三个交叉引用示例.示例1是交叉引用失败的图(??显示而不是图号).还有第二个注释掉的尝试(基于这个SO答案),我尝试latex在块之前和之后用标记设置图形环境,标签和标题,但是pandoc当我尝试编织文档时这会导致错误.错误是:
Run Code Online (Sandbox Code Playgroud)! Missing $ inserted. <inserted text> $ l.108 , '%B %e, %Y')`"
output:
pdf_document:
fig_caption: yes
includes:
in_header: header.tex
keep_tex: yes
fontsize: 11pt …Run Code Online (Sandbox Code Playgroud) 我是XML的新手,所以这可能是一个相当容易回答的问题.我想知道是否有一种从其他XML文件中引用外部XML文件的标准方法.让我举个例子.假设您有一个文件,它定义了一个包含大量数据的对象:
<person>
<name>John</name>
<age>18</age>
<hair>Brown</hair>
<eyes>Blue</eyes>
</person>
Run Code Online (Sandbox Code Playgroud)
为了这个问题,假装该人拥有大量其他信息.假装文件像10 MB.
现在,假设您有另一个定义组的XML文件:
<group>
<person>
<name>John</name>
<age>18</age>
<hair>Brown</hair>
<eyes>Blue</eyes>
</person>
<person>
<name>Kim</name>
<age>21</age>
<hair>Blue</hair>
<eyes>Green</eyes>
</person>
<person>
<name>Sean</name>
<age>22</age>
<hair>Black</hair>
<eyes>Brown</eyes>
</person>
</group>
Run Code Online (Sandbox Code Playgroud)
如您所见,如果Person非常大,那么Group文件将非常大.那么,如果我们有类似John.xml的东西,有没有一种标准的方法在Group.xml中引用它而不明确定义John的所有数据?我确信这是一个非常广泛的主题,所以请随时将我链接到任何相关的网页.谢谢!
我想将不同类中的代码分开并将它们放到不同的文件中.但是这些课程相互依赖.
main.py:
from lib import A, B
def main():
a = A()
b = B()
a.hello()
b.hello()
if __name__ == '__main__':
main()
Run Code Online (Sandbox Code Playgroud)
lib/_ init _.py:
from a import A
from b import B
Run Code Online (Sandbox Code Playgroud)
LIB/a.py:
import lib.B
class A():
def __init__(self):
print "A"
def hello(self):
print "hello A"
b = B()
Run Code Online (Sandbox Code Playgroud)
LIB/b.py:
import lib.A
class B():
def __init__(self):
print "B"
def hello(self):
print "hello B"
a = A()
Run Code Online (Sandbox Code Playgroud)
是否有可能在Python中这样做?
编辑:
我收到此错误消息:
pydev debugger: starting
Traceback (most recent call last):
File …Run Code Online (Sandbox Code Playgroud) 我试图避免过多使用Excel,但是当我这样做时,我喜欢使用结构化引用,因为它们看起来更清晰.
如果我创建一个名为"table1"的表,其中列为"col1"和"col2",我将如何使用另一个表中的结构化引用引用"col1"中的第一行?我已经尝试了语法=table1[[#this row],[col1]],只是得到一个错误.有没有这样的语法=table1[1,1] or =table1[1,[col1]]?当然,这也不起作用,但有什么相同的?
这很烦人,因为它看起来应该很简单.
给定模块层次结构
module A
module B; function foo end; end
module C
"""
bar(x)
Like [`foo`](@ref), but more `bar`.
"""
function bar end
end
end
Run Code Online (Sandbox Code Playgroud)
我怎么能从foo文档串交叉引用bar?我曾尝试A.B.foo,B.foo以及..B.foo没有成功.
我想链接到外部文件中的一个部分,但我无法让它工作.这:ref:似乎不是全局的,或者我使用它错了吗?
..
File: some_file.rst
.. _ref_section:
Some Section
------------
Paragraph, foo bar lorem ipsum.
Run Code Online (Sandbox Code Playgroud)
..
File: some_other_file.rst
.. seealso:: :ref:`ref_section`
Run Code Online (Sandbox Code Playgroud)
如何从不同的文件交叉引用Sections?