diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx index 02d4c8c5feebea537006812d7610670393de62a6..3e35f46436972f645c57e0bbc2a9d014775d4e51 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx @@ -22,6 +22,7 @@ #include <stdio.h> #include "otbWrapperChoiceParameter.h" +#include "otbStringToHTML.h" namespace otb { @@ -55,12 +56,12 @@ namespace Wrapper #define otbDocHtmlParamMacro( type, param, fullKey, showKey ) \ oss << "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Courier New, courier'; font-weight:600;\"; >"; \ - oss << param->GetName(); \ + oss << otb::StringToHTML(param->GetName()); \ if( showKey == true && param->GetKey()[0] != '\0' ) \ { \ if (!fullKey.empty()) \ { \ - oss << " ("<< fullKey<< "." << param->GetKey() << ")"; \ + oss << " ("<< fullKey<< "." << param->GetKey() << ")"; \ } \ else \ { \ @@ -70,7 +71,7 @@ else \ oss << ": </span>"; \ if( param->GetDescription()[0] != '\0' ) \ { \ - oss << param->GetDescription(); \ + oss << otb::StringToHTML(param->GetDescription()); \ } \ oss << "</p>"; @@ -93,10 +94,10 @@ ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::s oss << "p, li { white-space: pre-wrap; }"; oss << "</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">"; - otbDocHtmlTitleMacro( app->GetDocName() ); + otbDocHtmlTitleMacro( otb::StringToHTML(app->GetDocName()) ); otbDocHtmlTitle1Macro( "Brief Description" ); - otbDocHtmlBodyMacro( app->GetDescription() ); + otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDescription()) ); otbDocHtmlTitle1Macro( "Tags" ); std::string tagList; @@ -107,7 +108,7 @@ ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::s tagList.append( app->GetDocTags()[i] ).append(", "); } tagList.append( app->GetDocTags()[app->GetDocTags().size() - 1]); - otbDocHtmlBodyMacro( tagList ); + otbDocHtmlBodyMacro( otb::StringToHTML(tagList) ); } else { @@ -115,7 +116,7 @@ ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::s } otbDocHtmlTitle1Macro("Long Description"); - otbDocHtmlBodyMacro( app->GetDocLongDescription() ); + otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocLongDescription()) ); otbDocHtmlTitle1Macro("Parameters"); oss << "<ul>"; @@ -125,13 +126,13 @@ ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::s oss<<"</ul>"; otbDocHtmlTitle1Macro( "Limitations"); - otbDocHtmlBodyMacro( app->GetDocLimitations() ); + otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocLimitations()) ); otbDocHtmlTitle1Macro( "Authors" ); - otbDocHtmlBodyMacro( app->GetDocAuthors() ); + otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocAuthors()) ); otbDocHtmlTitle1Macro( "See also" ); - otbDocHtmlBodyMacro( app->GetDocSeeAlso() ); + otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocSeeAlso()) ); otbDocHtmlTitle1Macro( "Example of use" ); if( showKey == true ) @@ -143,7 +144,7 @@ ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::s if( showKey == true ) { otbDocHtmlBodyMacro( "<li>Command line to execute:</li>" ); - otbDocHtmlBodyCodeMacro( app->GetCLExample() ); + otbDocHtmlBodyCodeMacro( otb::StringToHTML(app->GetCLExample()) ); oss << "</ul>"; } @@ -151,8 +152,8 @@ ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::s val = oss.str(); -// Replace "\n" string with <br/> - itksys::SystemTools::ReplaceString( val, "\n", "<br/>"); + // Replace ":\n\n" string with ":\n" (the extra LF is needed because of rst syntax + itksys::SystemTools::ReplaceString( val, ":<br/><br/>", ":<br/>"); } void diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx index d88c5b9d51c611571a6518e0497f8b80ece774f9..59c9448ffd3264ae8cd3f1acbf73b3ca0553e201 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx @@ -19,6 +19,7 @@ */ #include "otbWrapperDocExampleStructure.h" +#include "otbStringToHTML.h" namespace otb { @@ -185,7 +186,7 @@ DocExampleStructure::GenerateHtmlExample( unsigned int exId ) { oss << "<li>"; oss << "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"; - oss << it->first << ": " << it->second; + oss << it->first << ": " << otb::StringToHTML(it->second); oss << "</p>"; oss << "</li>"; } @@ -211,7 +212,7 @@ DocExampleStructure::GenerateHtmlExample() if( m_NbOfExamples>1 ) oss << "<li>"; if( !m_ExampleCommentList[exId].empty() ) - oss << m_ExampleCommentList[exId]; + oss << otb::StringToHTML(m_ExampleCommentList[exId]); oss << this->GenerateHtmlExample( exId ); if( m_NbOfExamples>1 ) oss << "</li>";