可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:
#Item1
#Item2
However, if I want to add spaces or some other text between those lines, the numbering gets lost. For example, the following will create text that has two number one items:
#Item1
Somestuff
#Item2
Is there any way around this, or should I just use bullet points instead? I noticed just now that the stackoverflow system does not allow numbering like this, you have to do it all manually.
回答1:
Like this:
#Item1
#:Somestuff
#Item2
回答2:
I use <ol></ol>
and <li></li>
to embed the <pre></pre>
code formatting portions. Works great for me! :-)
回答3:
There are a couple of options, but you can start an ordered list from an arbitrary number like this:
#Item1
Something
<ol start="2">
#Item2
</ol>
You can also use "#:" if you don't mind "Something" being indented a lot:
#Item1
#:
#: Something
#:
#Item2
There are quite a lot of options with lists, you can find more info on Wiki's Help Pages:List.
update
Newer version work more like regular html markup the old syntax will now give you a double indent and will not adjust the start offset, but the following works well, even with the source/syntaxhighlight tag.
<ol>
<li>Item1</li>
Something
</ol>
<ol start="2">
<li>Item2</li>
<source lang=javascript>
var a = 1;
</source>
</ol>
In short everything within the ol tag will have the same indentation and will not be numbered if it is outside a li tag. The following will now work and it mean you don't have to offset groups manually.
<ol>
<li>Item1</li>
Something
<li>Item2</li>
<source lang=javascript>
var a = 1;
</source>
</ol>
回答4:
The #: works, but you cannot create a
section with spaces, so I would prefer
the non-working option. Anyone knows a
similar syntaxis that does the trick
(start numbering at given value)?
This response is probably a bit late, but I figure I'll add it in case anyone stumbles across this, as I have.
You can create a section with spaces by doing something like:
# Item 1
#:
#:
# Item 2
This will appear as:
Item 1
Item 2
Now, before you say this doesn't work, the trick is to add an ASCII no-break space after the #: rather than just simply hitting spacebar. You can add this by holding ALT on your keyboard and typing 0160. Doing this should add the usual Wiki paragraph formatting while preserving your numbering between #s.
Hope that helps!
回答5:
"#:" will not work with other tags like
<source lang=javascript>
//...
</source>
回答6:
I'm using Mediawiki 1.13.3 and this works:
#Item1
Somestuff
<ol start="2">
<li>Item2 </li>
</ol>
回答7:
And for cases where you want to have some block text within your numbered wiki list try this
# one
#:<pre>
#:some stuff
#:some more stuff</pre>
# two
Which produces:
1. one
some stuff
some more stuff
2. two
回答8:
See:
http://www.gossamer-threads.com/lists/wiki/wikitech/156910?page=last
There is no better way.
回答9:
You can do:
# one
# two<br />spanning more lines<br />doesn't break numbering
# three
## three point one
## three point two
Regular old <br>
works as well but probably pisses off someone.
You can put additional HTML formatting in as well to do <pre>
formatting and the like without breaking the numbering as well. This also works other list formats.
From:
http://www.mediawiki.org/wiki/Help:Formatting
回答10:
From the Wiki Help Page I was able to get the numbering in a list to stay consitant using <p>
and <pre>
:
# Item 1
# Item 2 <p><pre>Item 2 Pre Stuff</pre></p>
# Item 3
Would generate
1. Item 1
2. Item 2
[ Item 2 Pre Stuff ]
3. Item 3
回答11:
Following the link to Wiki Help, I found an example that meets what I think are the implied requirements
- The list needs to keep numbering
- Sometimes the "Somestuff" should be on it's own line in the source
To get (1) there are a few solutions proposed. Bug one way is to use paragraph delimiters around the extra "somestuff".
Example 1:
# Paragraph 1.<p>Paragraph 2.</p><p>Paragraph 3.</p>
# Second item.
To meet (2), you use paragraph marking in combination with commenting out the new lines (with <!-- newline-->).
Example 2:
# Paragraph 1.<!--
--><p>Paragraph 2.</p><!--
--><p>Paragraph 3.</p>
# Second item.
Both examples display as
Result:
1. Paragraph 1.
Paragraph 2.
Paragraph 3.
2. Second item
Note that the comment eats all of the white space between the end of one element and the start of the next, which seems to be standard practice, and makes sense if you're trying to have whitespace without the "wiki effects" of the white space.
回答12:
Extension:ComplexList
https://www.mediawiki.org/w/index.php?oldid=2126533
was put together but not maintained (for lack of time). It works with 1.26.2 of MediaWiki.
For example.
<cl>
1. list item A1
* list item A2
continuing list item A2
further continuing list item A2
* list item A3
</cl>
becomes
- list item A1
- list item A2
continuing list item A2
further continuing list item A2
- list item A3