列表中的代码片段(Creole wiki)

时间:2011-07-26 04:57:40

标签: list wiki code-snippets creole

虽然Wikis and Wikipedia仍在第51区,但我想问一下有关使用克里奥尔维基标记的问题。我有以下代码:

# Initial instructions here.
# Some instructions here. See code snippet below.
{{{
#!python

def foo():
  return bar
}}}
# More instructions here. Why does the numbering restart at 1?
# Final instructions.

解析该代码后,我会得到以下内容:

1.此处有初步说明。
2.这里有一些说明。请参阅下面的代码段
def foo():
  return bar
1.这里有更多持续的指示。为什么编号重新开始?1 2.最后的指示。

问题:如何在列表中嵌入代码段,以便代码段下方的列表项不会在1处重新启动?

1 个答案:

答案 0 :(得分:0)

Inline preformatted text works in lists. You can use this to approximate block preformatting by separating each line. This isn't a great solution, but it might work for some cases.

# Initial instructions here.
# Some instructions here. See code snippet below.
** {{{#!python}}}
** {{{}}}
** {{{def foo():}}}
** {{{  return bar}}}
# More instructions here. Why does the numbering restart at 1?
# Final instructions.

Yeilds:

<ol>
	<li>Initial instructions here.</li>
	<li>Some instructions here. See code snippet below.
	<ul>
		<li><tt>#!python</tt></li>
		<li><tt></tt></li>
		<li><tt>def foo():</tt></li>
		<li><tt>  return bar</tt></li>
	</ul></li>
	<li>More instructions here. Why does the numbering restart at 1?</li>
	<li>Final instructions.</li>
</ol>