Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Improve readability of output by adding newlines between each tag #34

Open
sschiavoni opened this issue Oct 12, 2014 · 4 comments
Open

Comments

@sschiavoni
Copy link
Contributor

Original issue 35 created by yuch@google.com on 2012-10-03T18:06:16.000Z:

What steps will reproduce the problem?

If you enter a CAP <alert> without any new lines, the output also wouldn't have any newlines. So for example, sometimes a CAP message is 1 long line. As a result, any errors and warnings will be difficult to identify in that jumble, because they're line-based.

What is the expected output? What do you see instead?

Add new lines in between <tags> for the output.

What version of the product are you using? On what operating system?

Please provide any additional information below.

@sschiavoni
Copy link
Contributor Author

This is doable, but requires to introduce yet another XML parser (which is fine, I guess).

The only problem I see is that if you provide a URL, or copy-paste from a file, the errors will be reported on a line which does not correspond anymore to the original one. @azamanyan, should we ho ahead?

@shakusa
Copy link
Contributor

shakusa commented Dec 2, 2014

A pretty simple heuristic may work here; something like "if not a url and
number of newlines in input is less than 5, pretty-print and continue".

On Mon, Dec 1, 2014 at 10:37 AM, Stefano Schiavoni <notifications@github.com

wrote:

This is doable, but requires to introduce yet another XML parser (which is
fine, I guess).

The only problem I see is that if you provide a URL, or copy-paste from a
file, the errors will be reported on a line which does not correspond
anymore to the original one. @azamanyan https://github.com/azamanyan,
should we ho ahead?


Reply to this email directly or view it on GitHub
#34 (comment).

@azamanyan
Copy link

With the suggested heuristic, I think this will work well since we wouldn't modify CAP that already included newlines for formatting.

@sschiavoni
Copy link
Contributor Author

Sounds good.

Just one note: we won't be able to easily pretty-print the XML when it is not a well-formatted XML (i.e., when the XML parser throws a fatal exception). In this case we will need to fall-back to the original input formatting.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants