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

4

虽然Wikis和Wikipedia仍在Area 51中,但我想问一个关于使用Creole wiki标记的问题。我有以下代码:

# 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
3. 这里有更多的连续指令。为什么编号重新从1开始?
4. 最后的指令。
问题:如何嵌入代码片段以使列表项在代码片段下方不重新从1开始?

你最终解决了这个问题吗? - glopes
1个回答

0

行内预格式化文本可在列表中使用。您可以通过分隔每行来近似块预格式化。这不是一个很好的解决方案,但对于某些情况可能有效。

# 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.

产出:

<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>


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接