-
Notifications
You must be signed in to change notification settings - Fork 54
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
Refactoring for the style #75
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good. I vaguely remember trying to start down a path similar to this when I first added ADoc, but there was so much code duplication between the two similar styles that I switched to the isADoc
thing halfway through. But this architecture you have here seems better, and would allow additional output styles to be added in the future much more easily.
This is obsolete due to a larger refactoring at https://github.com/javagl/wetzel/tree/generate-3dtiles |
It's a little disappointing if glTF and 3D Tiles end up with forked-and-different copies of the same tool to generate the same kind of documentation. Seems like double the maintenance burden, in the long run. But I don't have the time budget for reviewing 3D Tiles' changes to wetzel, unfortunately, so it appears we're stuck on that path. |
It's indeed unfortunate. But there have been too many things for the 3D Tiles JSON schema that wetzel choked on. Roughly corresponding to the draft PRs that I just closed, but maybe incomplete:
The state in the linked branch is far from perfect, but works for 3D Tiles right now. The glTF output is 99% equal (I omitted some page breaks, really trivial things). And it actually includes fixes that will be required for the upcoming "glTF 2.0.x specification". But in terms of the output, these are really small fixes, so I assume that they'd rather be done based on the |
As you mentioned in a separate email, the output is all that matters to glTF. The tool could be completely rewritten from scratch if you like, so long as the output was >99% the same. The output doesn't even need to match byte-for-byte exactly; we just need to avoid output changes that would be meaningful to Khronos & ISO (lost descriptions, large changes to HTML/PDF formatting, etc.) It would be great to have only one tool to maintain instead of two. The tests could contain examples from both glTF and 3D Tiles, to make sure it's working correctly for both. |
Apart from the desired changes, there are no semantic changes in the glTF output. (The "desired" ones being: The properties of But...
The changes also refer to the CLI. Some parameters have been changed, added, and removed. However, the command line is quite long-ish and a bit clumsy anyhow, so I considered to just put all these parameters into some sort of For the updates of the glTF spec that I mentioned above, there could be "small" fixes in |
Just so I'm clear, does this mean for example this properties table would list I think that part is incorrect, as it would allow something like:
This is disallowed in glTF. Each extension must itself be an object. The For |
Sorry, that probably wasn't clear: This specifically referred to KhronosGroup/glTF#2158 - the issue contains more details. (EDIT: Referring to your example of (The point about the |
Ah, thanks for the clarification! And apologies for the misunderstanding. So, this seems all the more reason we should be merging these updates into the main copy of wetzel. |
The point of "'Extension' vs. The But beyond that, I'm hesitating to create a PR and suggest to merge the refactored state. On the one hand, the proof is in the pudding, and the output is all that counts. On the other hand: It's not all that counts: wetzel has many stars, forks and users, and the changes are everything but "backward compatible" (also referring to the CLI). (Apart from the usual things that cause some programmer's weltschmerz and hesitation: I don't know whether it's 'acceptable' in terms of the code style (because I'm not a JavaScript expert). There is some legacy code. There are some undocumented functions. There is not (yet) enough coverage on 'unit-test' level. There still are some TODOs...). |
The
style
currently is a set of functions that serve the purpose of formatting/styling the output. A considerable number of functions use someif (isAdoc())
check to generate different outputs, depending on whether the output should be Markdown or AsciiDoc, and this is configured where the style is initialized based on the command line parameters.It might be a matter of ... style (...), but when I see a structure like
then this just screams "interface" to me.
This is a draft of converting
style
into such an interface/abstract base class, with specific implementationsstyleMd
andstyleAdoc
.One could consider going further with that, in a larger refactoring, and turning the current
style
into something like a "generator backend" that just receives the respective parts of the schema, and generates output. This might be generalized so that it could create everything between a single MD file or a set of HTML files, transparently. This would imply defining the best interface for this "backend", and right now, there are things in thegenerateMarkdown.js
that could reasonably be part of such a more generic backend. But I wanted to create this DRAFT PR to gather feedback of whether any efforts in this direction are worth pursuing.Edit:
One technical detail that is related to this: There are currently some hard-wired prefixes for the
#anchor
names that are generated. This could or should be configurable for the case that multiple property references (with possibly duplicate names) are supposed to be merged into one larger document.