From e3fe02296ed865610836c6ebedcbb15a59e09fe4 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 15 May 2017 15:33:51 +0100 Subject: [PATCH] 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 --- etc/controlDict | 9 ++---- src/OpenFOAM/global/argList/argList.C | 45 ++++++++++++++++++--------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/etc/controlDict b/etc/controlDict index becf2f1966..60a10a8742 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -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"; } diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index cdd31a303e..c28814f599 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -1134,48 +1134,65 @@ void Foam::argList::displayDoc(bool source) const { const dictionary& docDict = debug::controlDict().subDict("Documentation"); List docDirs(docDict.lookup("doxyDocDirs")); - List 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;