Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing control over QuoteType used when outputting html #422

Closed
Geminior opened this issue Jan 13, 2021 · 3 comments
Closed

Missing control over QuoteType used when outputting html #422

Geminior opened this issue Jan 13, 2021 · 3 comments
Assignees

Comments

@Geminior
Copy link

Geminior commented Jan 13, 2021

Description

When loading and then outputting the html of an HtmlDocument, it will currently either quote all attributes or those that require it (e.g. spaces, line breaks etc.) depending on the value of OptionOutputOptimizeAttributeValues.

There is however no way to control which quote type is used. So if I load a document with quoteless attributes and immediately output it, those attributes are suddenly quoted using double quotes.

Ideally when attributes are read, the current quote type should be set according to what it is in the read html, which would mean a third option of None, in addition to SingleQuotes and DoubleQuotes.

As a less desirable alternative, the ability to change the default quote type at the document level could be added.

NoQuoteOverride v2.zip

Further technical details

  • HAP version: 1.11.29
  • NET version : .net 5.0
@JonathanMagnan JonathanMagnan self-assigned this Jan 13, 2021
@JonathanMagnan
Copy link
Member

Thank you for reporting,

My developer will look at it to see if that's easy to do or that will add too much additional code

Best Regards,

Jon


Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval FunctionSQL Eval Function

@JonathanMagnan
Copy link
Member

Hello @Geminior ,

The v1.11.30 has been released.

We cannot make this behavior as a default one due to backward compatibility but we added an options.

You should now be able to do: htmlDoc.GlobalAttributeValueQuote = AttributeValueQuote.Initial; to keep exactly the quote (or nothing) that has been parsed.

We also added AttributeValueQuote.None that force "no quote" to attribute

Let me know if that's exactly what you were looking for.

Best Regards

Jon

@Geminior
Copy link
Author

Hi @JonathanMagnan ,

That's great. I fully understand the need to keep the default behaviour and an option to change it will serve us just fine.
So I am very pleased with the change, and the speed of it :)

Best Regards,
Thomas Scheelhardt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants