2013-07-26 17 views
1

對於一個文檔項目,我想給出代碼示例列表的要點。我使用Sphinx將.rst文件轉換爲HTML。這工作正常,直到我開始在列表項中使用文字塊。在下面的示例中,我想在與「給定XML文件...」相同的級別上顯示句子「執行以下代碼之後」。但它會自動縮進。在reStructuredText(使用Spinx)中使用文字塊時如何修復列表縮進?

Example 
-------- 

- Given an XML-file note.xml, which contains: 

    :: 

     <note> 
      <to>Tove</to> 
      <from>Jani</from> 
      <heading>Reminder</heading> 
      <body>Don't forget me this weekend!</body> 
     </note> 

    After executing the following code: 

    :: 

     xml = loadxml ("<your path to file>/note.xml"); 
     parent = xpath(xml, "//note"); //get main node 
     addsubnode (parent, "<comment>Comments are welcome.</comment>"); 

PS:沒關係代碼,它是一種特殊的語言。

回答

3

發現解決方案,意外。事實證明,這非常簡單,只留下子彈痕後面的空白行:

Examples 
-------- 

- 

    Given an XML-file note.xml, which contains: 

    :: 

     <note> 
      <to>Tove</to> 
      <from>Jani</from> 
      <heading>Reminder</heading> 
      <body>Don't forget me this weekend!</body> 
     </note> 

    After executing the following code: 

    :: 

     xml = loadxml ("<your path to file>/note.xml"); 
     parent = xpath(xml, "//note"); //get main node 
     addsubnode (parent, "<comment>Comments are welcome.</comment>"); 
相關問題