Kodi Community Forum
Req Visual code folding (linefeeds & tabs) for xml files inserted per </> button. - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Website and Forum Issues or Suggestions (https://forum.kodi.tv/forumdisplay.php?fid=35)
+--- Thread: Req Visual code folding (linefeeds & tabs) for xml files inserted per </> button. (/showthread.php?tid=368099)



Visual code folding (linefeeds & tabs) for xml files inserted per </> button. - DiMag - 2022-05-01

I have been wondering for a long time why xml files posted here (</> button) look if not ugly then difficult to read; specifically, why they do not observe syntax-related code folding. Until I posted my first xml file. It turns out that xml files inserted per </> do not observe code folding. In fact, you cannot even correct it per hand-editing yourself.

I am aware of the fact that xml files are machine readable irrespective of their visual code folding. But we are humans not machines. To make a xml file humanely readable you have to add line feeds & tabs where the code implies so.

In the final analysis look at the xml files shipped with Kodi. They are all visually code folded.

BTW (I am curious): How does </> insert python files, where (unlike xml files) linefeeds + tabs matter for machine readability?


RE: Visual code folding (linefeeds & tabs) for xml files inserted per </> button. - Karellen - 2022-05-01

Are you specifying which language to use?
Does #25 help...

Image


RE: Visual code folding (linefeeds & tabs) for xml files inserted per </> button. - DiMag - 2022-05-02

Testing: include xml file in post
 
xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
<setting></setting>
<setting>
<item></item>
</setting>
</settings>

I clicked </> and selected xml and then inserted a pre-built arbitrary xml file coded in notepadd++ beforehand. And yes, the result was a beautifylly code folded xml file. When however I added IN THIS MINIMAL EDITOR an additional, equally artibrary sub-sub-tag <item></item> all folding order got lost, as you see in the example above.

I then created the exact same structure in notepad++ then inserted it in this minimal editor. Now everything looks fine.

xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
    <setting></setting>
    <setting>
        <item></item>
        <item></item>
    </setting>
</settings>

In conclusion, thanks @Karellen for the help, I now know how to input xml files code-folded correctly. However... Shouldn't this minimal editor do this on its own rather than expecting to receive a file previously coded in a text editor?


RE: Visual code folding (linefeeds & tabs) for xml files inserted per </> button. - DiMag - 2022-05-02

P.S.
A quick browsing of this forum showed that well over 50% of all posts including xml files are not correctly code folded. Indeed, as the examples posted above prove, they are not code folded at all. All code is aligned at column 1 left.