doxyDocDirs: Added support for HTTP servers

In addition to local Doxygen HTML directories an optional HTTP server directory
may be specified:

Documentation
{
    docBrowser      "firefox";
    doxyDocDirs
    (
        "$WM_PROJECT_USER_DIR/html"
        "~OpenFOAM/html"
        "$WM_PROJECT_DIR/doc/Doxygen/html"
        "http://cpp.openfoam.org/dev"
    );
    doxySourceFileExt "_8C.html";
}

from which the Doxygen documentation files may be obtained so now the "-doc"
command-line option may be used even if if Doxygen has not been run locally,
e.g.

pimpleFoam -doc
This commit is contained in:
Henry Weller
2017-05-15 15:33:51 +01:00
parent 2e3ee64e04
commit e3fe02296e
2 changed files with 34 additions and 20 deletions

View File

@ -18,18 +18,15 @@ FoamFile
Documentation
{
docBrowser "firefox -file %f";
docBrowser "firefox";
doxyDocDirs
(
"$WM_PROJECT_USER_DIR/html"
"~OpenFOAM/html"
"$WM_PROJECT_DIR/doc/Doxygen/html"
"http://cpp.openfoam.org/dev"
);
doxySourceFileExts
(
"App_8C.html"
"_8C.html"
);
doxySourceFileExt "_8C.html";
}

View File

@ -1134,48 +1134,65 @@ void Foam::argList::displayDoc(bool source) const
{
const dictionary& docDict = debug::controlDict().subDict("Documentation");
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
List<fileName> docExts(docDict.lookup("doxySourceFileExts"));
fileName docExt(docDict.lookup("doxySourceFileExt"));
// For source code: change foo_8C.html to foo_8C_source.html
if (source)
{
forAll(docExts, extI)
{
docExts[extI].replace(".", "_source.");
}
docExt.replace(".", "_source.");
}
fileName docFile;
fileName httpServer;
bool found = false;
forAll(docDirs, dirI)
{
forAll(docExts, extI)
// An HTTP server is treated as a special case ...
if (docDirs[dirI].component(0) == "http:")
{
docFile = docDirs[dirI]/executable_ + docExts[extI];
httpServer = docDirs[dirI]/executable_ + docExt;
}
else
{
// ... all other entries are treated as local directories
// Remove the optional "file://"
if (docDirs[dirI].component(0) == "file:")
{
docDirs[dirI].replace("file://", string::null);
}
// Expand the file name
docFile = docDirs[dirI]/executable_ + docExt;
docFile.expand();
// Check the existence of the file
if (isFile(docFile))
{
found = true;
break;
}
}
if (found)
{
break;
}
}
if (found)
if (found || httpServer != fileName::null)
{
string docBrowser = getEnv("FOAM_DOC_BROWSER");
if (docBrowser.empty())
{
docDict.lookup("docBrowser") >> docBrowser;
}
// Can use FOAM_DOC_BROWSER='application file://%f' if required
docBrowser.replaceAll("%f", docFile);
if (found)
{
docBrowser += " file://" + docFile;
}
else
{
docBrowser += " " + httpServer;
}
Info<< "Show documentation: " << docBrowser.c_str() << endl;