scribble icon indicating copy to clipboard operation
scribble copied to clipboard

Spurious <div>-within-<p> produced in html output when multiple authors are present

Open stevebyan opened this issue 6 months ago • 3 comments

When multiple authors are present for a #language scribble/base document, the html renderer produces bogus <div class="SIntrapara">s within a <p> after the pre-title content and before the post-title content.

This presents two problems. First, the <div class="SIntrapara">s don't seem to serve any function. Perhaps they were intended to separate the authors, and the authors from subsequent content? But the authors are already separated by <span class="SAuthorSep">.

Second, as a block-level element, a <div> is not permitted within a <p>. The <p> is added in the overridden render-compound-paragraph method in html-render.rkt. I don't understand the purpose of wrapping a Scribble compound-paragraph in a <p> tag, as other occurrences of compound-paragraph can end up introducing both <div class="SIntrapara"> and other block-level tags such as <blockquote> within the <p> tag, which again, is not permitted by the html spec.

In the example html output I'm attaching, I've run Scribble's output through html-tidy reflow to make it readable.

Hmm, attaching files of type .scrbl and .rkt are not allowed. I'll add them as text in separate comments.

stevebyan avatar Jun 30 '25 14:06 stevebyan

div-within-p.scrbl

#lang scribble/base

This is pre-title content. Perhaps an abstract?

@title[#:style (list 'no-toc+aux) #:date "June 30, 2025" #:version "0.1"]{Example showing intraparagraph <div> within <p>}
@author{Steve Byan}
@author{Rosie Roper}
@author{Fang}

This is post-title content.

@section{Introduction}

Foo. Bar. Baz.

divd-within-p.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.8" />
    <title>Example showing intraparagraph &lt;div&gt; within &lt;p&gt;</title>
    <link rel="stylesheet" type="text/css" href="scribble.css" title="default" />
    <link rel="stylesheet" type="text/css" href="scribble-style.css" title="default" />
    <script type="text/javascript" src="scribble-common.js"></script>
  </head>
  <body id="scribble-racket-lang-org">
    <div class="maincolumn">
      <div class="main">
        <div class="versionbox">
          <span class="versionNoNav">0.1</span>
        </div>
        <h1 class="heading">
        <a name="(part._.Example_showing_intraparagraph__div__within__p_)"></a>Example showing intraparagraph &lt;div&gt; within &lt;p&gt;
        <span class="button-group">
          <a href="#(part._.Example_showing_intraparagraph__div__within__p_)" class="heading-anchor" title="Link to here">🔗</a>
          <span style="visibility: hidden"></span>
        </span></h1>
        <div class="SAuthorListBox">
          <div class="SAuthorList">
            <p class="author">Steve Byan</p>
            <span class="SAuthorSep">
              <br />
            </span>
            <p class="author">Rosie Roper</p>
            <span class="SAuthorSep">
              <br />
            </span>
            <p class="author">Fang</p>
          </div>
        </div>
        <p>This is pre-title content. Perhaps an abstract?</p>
        <p>
          <div class="SIntrapara"></div>
          <div class="SIntrapara"></div>
          <div class="SIntrapara"></div>
        </p>
        <p>This is post-title content.</p>
        <h2 class="heading">1
        <span class="stt">&#160;</span>
        <a name="(part._.Introduction)"></a>Introduction
        <span class="button-group">
          <a href="#(part._.Introduction)" class="heading-anchor" title="Link to here">🔗</a>
          <span style="visibility: hidden"></span>
        </span></h2>
        <p>Foo. Bar. Baz.</p>
      </div>
    </div>
    <div id="contextindicator">&#160;</div>
  </body>
</html>

stevebyan avatar Jun 30 '25 14:06 stevebyan

no-div-within-p.scrbl

#lang scribble/base

This is pre-title content. Perhaps an abstract?

@title[#:style (list 'no-toc+aux) #:date "June 30, 2025" #:version "0.1"]{Example showing intraparagraph <div> within <p>}
@author{Steve Byan}

This is post-title content.

@section{Introduction}

Foo. Bar. Baz.

no-div-within-p.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.8" />
    <title>Example showing intraparagraph &lt;div&gt; within &lt;p&gt;</title>
    <link rel="stylesheet" type="text/css" href="scribble.css" title="default" />
    <link rel="stylesheet" type="text/css" href="scribble-style.css" title="default" />
    <script type="text/javascript" src="scribble-common.js"></script>
  </head>
  <body id="scribble-racket-lang-org">
    <div class="maincolumn">
      <div class="main">
        <div class="versionbox">
          <span class="versionNoNav">0.1</span>
        </div>
        <h1 class="heading">
        <a name="(part._.Example_showing_intraparagraph__div__within__p_)"></a>Example showing intraparagraph &lt;div&gt; within &lt;p&gt;
        <span class="button-group">
          <a href="#(part._.Example_showing_intraparagraph__div__within__p_)" class="heading-anchor" title="Link to here">🔗</a>
          <span style="visibility: hidden"></span>
        </span></h1>
        <div class="SAuthorListBox">
          <div class="SAuthorList">
            <p class="author">Steve Byan</p>
          </div>
        </div>
        <p>This is pre-title content. Perhaps an abstract?</p>
        <p>This is post-title content.</p>
        <h2 class="heading">1
        <span class="stt">&#160;</span>
        <a name="(part._.Introduction)"></a>Introduction
        <span class="button-group">
          <a href="#(part._.Introduction)" class="heading-anchor" title="Link to here">🔗</a>
          <span style="visibility: hidden"></span>
        </span></h2>
        <p>Foo. Bar. Baz.</p>
      </div>
    </div>
    <div id="contextindicator">&#160;</div>
  </body>
</html>

stevebyan avatar Jun 30 '25 14:06 stevebyan

div-and-blockquote-within-p.scrbl

#lang scribble/base

@title[#:style (list 'no-toc+aux)]{Example showing intraparagraph <div> and <blockquote> within <p>}

@section{Introduction}

@centered{Foo. Bar. Baz.}
Quux.

div-and-blockquote-within-p.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.8" />
    <title>Example showing intraparagraph &lt;div&gt; and &lt;blockquote&gt; within &lt;p&gt;</title>
    <link rel="stylesheet" type="text/css" href="scribble.css" title="default" />
    <link rel="stylesheet" type="text/css" href="scribble-style.css" title="default" />
    <script type="text/javascript" src="scribble-common.js"></script>
  </head>
  <body id="scribble-racket-lang-org">
    <div class="maincolumn">
      <div class="main">
        <h1 class="heading">
        <a name="(part._.Example_showing_intraparagraph__div__and__blockquote__within__p_)"></a>Example showing intraparagraph &lt;div&gt; and &lt;blockquote&gt; within &lt;p&gt;
        <span class="button-group">
          <a href="#(part._.Example_showing_intraparagraph__div__and__blockquote__within__p_)" class="heading-anchor" title="Link to here">🔗</a>
          <span style="visibility: hidden"></span>
        </span></h1>
        <h2 class="heading">1
        <span class="stt">&#160;</span>
        <a name="(part._.Introduction)"></a>Introduction
        <span class="button-group">
          <a href="#(part._.Introduction)" class="heading-anchor" title="Link to here">🔗</a>
          <span style="visibility: hidden"></span>
        </span></h2>
        <p>
          <div class="SIntrapara">
            <blockquote class="SCentered">
              <p>Foo. Bar. Baz.</p>
            </blockquote>
          </div>
          <div class="SIntrapara">Quux.</div>
        </p>
      </div>
    </div>
    <div id="contextindicator">&#160;</div>
  </body>
</html>

stevebyan avatar Jun 30 '25 15:06 stevebyan