Skip to content

Normalize host for HTML output

Sebastian Rose requested to merge ChipsBarrier/unix-tree:master into master

The output varied for different baseHref inputs. As the baseHref is never a protocol (i.e. ending on two or three slashes), we can normalize that parameter (a bit) and make it's output similar to the directory output.

Examples:

(1) sh# tree -H org/ # Note the slash at the end

Before:

        <a href="org/">org/</a><br>                                  ## Slash at the end of the dirname
        ├── <a href="org//CHANGES">CHANGES</a><br>
        ...
        ├── <a href="org//doc/">doc</a><br>                          ## Two slashes in the href attribute, no slash at the end
        │   ├── <a href="org//doc/global_info">global_info</a><br>
        ...

Fixed:

        <a href="org/">org</a><br>
        ├── <a href="org/CHANGES">CHANGES</a><br>
        ...
        ├── <a href="org/doc/">doc</a><br>
        │   ├── <a href="org/doc/global_info">global_info</a><br>
        ...

(2) sh# tree -H org # No slash at the end

Before:

	<a href="org">org</a><br>                                  ## No slash at the end of the href attribute
	├── <a href="org/CHANGES">CHANGES</a><br>
	...
	├── <a href="org/doc/">doc</a><br>
	│   ├── <a href="org/doc/global_info">global_info</a><br>  ## Slash at the end of the href attribute
	...

Fixed:

	<a href="org/">org</a><br>
	├── <a href="org/CHANGES">CHANGES</a><br>
	...
	├── <a href="org/doc/">doc</a><br>
	│   ├── <a href="org/doc/global_info">global_info</a><br>
	...

Merge request reports