标记问题:P和列表 [英] Markup problem: P and lists

查看:81
本文介绍了标记问题:P和列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从alt.usage.english的作者那里拿这个例子

< news:// r3 ******************* *************@4ax.com> ;,其中的问题

是否为和因为它说明了HTML标记中反复出现的问题。


鲍勃去了商店出于以下原因:


(1)他必须为他的母亲买杂货;

(2)他想要离开家;

(3)他喜欢在超市工作的女孩;和(?)

(4)他需要香烟。



如何标记?是的,一般来说,鲍勃去商店......

在P中标记,而项目在OL中标记为LI。但从逻辑上讲,列表

属于该段落。 (还有和的问题,其中

逻辑上不属于任何列表项,而是属于逻辑段

以Bob开头。 ...")

在HTML中,P元素不允许任何块元素。列表元素

(UL,OL和DL)没有适合于识别列表是什么的元素,以及像和这样的部分。必须包含在允许的

列表元素之一(LI,DT,DD)中。换句话说,不可能以令人满意的方式标记

以上的例子。


< p>鲍勃因为以下原因去了商店:< br>

(1)他必须为他的母亲买杂货; < br>

(2)他想离开家; < br>

(3)他喜欢在超市工作的女孩;和< br>

(4)他需要香烟。< / p>


当然是有效的,但BR是表现性的,而且确实存在是一个清单

这里丢失了。


< ol> Bob因为以下原因去了商店:

< ; li>他必须为他的母亲买杂货;< / li>

< li>他想离开家;< / li>

< li>他喜欢在超市工作的女孩;< / liand

< li>他需要香烟。< / li>< / ol>


无效,因为鲍勃去了......和和不包含在任何列表中

元素。


我们处理这种情况的通常方式,


< p> Bob出于以下原因前往商店:< / p>

< ol>

< li>他必须为他的母亲买杂货; < / li>

< li>他想离开家;< / li>

< li>他喜欢一个在超市;和< / li>

< li>他需要香烟。< / li>

< / ol>


有效但不合逻辑,因为鲍勃去了......理由:在逻辑上不是一个段落和和逻辑上不属于任何项目。 (当然

还有纯粹的表现形式,省去了

额外的行间距。)


通知在列表中,可以识别(描述或其他)

子列表:


< ol>

< ; li>他必须为他的母亲买杂货,包括

< ol>

< li> eggs,< / li>

< li>两瓶Wild Irish Rose,< / li>

< li>狗粮,< / li>

< li> a十几个安全套;< / li>

< / ol>

< / li>

< li>他想得到走出家门;< / li>

< li>他喜欢在超市工作的女孩;和< / li>

< li>他需要香烟。< / li>

< / ol>


但是没有用于描述顶级列表的元素。


在我看来,这里的主要缺陷是P在

中不合逻辑HTML。虽然没有列表中的描述性元素和如何处理标点符号和连接性物质但没有确实属于这些项目的问题,这有点令人讨厌,主要问题是

P不承认任何块元素。类似的问题出现在

BLOCKQUOTE中。在一个段落中使用的短的

报价和一个长的报价之间没有真正的逻辑差异。差异纯粹是

表现。当引用被用作证据时(而不是

对话),原则上没有理由决定是否将b / b
显示为内联或者是一个块引用不要留给用户代理,

根据与当前显示相关的时间长短(例如,

a常见规则是使用类似块的引用介绍当材料是b
超过两行---并且只有用户代理知道两行是什么或

即使有这样的东西就行了一些长度)。


P如果承认了一些块元素会更合乎逻辑。


-

Lars Eighner< http://larseighner.com/<tp://myspace.com/larseighner>

倒计时:494天。

做什么当你被取消债券时你会这样做吗?

解决方案

Stefan Ram写道:


Lars Eighner< us **** @ larsei ghner.comwrites:


> Bob因为以下原因去了商店:
(1)他必须为他的母亲买杂货;
(2)他想离开家;
(3)他喜欢在超市工作的女孩; (?)
(4)他需要香烟。



注意:在Usenet中,">"在一行的开头,通常表示引用标题末尾的帖子引用




来自W3C推荐标准的报价? HTML 4.01规范?:


< DL>

< DT>< STRONG>成本更低< / STRONG>

< DD>此产品的新版本成本远低于前一个版本的




要显示,dt元素不需要

是最严格意义上的定义术语。


因此,


< dl>

< dt> Bob因为以下原因去了商店:< / dt>

< dd>

< ol>

< li>他必须为他的母亲买杂货;< / li>

< li>他想离开家;< / li>

< li>他喜欢在超人工作的女孩KET;和< / li>

< li>他需要香烟。< / li>< / ol>< / dd>< / dl>



假设一个列表被理解为具有多个项目的东西,

这在语义上是不正确的,因为这个DL只有

包含一个术语/定义项目。


Scripsit Stefan Ram:


来自W3C推荐标准的引用?HTML 4.01规范?:



你引用的是一个不好的例子,而不是一个规范的定义。


要显示,dt元素不需要

作为最严格意义上的定义术语。



不,这只是违反

规范性散文中所表达语义的一个例子。

这个小组已经讨论过几十次了。像往常一样,

建议滥用< dlwins绝对没有。你得到一个语义

连接,但是错误连接,没有任何有用的含义。你得到了一些

渲染,但其他方法实际上更容易修改

构造。


-

Jukka K. Korpela(Yucca)
http ://www.cs.tut.fi/~jkorpela/


在我们的上一集中,

< dl *************** @ ram.dialup.fu-berlin.de>,

可爱而有才华的Stefan Ram

在comp.infosystems上播出。 www.authoring.html:
< blockquote class =post_quotes>
Lars Eighner< us **** @ larseighner.comwrites:


>> Bob去了商店由于以下原因:
(1)他必须为他的母亲买杂货;
(2)他想离开家;
(3)他喜欢一个工作的女孩在超市; (?)
(4)他需要香烟。


注意:在Usenet中,">"在行的开头,通常表示来自References-header末尾的发布的

报价。



你刚刚在参考标题的那一部分做了那个。


碰巧,这是一个引用来自文章明确引用

在前面的文字中(你剪了)。

-

Lars Eighner< http://larseighner.com /< http://myspace.com/larseighner>

倒计时:494天。

债券被取消后你会怎么做?

I take this example from a writer in alt.usage.english
<news://r3********************************@4ax.com>, where the question
of whether the "and" is required came up strictly as an issue of English
usage, because it illustrates a recurring problem in HTML markup.

Bob went to the store for the following reasons:

(1) He had to get groceries for his mother;
(2) He wanted to get out of the house;
(3) He liked a girl who worked at the supermarket; and (?)
(4) He needed cigarettes.

How should this be marked up? Yes, generally, "Bob went to the store..."
is marked up in P and the items as LI in OL. But logically, the list
belongs to the paragraph. (There is also the issue of the "and" which
logically does not belong to any list item, but to the logical paragraph
beginning with "Bob went....")

In HTML, the P element does not allow any block element. The list elements
(UL, OL, and DL) have no element suitable for identifying what the list is a
list of and parts like the "and" must be contained in one of the allowed
list elements (LI, DT, DD). In other words, it is impossible to markup the
above example in a satisfactory way.

<p>Bob went to the store for the following reasons: <br>
(1) He had to get groceries for his mother; <br>
(2) He wanted to get out of the house; <br>
(3) He liked a girl who worked at the supermarket; and <br>
(4) He needed cigarettes.</p>

is of course valid, but BR is presentational and that there really is a list
here is lost.

<ol>Bob went to the store for the following reasons:
<li>He had to get groceries for his mother;</li>
<li>He wanted to get out of the house;</li>
<li>He liked a girl who worked at the supermarket;</liand
<li>He needed cigarettes.</li></ol>

is invalid because "Bob went ..." and "and" are not contained in any list
element.

The usual way we handle this situation,

<p>Bob went to the store for the following reasons:</p>
<ol>
<li>He had to get groceries for his mother;</li>
<li>He wanted to get out of the house;</li>
<li>He liked a girl who worked at the supermarket; and</li>
<li>He needed cigarettes.</li>
</ol>

is valid but not logical because "Bob went ... reasons:" is not logically
a paragraph and "and" does not logically belong to any item. (And of course
there is the purely presentational bother of styling to leave out the
extra line spacing.)

Notice that within a list, it is possible to identify (describe or whatever)
sublists:

<ol>
<li>He had to get groceries for his mother including
<ol>
<li>eggs,</li>
<li>two bottles of Wild Irish Rose,</li>
<li>dog food, and</li>
<li>a dozen condoms;</li>
</ol>
</li>
<li>He wanted to get out of the house;</li>
<li>He liked a girl who worked at the supermarket; and</li>
<li>He needed cigarettes.</li>
</ol>

but there is no element for describing the top-level list.

It seems to me the principal flaw here is that P is not really logical in
HTML. While the absences of a descriptive element from the lists and the
problem of what to do with punctuation and connective matter which do not
really belong to the items is somewhat annoying, the major problem is
that P does not admit any block elements. A similar problem appears with
BLOCKQUOTE. There is not really a logical difference between a short
quotation used in a paragraph and a long one. The difference is purely
presentational. When a quotation is used as evidence (as opposed to
dialogue), there is no reason in principle that the decision of whether to
display it inline or as a blockquote could not be left up to the user agent,
according to how long it is in relation to the current display (for example,
a common rule is to use a blockquote-like presentation when the material is
longer than two lines --- and only the user-agent knows what two lines is or
even if there is such a thing as a line of some length).

P would be more logical if it admitted some block elements.

--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 494 days to go.
What do you do when you''re debranded?

解决方案

Stefan Ram wrote:

Lars Eighner <us****@larseighner.comwrites:

>Bob went to the store for the following reasons:
(1) He had to get groceries for his mother;
(2) He wanted to get out of the house;
(3) He liked a girl who worked at the supermarket; and (?)
(4) He needed cigarettes.


NB: In Usenet, ">" at the start of a line, usually indicates a
quotation from the posting at the end of the References-header.

A quotation from the W3C Recommendation ?HTML 4.01 Specification?:

<DL>
<DT><STRONG>Lower cost</STRONG>
<DD>The new version of this product costs significantly less than the
previous one!

To show, that the dt element does not need
to be a defined term in the strictest sense.

Thus,

<dl>
<dt>Bob went to the store for the following reasons:</dt>
<dd>
<ol>
<li>He had to get groceries for his mother;</li>
<li>He wanted to get out of the house;</li>
<li>He liked a girl who worked at the supermarket; and</li>
<li>He needed cigarettes.</li></ol></dd></dl>

Assuming a list is understand to be a thing with more than one item,
this would be semantically improper on the grounds that this DL only
contains one term/definition item.


Scripsit Stefan Ram:

A quotation from the W3C Recommendation ?HTML 4.01 Specification?:

You''re quoting a bad example, not a normative definition.

To show, that the dt element does not need
to be a defined term in the strictest sense.

No, it''s just an example that violates the semantics expressed in the
normative prose.

This has been discussed dozens of times in this group. And as usual, the
proposed abuse of <dlwins absolutely nothing. You get a semantic
connection, but a wrong one, and with no useful implications. You get some
rendering, but other approaches actually give more easily styleable
constructs.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


In our last episode,
<dl***************@ram.dialup.fu-berlin.de>,
the lovely and talented Stefan Ram
broadcast on comp.infosystems.www.authoring.html:

Lars Eighner <us****@larseighner.comwrites:

>>Bob went to the store for the following reasons:
(1) He had to get groceries for his mother;
(2) He wanted to get out of the house;
(3) He liked a girl who worked at the supermarket; and (?)
(4) He needed cigarettes.

NB: In Usenet, ">" at the start of a line, usually indicates a
quotation from the posting at the end of the References-header.

You just made that up that part about the References header.

As it happens, it is a quotation from the article cited explicitly
in the preceding text (which you snipped).
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 494 days to go.
What do you do when you''re debranded?


这篇关于标记问题:P和列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆