diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2012-02-02 00:44:21 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2012-02-14 21:05:23 (GMT) |
commit | 543f1adfa4a8f2f38371512ffcb8c252332acb18 (patch) | |
tree | 8cccca965044622c799f5a147356744fb405cb85 /Source/cmDocumentation.cxx | |
parent | cdbd1a9e39e79fe2f29dff3c3a7b9cf9c9fae3cc (diff) | |
download | CMake-543f1adfa4a8f2f38371512ffcb8c252332acb18.zip CMake-543f1adfa4a8f2f38371512ffcb8c252332acb18.tar.gz CMake-543f1adfa4a8f2f38371512ffcb8c252332acb18.tar.bz2 |
Make the load of script documentation more efficient and dynamic.
CPack help will be searched in any CPack*.cmake file located
near to CPack.cmake file. The script files is parsed iff
the first line begin with ##section. Moreover the documentation
section name is specified on the remaining part of the line
minus the space immediately following ##section.
Diffstat (limited to 'Source/cmDocumentation.cxx')
-rw-r--r-- | Source/cmDocumentation.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 80f74a6..ed1e5e1 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -768,6 +768,7 @@ int cmDocumentation::GetStructuredDocFromFile( { typedef enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, + SDOC_SECTION, SDOC_UNKNOWN} sdoc_t; int nbDocItemFound = 0; int docCtxIdx = 0; @@ -795,9 +796,13 @@ int cmDocumentation::GetStructuredDocFromFile( if(line.size() && line[0] == '#') { /* handle structured doc context */ - if (line[1]=='#') + if ((line.size()>=2) && line[1]=='#') { - std::string mkword = line.substr(2,std::string::npos); + /* markup word is following '##' stopping at first space + * Some markup word like 'section' may have more characters + * following but we don't handle those here. + */ + std::string mkword = line.substr(2,line.find(' ',2)-2); if (mkword=="macro") { docCtxIdx++; @@ -822,6 +827,14 @@ int cmDocumentation::GetStructuredDocFromFile( docContextStack[docCtxIdx]=SDOC_MODULE; newCtx = true; } + else if (mkword=="section") + { + docCtxIdx++; + docContextStack[docCtxIdx]=SDOC_SECTION; + /* drop the rest of the line */ + line.clear(); + newCtx = true; + } else if (mkword.substr(0,3)=="end") { switch (docContextStack[docCtxIdx]) { @@ -841,6 +854,9 @@ int cmDocumentation::GetStructuredDocFromFile( case SDOC_MODULE: /* not implemented */ break; + case SDOC_SECTION: + /* not implemented */ + break; default: /* ignore other cases */ break; |