diff options
author | 2017-07-31 07:52:43 -0400 | |
---|---|---|
committer | 2017-07-31 12:12:02 +0000 | |
commit | 1eace2db482c9d91e5375783a073941a640a5a76 (patch) | |
tree | e166092ae2c79eb660e5658ae9df2c5b80841ce1 /tools | |
parent | 50b2084bd15e7aea416dc8c6fd2373864c50f023 (diff) |
fix capitalization
Fix 'arcs' at sentence start to Arcs.
This fix corrected other capitalizations as well,
and exposed some mis-capitalizations in the bmh
doc.
R=brianosman@google.com
TBR=reed@google.com
Bug: skia:
Change-Id: I4d51388556f7e8ff868a9236ce76745915560327
Reviewed-on: https://skia-review.googlesource.com/28241
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bookmaker/bookmaker.h | 1 | ||||
-rw-r--r-- | tools/bookmaker/includeWriter.cpp | 31 |
2 files changed, 23 insertions, 9 deletions
diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h index a4e2c2cc6b..7ad20e6ede 100644 --- a/tools/bookmaker/bookmaker.h +++ b/tools/bookmaker/bookmaker.h @@ -1598,6 +1598,7 @@ public: kStart, kDelimiter, kPeriod, + kSpace, }; enum class Wrote { diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp index 5685f31339..d7b5241959 100644 --- a/tools/bookmaker/includeWriter.cpp +++ b/tools/bookmaker/includeWriter.cpp @@ -709,6 +709,12 @@ bool IncludeWriter::populate(Definition* def, RootDefinition* root) { if (MarkType::kTopic == parent->fMarkType || MarkType::kSubtopic == parent->fMarkType) { const char* commentStart = parent->fContentStart; + for (auto child : parent->fChildren) { + if (MarkType::kClass == child->fMarkType) { + break; + } + commentStart = child->fTerminator; + } const char* commentEnd = root->fStart; this->structOut(root, *root, commentStart, commentEnd); } else { @@ -905,7 +911,15 @@ string IncludeWriter::resolveMethod(const char* start, const char* end, bool fir if (fBmhParser->fMethodMap.end() != rootDefIter) { substitute = methodname + "()"; } else { - auto parent = fRootTopic->fChildren[0]->asRoot(); + RootDefinition* parent = nullptr; + for (auto candidate : fRootTopic->fChildren) { + if (MarkType::kClass == candidate->fMarkType + || MarkType::kStruct == candidate->fMarkType) { + parent = candidate->asRoot(); + break; + } + } + SkASSERT(parent); auto defRef = parent->find(parent->fName + "::" + methodname); if (defRef && MarkType::kMethod == defRef->fMarkType) { substitute = methodname + "()"; @@ -984,11 +998,10 @@ string IncludeWriter::resolveRef(const char* start, const char* end, bool first) } } } - // start here; - // first I thought first meant first word after period, but the below doesn't work -// if (first && isupper(start[0]) && substitute.length() > 0 && islower(substitute[0])) { -// substitute[0] = start[0]; -// } + // Ensure first word after period is capitalized if substitute is lower cased. + if (first && isupper(start[0]) && substitute.length() > 0 && islower(substitute[0])) { + substitute[0] = start[0]; + } return substitute; } int IncludeWriter::lookupMethod(const PunctuationState punctuation, const Word word, @@ -1115,7 +1128,9 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data) { default: SkASSERT(0); } - punctuation = PunctuationState::kStart; + punctuation = PunctuationState::kPeriod == punctuation || + (PunctuationState::kStart == punctuation && ' ' >= last) ? + PunctuationState::kStart : PunctuationState::kSpace; word = Word::kStart; hasLower = false; hasUpper = false; @@ -1226,8 +1241,6 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data) { if (PunctuationState::kPeriod == punctuation || PunctuationState::kDelimiter == punctuation) { word = Word::kMixed; - } else { - punctuation = PunctuationState::kStart; } break; case 'a': case 'b': case 'c': case 'd': case 'e': |