diff options
author | 2017-12-12 11:38:09 -0500 | |
---|---|---|
committer | 2017-12-12 17:02:14 +0000 | |
commit | c896eddc1cf77ffaaa0d0cb68caac7e251cdb727 (patch) | |
tree | 91ecfbf0f63f12bdcf8f4a8cd2e393a56d03d5c4 /tools | |
parent | be22636c3d9e8d73dd408c241c183e923e149574 (diff) |
stabilize catalog
Identify volatile stdout from examples
to make site/user/api/catalog.htm the same from one run to
the next.
Remove a debugging printf from mdOut.cpp
Docs-Preview: https://skia.org/?cl=83941
Bug: skia:6898
Change-Id: I52c7527394e00934f57bb6c02ff33b422f4770ca
Reviewed-on: https://skia-review.googlesource.com/83941
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bookmaker/cataloger.cpp | 24 | ||||
-rw-r--r-- | tools/bookmaker/mdOut.cpp | 3 |
2 files changed, 22 insertions, 5 deletions
diff --git a/tools/bookmaker/cataloger.cpp b/tools/bookmaker/cataloger.cpp index c227437c7d..b3f578dd71 100644 --- a/tools/bookmaker/cataloger.cpp +++ b/tools/bookmaker/cataloger.cpp @@ -118,10 +118,10 @@ bool Catalog::pngOut(Definition* example) { return true; } -bool Catalog::textOut(Definition* example, const char* stdOutStart, +bool Catalog::textOut(Definition* def, const char* stdOutStart, const char* stdOutEnd) { string result; - if (!example->exampleToScript(&result, Definition::ExampleOptions::kText)) { + if (!def->exampleToScript(&result, Definition::ExampleOptions::kText)) { return false; } if (result.length() > 0) { @@ -138,12 +138,32 @@ bool Catalog::textOut(Definition* example, const char* stdOutStart, size_t pos = 0; size_t len = stdOutEnd - stdOutStart; string example; + const Definition* stdOut = def->hasChild(MarkType::kStdOut); + const Definition* outVolatile = stdOut ? stdOut->hasChild(MarkType::kVolatile) : nullptr; + if (outVolatile) { + stdOutStart = outVolatile->fContentStart; + while ('\n' == stdOutStart[0]) { + ++stdOutStart; + } + len = stdOut->fContentEnd - stdOutStart; + } while ((size_t) pos < len) { example += '"' == stdOutStart[pos] ? "\\\"" : '\\' == stdOutStart[pos] ? "\\\\" : + '\n' == stdOutStart[pos] ? "\\\\n" : string(&stdOutStart[pos], 1); + if (outVolatile && '\n' == stdOutStart[pos]) { + ++pos; + while ((size_t) pos < len && ' ' == stdOutStart[pos]) { + ++pos; + } + continue; + } ++pos; } + if (outVolatile) { + example += "\\\\n"; + } this->writeBlock(example.length(), example.c_str()); this->writeString("\""); this->lf(1); diff --git a/tools/bookmaker/mdOut.cpp b/tools/bookmaker/mdOut.cpp index 216a104fd8..0153e49e95 100644 --- a/tools/bookmaker/mdOut.cpp +++ b/tools/bookmaker/mdOut.cpp @@ -212,9 +212,6 @@ string MdOut::addReferences(const char* refStart, const char* refEnd, continue; } } - if ("RasterReleaseProc" == ref) { - SkDebugf(""); - } Definition* test = fRoot; do { if (!test->isRoot()) { |