program tip

번호 매기기 목록의 코드 블록 (위키 구문)

radiobox 2020. 9. 22. 08:01
반응형

번호 매기기 목록의 코드 블록 (위키 구문)


MediaWiki (wikipedia의) wiki 구문에서 중간에 코드 블록이있는 번호 매기기 목록을 갖는 방법이 있습니까?

예를 들면 :

# 1 번
# 2 번
  코드 블록이 될 들여 쓰기 섹션
# 3 번
# 4 번

미디어 위키에서 일어나는 일은 다음과 같이 끝납니다.

1. 1 번
2. 2 번
   코드 블록이 될 들여 쓰기 섹션
1. 3 번
2. 4 번

( "숫자 3"과 "숫자 4"가 1과 2로 재설정되는 방법에 유의하십시오 ... StackOverflow가 MediaWiki보다 훨씬 더 똑똑해 보이는 것 같습니다. 제 예제를 PRE 태그에 넣어서 망쳐 야했습니다!)

"# :"구문을 사용하여 텍스트를 들여 쓸 수 있다는 것을 알고 있습니다 .

# 1 번
# 2 번
# : 들여 쓰기 만하는 들여 쓰기 섹션
# 3 번
# 4 번

...하지만 번호가 매겨진 목록에 있더라도 내 코드에 대해 동일한 시각적 CSS 클래스를 얻고 싶습니다.

중첩 된 목록으로 훨씬 더 재미 있습니다. 이 구문은 ...

# MainEntry 1
## 1 번
## 2 번
# MainEntry 2
## 1 번
## 2 번
  코드 블록이 될 들여 쓰기 섹션
## 3 번
## 4 번

...이된다 ...

1. MainEntry 1
   1. 1 번
   2. 2 번
2. MainEntry 2
   1. 1 번
   2. 2 번
      코드 블록이 될 들여 쓰기 섹션
1. 1. 3 번
   2. 4 번

( "Number 3"이 이제 "1. 1."이되는 방법에 유의하십시오.)


다음 위키 구문을 시도해 볼 수 있습니다. 1.17

# one
#:<pre>
#::some stuff
#::some more stuff</pre>
# two

더 많은 들여 쓰기로 끝나기 때문에 완벽하지는 않지만 여러 줄에 걸쳐 올바른 형식의 사전 블록에 위키 구문을 사용할 수 있습니다.

앞서 언급했듯이 다른 적절한 방법은 HTML 마크 업을 사용하는 것입니다.

<ol>
<li>one</li>
<li>two</li>
<pre>some stuff
some more stuff</pre>
<li>three</li>
</ol>

html 사용 :

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

it will work in mediawiki.

Note from the example that I posted below, it is the </li> that makes it work properly.


This works fine in MediaWiki 1.17.0:

===Alternative way of using pre in numbered lists.===    
# Numbered line 1.
# Numbered line 2.<pre>code line 1&#10;code line 2</pre>
# Numbered line 3.

The secret is to replace the newlines with the entity and write everything in one line.


Your issue is the subject of two bugs filled in the MediaWiki bug tracker in late 2004 and 2005 :

Bug 1115 - Newline as list item terminator is troublesome

Bug 1584 - Need method for multiparagraph list items, continuing numbered lists, and assigning specific numbers to list items

By reading them, you will find the solution is to not use the MediaWiki syntax but to rely on "pure" HTML.


I'm suggesting a different answer: don't do it.

I've attempted to use all the workarounds for this basic Mediawiki issue and found that they are all very imperfect. I've learned to live without numbers, and instead:

  • Use the splat (*) instead of (#) for all my lists
  • Continue to use the leading space for all my code blocks

This is far far simpler and maintainable than any workaround. Besides, use of any reference to a number is subject to change as the steps are edited - and this then becomes another maintenance issue.


In the above example the second indentation (::) is not necessary.

Just one indentation works fine (:) as follows:

# one
#:<pre>
#:some stuff
#:some more stuff</pre>
# two

Produces:

  • 1. one
       some stuff (just one indent level, not two)
       some more stuff
  • 2. two


  • You can also try adding a "blockquote" tag surrounding the "pre" tag, makes it look a little more polished.

    == HAProxy Configuration ==
    #'''File:''' /etc/haproxy/haproxy.cfg
    <blockquote>
    <pre>
    global
      log 127.0.0.1 local1 notice
      maxconn 4096
      #daemon
      debug
      crt-base /usr/local/haproxy/ssl
    </blockquote>
    </pre>
    

    Which will indent the gray box in line with your bullets/numbers without using colons.

    참고URL : https://stackoverflow.com/questions/4994174/code-block-in-numbered-list-wiki-syntax

    반응형