Home » Archived » Eclipse SmartHome » ZWave thing descriptions, and HABmin label conventions...
| |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1702222 is a reply to message #1702218] |
Mon, 20 July 2015 18:05 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Hi Kai,
As currently defined/tested, the images are stored directly in the XML as part of the HTML descriptions (just inline base64 encoded). I guess they could be served up from somewhere else in the bundle, but I've not thought through the implications of this. Embedding images in this way would not work for markdown of course. Of course this embedding has some downsides - it probably takes some additional space (base64), it's possibly less maintainable (although that's arguable since a single file is potentially easier), but on the other hand, this should be mostly small, static images and the embedding does make things very simple to serve...
Personally I prefer HTML over MD as it's a bit more rich, and (probably) more universal. I'm not against MD though, but there's certainly things that can't be done in MD... Also, the current ZWave descriptions in OH1 are already using HTML in many cases so it makes them easier to convert...
Why do you prefer MD?
Cheers
Chris
|
|
| |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1702492 is a reply to message #1702426] |
Wed, 22 July 2015 17:09 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Kai Kreuzer wrote on Wed, 22 July 2015 10:33
But I think maintaining this is not too nice; having separate image resources within the bundle would probably be easier from a developer perspective.
I agree it has some disadvantages, but when there are maybe a thousand images to maintain, having separate resources will also have its challenges. It is in fact very easy to paste in the files - there are websites that do the conversion to text, and for static files such as these, it's actually quite easy.
However, if you really want MD, then this is all irrelevant, since it isn't possible. As I said, I'm not against MD, but we would need to work out how to serve up the resources in the bundles...
|
|
| | | |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1702788 is a reply to message #1702639] |
Fri, 24 July 2015 14:42 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
I fear markdown won't work well
As above, for markdown to work, we need whitespace and line feeds to be maintained, and this doesn't (currently) appear to be the case. If I have the following XML
<description>
<![CDATA[Enable/Disable operation of dimmer or roller shutter devices associated to group 1.
Available only when using mono-stable inputs (buttons) - Hold button 1 or double-tap for operation.]]>
</description>
I get the following in the json
description: "Enable/Disable operation of dimmer or roller shutter devices associated to group 1. Available only when using mono-stable inputs (buttons) - Hold button 1 or double-tap for operation."
So I've lost all the whitespace, and critically the line breaks that I wanted to maintain...
I guess that this is something to do with the xStream reader, but I didn't think it would remove whitespace within CDATA so I'm not 100% sure about that. In any case, I suspect that MD within XML is going to be quite problematic and prone to not working in some implementations.
There is the option to use other versions of MD (eg GFM) which supports the use of some HTML tags so we could (for example) use <br> but I fear once we start moving away from a simple/standard markdown to another non-standard flavour, you're probably just about as well off to use HTML. Even this may not work if we can't maintain line feeds since MD looks for many of its formatters at the beginning of a line... Additionally, the IETF are looking at standardising MD, and from what I can tell html tags aren't supported (although that was only a quick look).
Any thoughts...
|
|
| | |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1702892 is a reply to message #1702885] |
Mon, 27 July 2015 09:23 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Kai Kreuzer wrote on Mon, 27 July 2015 09:35
Without having analyzed it, I would guess that it is not the XML parser but the JSON serializer, which removes the line breaks and extra spaces. How does JSON actually handle line breaks in content? I think it probably would be escaped somehow?
You might be right, or it might be a combination of things. I wouldn't think that the json serialiser would remove multiple spaces (I might be wrong, but it would seem very strange to not be able to send two spaces together in a json string!). Json might remove the CR/LF - this possibly could be escaped.
From what I could see, we were loosing extra spaces as well as line feeds - both are necessary for MD to work, so it might be partly the json loosing the LF, but if something else (XML) is also loosing the extra spaces, then we're still in trouble.
Kai Kreuzer wrote on Mon, 27 July 2015 09:35
Not sure if I understand what you are saying here. Aren't we talking about documentation that is embedded in the thing XML descriptions (incl. their config descs)?
I was assuming that you weren't planning on using the config descriptions for producing documentation, but rather the README.MD (and other similar) files? Or are you also planning on somehow parsing all the config descriptions, and the options etc as well within Jekyll?
|
|
| |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1702898 is a reply to message #1702896] |
Mon, 27 July 2015 09:57 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Quote:
so we should decide for one or the other
While I don't disagree, there is a middle ground...
What 'version' of Markdown do you support? Looking at the readme files, they include a lot of 'extra' markdown features that aren't part of the 'standard' - it looks like it's possibly GFM?
Some of these Markdown variants (including GFM) supports limited use of HTML tags - things like line breaks, lists, bold, italics - all the simple things that we're likely to want in a simple config description. So, an option might be to define a small subset of HTML that is also supported by (some/many) markdown interpreters - effectively a subset of each, so we're compatible with both? If you look at the HTML supported by the Android HTML class, it's probably also supported in GFM, and it's probably about all we need for config descriptions?
There are a LOT of markdown interpreters on the web - given there's no standard (yet), and lots of different flavours, it does mean there's the potential for incompatibilities...
|
|
| | |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1703540 is a reply to message #1703537] |
Sun, 02 August 2015 21:14 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Quote:
Does the schema really allows it?
As above, it seems quite problematic since MD requires the structure of the data to be maintained, and I'm not sure that this is possible.
Quote:
But at least I never had in mind to put a lot of sentences including images and structural elements.
I strongly suggest that this is supported - it will be a major mess if the structure of descriptions etc is not maintained. Where you have many options, you need to describe them, and without lists, and font enhancements, it will just be a mess. This is supported already in the zwave binding, and if we need to remove all the structure, it won't be particularly usable.
We need to find a way to support this - I fear MD doesn't work (based on my tests, but I've not spent more than an hour or two trying) and basic HTML seems a reasonable way forward, but if you have another approach then I'm more than happy...
For now at least, the ZWave binding will have HTML included in the descriptions simply because many database files are already formatted in this way and I'm automatically converting the data over...
Cheers
Chris
|
|
| |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1703575 is a reply to message #1703571] |
Mon, 03 August 2015 10:04 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
I think MD or HTML can be rendered just as easily (often MD gets converted to HTML anyway) - so long as only 'basic' HTML elements are used (lists, bold, italics, titles, underline...). The big issue that I see is that MD needs to maintain whitespace, line feeds, etc - if you don't do this, it's not MD any more - it's just a mess... Currently, the system doesn't do this, so MD can not be used as it currently stands...
|
|
| |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1703691 is a reply to message #1703686] |
Tue, 04 August 2015 09:54 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Well, if MD is chosen, then yes I don't think this should be a problem (or is it?).
Generally, there are libraries out there that do this, in the same way as there are libraries out there to render HTML. For example, for Android, there is a class (HTML) that converts basic HTML into a format that can be displayed in the view (without having to add a full webview!). I believe there's a similar class that will do the same thing for MD, so roughly speaking, there's not a lot of difference I think. There are a number of libraries that convert from MD to HTML using a relatively simple regex to convert MD tags to HTML tags, so if you can do HTML, you can do MD.
Again, I'm only talking about 'simple' HTML - basic font enhancements, formatting and lists, which is what the HTML class in Android supports and should be all that's needed for help text and descriptions in the XML files.
|
|
| | |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1703713 is a reply to message #1703702] |
Tue, 04 August 2015 11:28 |
Chris Jackson Messages: 256 Registered: December 2013 |
Senior Member |
|
|
Quote:
At build time, Jekyll can handle interleaved MD/HTML to produce HTML for client rendering
I know next to nothing about Jekyll, but if you're sure this is the case, then as per the discussion earlier in this thread, we (ie me and Kai) agreed that a subset of HTML would be an appropriate way forward.
As above, my preference is strongly to use HTML to avoid problems. I don't think the statements like "it doesn't look as nice as MD" are really that relevant given that this is embedded in an XML document - it looks horrible anyway due to the XML! It's the same point I made about the maintenance of base64 embedded images - I think the maintenance issues are outweighed by the ease of serving given these are static files...
However, while I would like to include images (a lot of ZWave manuals are supported by images to ease the explanations), I can see an argument to keep this out and rely simply on a simple subset of HTML to provide text support. It's not my preference, but it's possible...
|
|
|
Re: ZWave thing descriptions, and HABmin label conventions... [message #1703732 is a reply to message #1703575] |
Tue, 04 August 2015 13:20 |
Kai Kreuzer Messages: 673 Registered: December 2011 |
Senior Member |
|
|
Nothing to add from my side. IF Jekyll supports mixing MD with HTML, a small subset of HTML tags would be ok for me. What set do you exactly have in mind?
<b>, <br>, <em>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <i>, <p>, <small>, <strong>, <sub>, <sup>, <ul>, <ol>, <li>?
|
|
| | | | | | | | |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1710934 is a reply to message #1704210] |
Sun, 11 October 2015 12:12 |
|
Just want to revisit the topic about the CDATA section. Also reading the cites here https://bugzilla.mozilla.org/show_bug.cgi?id=226786. Is it allowed that the new lines / whitespaces are removed? I think it shouldn't, or am I wrong?
If it should not removed, we have to ensure that they are not removed.
I used markdown at different stuff with different parsers and always run in trouble, that all the results looks different. Have to note, that I do not know, what are standard markdown and what are extensions of the parsers.
So we should at least document a link to a markdown spec and the HTML features we would like to support.
What is the current status?
|
|
| | | |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1710945 is a reply to message #1710944] |
Sun, 11 October 2015 15:28 |
|
@Chris
I don't talk about HTML and Markdown. If we stick to HTML than that this will work for this use case.
I think about ESH as a Framework that parts could be used by different developers, companies etc. We do not know how the software is used be other ones. If we are using XML we have to handle CDATA correctly. Regardless if we could accept wrong handling in our use cases ATM.
|
|
| |
Re: ZWave thing descriptions, and HABmin label conventions... [message #1710953 is a reply to message #1702788] |
Sun, 11 October 2015 18:51 |
|
I have read this read today from the beginning.
Chris Jackson wrote on Fri, 24 July 2015 14:42So I've lost all the whitespace, and critically the line breaks that I wanted to maintain...
I guess that this is something to do with the xStream reader, but I didn't think it would remove whitespace within CDATA so I'm not 100% sure about that.
Kai Kreuzer wrote on Mon, 27 July 2015 08:35Without having analyzed it, I would guess that it is not the XML parser but the JSON serializer, which removes the line breaks and extra spaces.
So, two options:
- the XML parser does remote whitespaces in the CDATA section
- the JSON serializer does remove the whitespaces
The removal of the whitespaces has not been identified -- I do not find something in this thread.
I checked if it is allowed to remove whitespaces in a XML CDATA section (because I want to know it). I found a bug entry of a Mozilla product that covers the removal of whitespaces in CDATA section in their product.
I would like to know your opinion if you think whitespaces must not removed, so I have written:
Markus Rathgeb wrote Sun, 11 October 2015 12:12Just want to revisit the topic about the CDATA section. Also reading the cites here https://bugzilla.mozilla.org/show_bug.cgi?id=226786. Is it allowed that the new lines / whitespaces are removed? I think it shouldn't, or am I wrong?
If it should not removed, we have to ensure that they are not removed.
Perhaps my questions / explanations have been not clear. But I think the link is valid as source for more information, as it contains a reference to the W3C XML specification and another book.
Just want to ensure that the XML parser is working correctly.
|
|
| |
Goto Forum:
Current Time: Wed Apr 24 19:15:20 GMT 2024
Powered by FUDForum. Page generated in 0.06421 seconds
|