-
Notifications
You must be signed in to change notification settings - Fork 36
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
WIP: snapshot support #70
Conversation
This supports whatwg/wattsi#70.
See whatwg/html-build#151 and whatwg/wattsi#70. We should probably change wattsi such that everything annotated w-nohtml does not always have to be annotated with w-nosnap...
On top of this we'd have to support yet another variant that only builds a single singlepage document with "Review Draft" relevant output. I'm not sure I want to put in the effort though since this took me quite a while and I'm getting nowhere fast. |
cc @domenic |
This makes some progress on snapshots, but it's a lot of effort...
This setup requires annotating most As for Review Drafts, my idea was that we would support a seventh argument to the wattsi invocation that would take care of that. Ideally as a modification on top of the |
This supports whatwg/wattsi#70.
src/wattsi.pas
Outdated
Scratch := Default(Rope); | ||
Scratch.Append('https://github.com/whatwg/html/commit/'); | ||
Scratch.Append(@SourceGitSHA[1], Length(SourceGitSHA)); | ||
Element.SetAttributeDestructively('href', Scratch); |
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 bit here doesn't work. End up with a bunch of wrong bytes in the final output. Elsewhere I could work around combining an AnsiString with some other type of string, but that doesn't work when setting attributes. I'd appreciate some help.
0751161 is a workaround for now. It’s not the right way but it gets the job done as far as I can tell, and I figured it’s better to go ahead and push this to the branch for testing at least.. But if we want to have the snapshot stuff working sooner rather than later — and as long as the rest of it other than this is working — then it wouldn’t be harmful to go ahead and merge this to master as-is and plan a follow-up commit for later to do this the right way. As far as what’s actually the right way: In working on previous patches, I’ve run into the same problem before when trying to deal with using the Rope stuff and with some of the related functions expecting constants instead of mutable variables. However right now I can’t remember exactly how I ended up dealing with it (or avoiding it) in those other cases. But I can probably (re)figure it out by tomorrow or so. Or else maybe if @Hixie can take a quick look it may be obvious to him what we should do instead. But anyway as I said, I think 0751161 gets us what we need for now. |
{$IFDEF TIMINGS} Writeln('Elapsed time: ', MillisecondsBetween(StartTime, Now()), 'ms'); {$ENDIF} | ||
// output... | ||
if (Variant <> vDEV) then | ||
for Variant in TVariants do |
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.
There's some copying of documents earlier on that also does that for all variants. I suppose we could add additional branching there too to save a bit of a processing time.
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 pretty solid to me, although I am mostly judging on results...
This reverts 0751161 in favor of using Rope.Append in roughly the same sort of way it’s used in similar cases in the source.
6d066f9 (re)fixes that — and unlike the previous hack I pushed in 0751161, 6d066f9 does it in the right way. Or it’s at least something closer to the right way (where “right” is basically just however @Hixie would have done it himself…). I got there after spending time looking back at the Rope sources and remembering where I ran into problems with it myself before. And that’s specifically in the fact that if you give As far as what doesn’t work as expected, I think usually you end up with unexpected bytes in the output (because I guess some overflow has happened and you start getting stuff from other memory addresses) — but I think sometimes it also just causes a fatal error and “Access violation” message. Anyway, regardless, in any case it always leads to breakage at runtime without a clear error message about what the actual specific cause is. What it ideally should do instead is, fail to compile to begin with — or if not that, at least generate a fatal error at runtime with a specific message saying, “String must be no longer than NN characters.“ As far as what the code considers “short”: It appears to be platform-dependent but it seems in my environment at least (and maybe in all 64-bit environments), it’s 11 characters or less. So what you what you need to do instead is, assign the string to a variable and then give |
src/wattsi.pas
Outdated
if (not Split(Documents[Variant], BigTOC, OutputDirectory + '/multipage-' + kSuffixes[Variant] + '/')) then | ||
raise EAbort.Create('Could not split specification'); | ||
{$IFDEF TIMINGS} Writeln('Elapsed time: ', MillisecondsBetween(StartTime, Now()), 'ms'); {$ENDIF} | ||
Result := True; |
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.
Should this move down again?
Commit message:
|
I fixed my own two nits, although avoiding additional cloning comes at a bit of additional code. |
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.
Tested and reviewed and all LGTM
See whatwg/meta#92 for details. And whatwg/wattsi#70 and whatwg/html#3689 for changes that are needed as well.
See whatwg/meta#92 for details. And whatwg/html-build#151 and whatwg/wattsi#70 for changes that are needed as well.
See whatwg/meta#92 for details. And whatwg/html-build#151 and whatwg/wattsi#70 for changes that are needed as well.
This makes some progress on snapshots, but it's a lot of effort...