vr8hub / leo-tolstoy_war-and-peace_louise-and-aylmer-maude

StandardEbooks version of War and Peace.
Other
0 stars 0 forks source link

A handful of lint errors in chapter-3-1-19 #1

Closed robinwhittleton closed 1 year ago

robinwhittleton commented 4 years ago

I‘m running lint from the master branch so maybe this is newer, but I’m getting a couple of errors about the dl:

s-061 │ Error │ chapter-3-1-19.xhtml │ <dd> element without block-level child.

and:

s-062 │ Error │ chapter-3-1-19.xhtml │ <dt> element without exactly one <dfn> child.

@acabal: got any input on the second?

vr8hub commented 4 years ago

Interesting. I didn’t get either of those here (I’m current from a release perspective). And you and Alex and I discussed at the time what this should look like, so it looks like what you and he suggested. :)

I don’t believe there’s anything in the manual for this, so let me know what I need to change and I’ll take care of it.

On Jul 27, 2020, at 3:46 PM, Robin Whittleton notifications@github.com wrote:

I‘m running lint from the master branch so maybe this is newer, but I’m getting a couple of errors about the dl:

s-061 │ Error │ chapter-3-1-19.xhtml │

element without block-level child.

and:

s-062 │ Error │ chapter-3-1-19.xhtml │

element without exactly one child.

@acabal https://github.com/acabal: got any input on the second?

robinwhittleton commented 4 years ago

Yep, I think we may need to make some linter updates.

acabal commented 4 years ago

That is not yet in the released version of lint. But, the manual outlines glossaries: https://standardebooks.org/manual/1.0.0/7-high-level-structural-patterns#7.11

<dt> needs a <dfn> child, and <dd> needs at least one block level child like <p>.

vr8hub commented 4 years ago

Right, but this isn’t being used for a glossary. You and Robin and I discussed this several weeks ago (it's in the War and Peace thread); we’re using the dd/dt objects to format an alpha-to-numeric code. I can put the p’s on the dd, but there are no dfn’s.

On May 23, 2020, at 11:20 AM, Alex Cabal alex@standardebooks.org wrote:

Yeah I think that would work.

<dl> <div> <dt>a</dt> <dd>1</dd> </div>

<div> <dt>b</dt> <dd>2</dd> </div> </dl>

dl div{ display: inline-block; text-align: center; }

The CSS ended up being quite a bit different, but the html is pretty much as Robin and you described:

<dl>
    <div>
       <dt>a</dt>
       <dd>1</dd>
   </div>
   <div>
       <dt>b</dt>
       <dd>2</dd>
   </div>
…
</dl>
acabal commented 4 years ago

OK. I forgot about that. I believe I updated the manual after the big glossaries discussion on the list, which was after we discussed this. I think we should still put <p> in <dd>, so that it's consistent; that's in the same spirit of requiring a block level child in <li>. But since we're not defining anything here, we can exclude <dfn>. I'll update lint to only look for <dfn> in actual semantic glossaries.

acabal commented 4 years ago

Adding <p> shouldn't require changing the CSS at all, I don't think.

vr8hub commented 4 years ago

Fixed. No, it didn't require changing the CSS.

This is a curious/education question. Why do we require a block level child on things like <li>, <dd>, <header>, that don't themselves require one? Is it just consistency for the times we do need one? Of the three, <li> makes sense, because e.g. endnotes are often more than one paragraph. But <header> and <dd> (almost?) never are.

acabal commented 4 years ago

Basically for consistency so we can always expect at least one child. This makes things easier to style and post process, and removes the decision of whether to use a child or not. <header> often has multiple children though I don't think there's a rule for that; maybe there should be one. <dd> is much more rare but having more than one line for a definition is a reasonable assumption and it does occur in the corpus.