php / php/docbook-cs

Indentation fixing

Open
#47 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
7
Forks
5
Avg merge
8h 38m
Merged PRs (30d)
2

Description

The simpara in this example is misaligned. Perhaps a good follow up for indentation fixers (sniffers might should use warn/info instead error).

Current:

  <para>
   <example>
      <title>ImagickPixel <function>getColorCount</function></title>
      <programlisting role="php">
      <![CDATA[
<?php
    $imagick = new \Imagick();
    $imagick->newPseudoImage(640, 480, "magick:logo");
    $histogramElements = $imagick->getImageHistogram();
    $lastColor = array_pop($histogramElements);
    echo "Last pixel color count is: ".$lastColor->getColorCount();
?>
]]>
      </programlisting>
        <simpara>
The output for this will be similar to:
    </simpara>
    <screen role="php">
<![CDATA[
Last pixel color count is: 256244
]]>
    </screen>
    </example>
  </para>

Expected:

  <para>
   <example>
      <title>ImagickPixel <function>getColorCount</function></title>
      <programlisting role="php">
      <![CDATA[
<?php
    $imagick = new \Imagick();
    $imagick->newPseudoImage(640, 480, "magick:logo");
    $histogramElements = $imagick->getImageHistogram();
    $lastColor = array_pop($histogramElements);
    echo "Last pixel color count is: ".$lastColor->getColorCount();
?>
]]>
      </programlisting>
      <simpara>
          The output for this will be similar to:
       </simpara>
       <screen role="php">
<![CDATA[
Last pixel color count is: 256244
]]>
       </screen>
    </example>
  </para>
Edit

The current indentation fixer also doesn't yet work fully smooth. Leading whitespace is normalised as if it is wrong whitespace dupllication, although it should reformat the elements correctly

        <row>
         <entry><literal>"compression_alg"</literal></entry>
         <entry>string</entry>
         <entry>Compression algorithm. Both
-	   <literal>"compression_alg"</literal> and <literal>"compression_level"</literal>
-	   must be set in order to enable data compression.
-	 </entry>
+    <literal>"compression_alg"</literal> and <literal>"compression_level"</literal>
+    must be set in order to enable data compression.
+  </entry>
        </row>
Image

Note to self: we might should make fixer order canonical.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the current indentation fixer and reproduce the simpara and row examples from the issue. Compare its output with the expected XML, including leading whitespace and fixer ordering; done when both examples are formatted as shown without incorrect whitespace normalization.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.