4

我有以下 HTML 代码(一个列表项)。内容并不重要——问题是第 2 行的结尾。

<li>Yes, you can learn how to play piano without becoming a
  great notation reader,
  however, <strong class="warning">you <em class="emphatic">will</em>
  have to acquire a <em class="emphatic">very</em>basic amount
  of notation reading skill</strong>.  But the extremely
  difficult task of honing your note reading skills that
  classical students are required to endure for years and years
  is <em class="emphatic">totally non-existant</em>as a
  requirement for playing non-classical piano.</li>

已应用命令填充段落 (Mq)。我一生都无法弄清楚为什么在“阅读器”之后的第二行放置换行符,因为该行上有更多空间可以放置“但是”。我注意到的另一件奇怪的事情是,当我在第 4 行和第 5 行删除然后重新应用制表符时(分别以“have”和“of”开头),也会自动插入两个空格字符,如下所示:

<li>Yes, you can learn how to play piano without becoming a
  great notation reader,
  however, <strong class="warning">you <em class="emphatic">will</em>
    have to acquire a <em class="emphatic">very</em>basic amount
    of notation reading skill</strong>.  But the extremely
  difficult task of honing your note reading skills that
  classical students are required to endure for years and years
  is <em class="emphatic">totally non-existant</em>as a
  requirement for playing non-classical piano.</li>

我不知道这是否是某种线索。这不会发生在任何其他行中。

这只是一个错误,还是任何有经验的 Emacs 人都知道这里可能发生了什么?

谢谢

4

2 回答 2

3

这是故意的。以 XML 或 SGML 标记开头的行是段落分隔线。如果 Emacs 以这样一种方式打破段落,使得标签在行首结束,那么后续的应用程序fill-paragraph将停止在该行。这是为了确保,例如,

<p>a paragraph</p>
<!-- no blank line -->
<p>another paragraph</p>

不会变成

<p>a paragraph</p> <!-- no blank line --> <p>another paragraph</p>

出于同样的原因,Emacs 不会在句号后换行,除非句号后面有两个或多个空格,因为它使用双空格来区分结束句子的句点和结束缩写的句点,并且换行结束缩写的句号之后的一行会造成模棱两可的情况。

于 2011-09-26T10:41:54.060 回答
1

对我来说似乎是一个错误。

我能够将您的示例精简为以下内容:

<li>blabla
  blabla <b>some_long_text_here</b> <b>more_long_text_here</b>

如果我从中删除一个文本字符,fill-paragraph则按预期工作。或者,如果我在两个后续<b>元素之间添加一个字符。

于 2011-01-20T20:23:29.077 回答