Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--vertical-space yes adds too much after comment #811

Closed
jidanni opened this issue Apr 4, 2019 · 5 comments
Closed

--vertical-space yes adds too much after comment #811

jidanni opened this issue Apr 4, 2019 · 5 comments

Comments

@jidanni
Copy link
Contributor

jidanni commented Apr 4, 2019

See this nice bunch of comments?:

      <!-- 在台電水泥桿 -->
      <!--「上埤枝 30」-->
      <!-- 「窯坑枝 20 G8251 BB33」 -->

Let's "tidy" them even more,

     <!-- 在台電水泥桿 -->
      <!--「上埤枝 30」-->
      
     <!-- 「窯坑枝 20 G8251 BB33」 -->

See al;so #808.

@geoffmcl
Copy link
Contributor

@jidanni thank you for the comment, but do not yet understand what is the request, or bug. or what???...

Seems you have subsequently changed that index.html, but reconstructed a sample input as follows -

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Is. #811</title>
</head>
<body>
<ol>
    <li>
     <p>para 1,
     <!-- comm 1 -->
      <!-- comm 2 -->
      
     <!-- comm 3 -->
      cont with <a href="#">link 1</a> more...
     </p>

     <p>para 2, 
     <!-- comm 4 -->
      cont with <a href="#2">link 2</a> more... </p>
    </li>
</ol>
</body>
</html>

Running current tidy, with -q -i, gets an output of -

<!DOCTYPE html>
<html lang="en">
<head>
  <meta name="generator" content=
  "HTML Tidy for HTML5 for Windows version 5.7.22">
  <meta charset="utf-8">
  <title>Is. #811</title>
</head>
<body>
  <ol>
    <li>
      <p>para 1, <!-- comm 1 -->
       <!-- comm 2 -->
       <!-- comm 3 -->
       cont with <a href="#">link 1</a> more...</p>
      <p>para 2, <!-- comm 4 -->
       cont with <a href="#2">link 2</a> more...</p>
    </li>
  </ol>
</body>
</html>

Seems the output is nicely relined, evenly indented, looks tidy...

Where, or what, is the problem?

Please provide small sample input, config used, tidy version, current output, output expected, use case for changes, etc, etc, ...

The output of comments may benefit from ideas, specs, refs, like in #808, but what are the specific repeatable cases? Give small samples...

Just implying Tidy knocks comments around does not tell us much...

Need further feedback to understand... thanks...

@jidanni
Copy link
Contributor Author

jidanni commented Apr 11, 2019

You are totally right. I had my own personal filter interfering. But wait, I still found a last problem,

$ tidy  --vertical-space yes -q /tmp/g.htm 
<!DOCTYPE html>
<html>
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<title>test</title>
</head>
<body>
<!-- bla -->

<p>...</p>
</body>
</html>

Yes, we want vertical space, but not this extra blank line....

@jidanni jidanni changed the title Tidy knocks comments around --vertical-space yes adds too much after comment Apr 11, 2019
@geoffmcl
Copy link
Contributor

@jidanni, wow, you sort of close one issue - with filter interfering... err, ok, thanks...

Then rename the issue... and jump on the --vertical-space yes option... with, adds too much after comment... but...

But this is also very difficult, or at least confusing, ... to understand... and would have preferred closing this, and opening a new issue... if need be... but, ok....

The quite terse QuickRef says This option specifies if Tidy should add some extra empty lines for readability.... it added one to your g.htm sample... soooo??? It is not related to the comment at all...

I do not profess to know all that --vertical-space yes will do to the Pretty Print output... read say #228, #231, and several other related issues...

There is no doubt it is a sort of big compromise... a choice... yes = keep some, most, newlines from, what is internally referred to as, the classic mode... but the default no = a more compact output... auto = the most compact...

It was interesting to add this option, for fun!, when running the 240 regression tests... it shows some 135 changed outputs... like -

case-1003361
     </div>
+
     <div lang="sp">
case-1004512
-    <li><span class="c1">y2</span></li>
+    <li><span class="c1">y2</span>
+    </li>
case-1014993
-      <td></td>
+      <td>
+      </td>
case-1050673
-  <title></title>
+  <title>
+  </title>
case-1067112
   <div class="Section1">
     <p>Word 2000</p>
+
     <p> </p>
+
     <h1>Heading 1</h1>
-    <h2><strong>Heading 2</strong></h2>
-    <h3><strong>Heading 3</strong></h3>
+
+    <h2><strong>Heading 2</strong>
+    </h2>
+
+    <h3><strong>Heading 3</strong>
+    </h3>
+
     <p> </p>
+
     <p>Some ordinary text to see how it handles paragraphs</p>
+
     <p>A second paragraph</p>
+
     <p> </p>
+
     <ul type="disc">
       <li>One dot point</li>
+
       <li>Two dot points</li>
+
       <li>Three dot points</li>
     </ul>
+
     <p> </p>
+
case-836462c
   <ol>
     <!-- comment -->
-    <li class="c1"><br /></li>
+
+    <li class="c1"><br />
+    </li>
   </ol>
case-427810
   <!-- use "-clean" or not to test both cases -->
-  <p>Test inline element</p><blink>Proprietary inline element
-  (blink)</blink> <wbr>Proprietary inline element (wbr) - note
-  starts on new line, doesn't need end tag
+
+  <p>Test inline element</p>
+  <blink>Proprietary inline element (blink)</blink>
+  <wbr>Proprietary inline element (wbr) - note starts on new line,
+  doesn't need end tag
   
and onwards, for 100s of cases...

While this is not an exhaustive demonstration of the option --vertical-space yes, it gives some idea of what it does... and your new sample is another of those...

Maybe this information, and more, could/should form some help text, on this option... if someone would like to do that...

But at this moment the outputs from yes, no, auto comes as a package... there is no way to choose, yes to this, and no to that... sorry...

Such fine grained control of tidy output would require the introduction of new options... new code... new docs/help... new discussion, compromises, etc, etc...

At the moment this looks like Won't Fix, or more like Can't Fix, without upending the apple cart... ;=))

Look forward to further feedback, comments, patch, PR, etc... but no more title changes... thanks...

@jidanni
Copy link
Contributor Author

jidanni commented Apr 16, 2019 via email

@geoffmcl
Copy link
Contributor

geoffmcl commented May 2, 2019

@jidanni thanks for the feedback, but ok, you have really effectively changed the title yet again...

Now it is something like docs on vertical-space could be improved... or something... well we can always agree, the docs can be improved... ;=))

I spent quite a number of extra hours on trying to commence a sort of list... but was never happy... this classic-01.html is my results... at least a dozen cases... with examples...

It does involve a lot of cases, sometimes not so easy to describe... maybe more than the above...

If someone want to take this on, then they should open a new issue... and I hope they are willing to work on it, not just propose it... I will help... if there is positive feedback...

But since it seems a comment is probably not one of the triggers for a newline, am closing this... thanks...

@geoffmcl geoffmcl closed this as completed May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants