标记有序描述列表

时间:2014-09-23 09:20:53

标签: html5 semantic-markup

我知道有similar question,但我的情况稍微复杂一些。

我正致力于表示一类Linguistics Olympiad问题,这些问题为求解者提供了几种用未知语言编写的句子及其相应的翻译,如下所示:

1. edèì âno nwạ́sesè ozyí lẹlemù à? edèì ânò wei ga òkí nwạsese ozyí lẹlemù.
Will this man frighten the deceived thief?
This man said that he (this man) would not frighten the deceived thief.

2. ạvùràmù kịnono amemùrè ânò à? ạvùràmù wei ga òkì kịnono amemùrè ânò.
Did the woman resemble this girl?
The woman said that she (the woman) did resemble this girl.

... another five sentences

from IOL 2014, Problem 4

解算器需要推断出这种语言的语法并完成一些任务。有两种类型的作业一直出现:从未知语言翻译和翻译成未知语言。

最初,我决定使用有序列表。但我很快意识到这些句子实际上是一个名称 - 值组。但是:

  1. 每个句子前面的数字对于参考目的是有意义的。
  2. 计数器在作业部分重复使用。如果我选择使用它,我需要在css中使用计数器或在有序列表上显式设置start属性。
  3. 在翻译作业中,只有一种语句版本,无论是未知语言还是Solver-ese。所以这些句子不是一个名称 - 值组。
  4. 这是我的问题:

    我应该对这些句子使用说明列表吗?仅在给定的数据集中?或者在翻译作业中的数据集和句子中?

    如果是这样,我应该如何表示以下内容:

    Translate into Engenni:
    11. Will the old man resemble this coughing youth?
    The child said that he (the old man) would not resemble this coughing youth.
    
    12. Did this beaten woman not frighten the man?
    This beaten woman said that she (this beaten woman) did not frighten the man.
    

    在说明列表中?根据标准,我不应该使用<dd>,但在数据集中,英语句子在<dd>


    一个不相关的问题:如果我使用有序列表,我应该使用两个<p>两个版本的相同翻译吗?或者我应该使用<i>明确标记未知语言的版本?或者<i>可能不合适,所以我需要使用语义中立的<span>

1 个答案:

答案 0 :(得分:0)

您可能不应在此处使用有序列表(ol)。只有当项目的排序有意义时才使用此元素,而不仅仅是因为它们以某种方式排序(例如,通过“任意”计数器)。

如果计数器是重要内容,则应将其作为纯文本内容,而不是ol的默认样式。依赖默认ol计数器的问题:

  • 用户无法 Ctrl + f 获取数字。
  • 当用户复制粘贴内容时,可能不会包含计数器。
  • 拥有不支持start属性的用户代理的用户将收到错误的计数器。
  • CSS!不要依赖它来传达内容

对于数据集,您可以使用dl

<section>
  <h1>Translations</h1>

  <dl>

    <dt>
      <b id="translation-1">1</b>
      <p lang="und">edèì âno nwạ́sesè ozyí lẹlemù à? edèì ânò wei ga òkí nwạsese ozyí lẹlemù.</p>
    </dt>
    <dd>
      <p lang="en">Will this man frighten the deceived thief? This man said that he (this man) would not frighten the deceived thief.</p>
    </dd>

    <dt>
      <b id="translation-2">2</b>
      <p lang="und">ạvùràmù kịnono amemùrè ânò à? ạvùràmù wei ga òkì kịnono amemùrè ânò.</p>
    </dt>
    <dd>
      <p lang="en">Did the woman resemble this girl? The woman said that she (the woman) did resemble this girl.</p>
    </dd>

  </dl>

</section>

dl的替代方法可以是简单地使用HTML5的分区元素和标题:

<section>
  <h1>Translations</h1>

  <article>
    <h1 id="translation-1">1</h1>
    <p lang="und">edèì âno nwạ́sesè ozyí lẹlemù à? edèì ânò wei ga òkí nwạsese ozyí lẹlemù.</p>
    <p lang="en">Will this man frighten the deceived thief? This man said that he (this man) would not frighten the deceived thief.</p>
  </article>

  <article>
    <h1 id="translation-2">2</h1>
    <p lang="und">ạvùràmù kịnono amemùrè ânò à? ạvùràmù wei ga òkì kịnono amemùrè ânò.</p>
    <p lang="en">Did the woman resemble this girl? The woman said that she (the woman) did resemble this girl.</p>
  </article>

</section>

使用table would be possible, too,但在这种情况下我不喜欢它。那么实现所需的造型可能也会更难。


翻译分配的选择不应取决于您用于数据集的标记。但是当您明确提供计数器时,这将放在dt中,因此英语句子最终会以dd结尾。但是,您可以使用dl代替ul,或者再次使用标题分割元素。