diff --git a/.gitattributes b/.gitattributes index 22af3f0083d..638f869b83a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1056,6 +1056,8 @@ Manual_tools/src/latex_converter_config/gif/cc_wp.gif -text svneol=unset#unset Manual_tools/src/latex_converter_config/gif/cc_wr.gif -text svneol=unset#unset Manual_tools/src/latex_converter_config/gif/cc_zeta.gif -text svneol=unset#unset Manual_tools/src/mstring.doc -text +Manual_tools/src/regex++.C -text +Manual_tools/src/regex_dictionary.C -text Manual_tools/sty/eps_tabs/cc_Class.eps -text Manual_tools/sty/eps_tabs/cc_Class.pdf -text svneol=unset#unset Manual_tools/sty/eps_tabs/cc_Concept.eps -text diff --git a/Manual_tools/src/Makefile b/Manual_tools/src/Makefile index 09d8848d7af..f0ded647912 100644 --- a/Manual_tools/src/Makefile +++ b/Manual_tools/src/Makefile @@ -136,7 +136,9 @@ OBJHTML = lexer.o \ cpp_formatting.o \ input.o \ output.o \ - cc_extract_html.o + cc_extract_html.o \ + regex++.o \ + regex_dictionary.o OBJIMAGES = cc_extract_images_lexer.C cc_extract_images.o diff --git a/Manual_tools/src/internal_macros.C b/Manual_tools/src/internal_macros.C index 0fcfc4c56ff..6bd6efeadf3 100644 --- a/Manual_tools/src/internal_macros.C +++ b/Manual_tools/src/internal_macros.C @@ -27,6 +27,8 @@ #include #include +#include + #include typedef std::map< string, string, Case_insensitive_string_greater_than > String_map; @@ -1082,9 +1084,9 @@ string // macro handle_chapter( const string&, string param[], size_t n, size_t opt) { NParamCheck( 1, 0); push_current_output(); - string chapter_title( param[0]); - crop_string( chapter_title); - remove_separator( chapter_title); + //string chapter_title( param[0]); + //crop_string( chapter_title); + //remove_separator( chapter_title); string new_main_filename; string new_main_filepath = macroX( "\\lciInputPath"); @@ -1345,6 +1347,32 @@ sorted_map_is_empty( const string&, string param[], size_t n, size_t opt) { } +/* regular expressions */ + + +string +handle_regex_register( const string&, string param[], size_t n, size_t opt) { + NParamCheck( 2, 0); + regex_register( param[0], param[1] ); + return string(); +} + +string +handle_regex_does_match( const string&, string param[], size_t n, size_t opt) { + NParamCheck( 2, 0); + if( regex_does_match( param[0], param[1] ) ) + return string("\\lcTrue"); + else + return string("\\lcFalse"); +} + +string +handle_regex_result( const string&, string param[], size_t n, size_t opt) { + NParamCheck( 1, 0); + unsigned int index = atoi( param[0].c_str() ); + return regex_get_submatch(index); +} + // Initialize // ====================================================================== void init_internal_macros() { @@ -1422,7 +1450,7 @@ void init_internal_macros() { insertInternalGlobalMacro( "\\lciIfFileExists", if_file_exists, 1); insertInternalGlobalMacro( "\\lciCopyFile", copy_file, 2); - insertInternalGlobalMacro( "\\lciChapter", handle_chapter, 1); + insertInternalGlobalMacro( "\\lciChapter", handle_chapter, 0); insertInternalGlobalMacro( "\\lciPopOutput", pop_output, 0); insertInternalGlobalMacro( "\\lciPushOutput", push_output, 1); @@ -1435,6 +1463,10 @@ void init_internal_macros() { insertInternalGlobalMacro( "\\lciIncludeOnly", handle_include_only, 1); insertInternalGlobalMacro( "\\lciIfToBeIncluded", handle_to_be_included, 1); insertInternalGlobalMacro( "\\lciToHtmlWidth", to_html_width, 1); + + insertInternalGlobalMacro( "\\lciRegexRegister", handle_regex_register, 2 ); + insertInternalGlobalMacro( "\\lcRegexDoesMatch", handle_regex_does_match, 2 ); + insertInternalGlobalMacro( "\\lcRegexResult", handle_regex_result, 1 ); } // EOF // diff --git a/Manual_tools/src/latex_converter_config/html/cc_manual.sty b/Manual_tools/src/latex_converter_config/html/cc_manual.sty index 892d723118e..3d513768a6c 100644 --- a/Manual_tools/src/latex_converter_config/html/cc_manual.sty +++ b/Manual_tools/src/latex_converter_config/html/cc_manual.sty @@ -32,7 +32,6 @@ \newcommand{\ccAuto}{\lcAuto} - % ########################################################################### % | % | o @@ -987,6 +986,12 @@ \newcommand{\lciFlushPkgDescription}[2]{% \lciFlushPkgDescriptionX{#X1}{#X2}{\ccValueofPkgName}% } + +\newcommand{\lciCheckForLabelInsideHeadingX}[2]{% + \lciCheckForLabelInsideHeading{#XC1}{#2}{\lciLocalVariableLabel}% + \lciLocalVariableLabel% +} + \newcommand{\lciFlushPkgDescriptionX}[3]{% \lciIfEmpty{#X3}{}{% \lciIfEmpty{\lciCurrentPartName}{}{% @@ -994,24 +999,20 @@ \gdef\lciCurrentPartName{}% }% \lciPushOutput{description}% - \lcRawHtml{

}\ccValueofPkgName\lcRawHtml{

} - \lcRawHtml{} + %\lcRawHtml{
} + \lcRawHtml{
}% + \lciCheckForLabelInsideHeadingX{\ccValueofPkgName}{\lciCurrentPackageName}% + \lcRawHtml{

}\lciCurrentPackageName\lcRawHtml{

} + \lcRawHtml{
} \ccValueofPkgSummary - %\lcRawHtml{} - \lcRawHtml{} + \lcRawHtml{} + \lcRawHtml{} \ccValueofPkgMaturity \ccValueofPkgDependsOn \ccValueofPkgLicense \lcRawHtml{User Manual   Reference Manual} - \lcRawHtml{
} + \lcRawHtml{} + %\lcRawHtml{} \lciPopOutput% \gdef\ccValueofPkgName{}% %\lciPkgDescriptionIsOddEntry @@ -1052,6 +1053,7 @@ \lciSortedMapClear{TocReferenceLinks} } } + % ___________________________________________________________________________ % ########################################################################### % | EOF diff --git a/Manual_tools/src/latex_converter_config/html/latex.sty b/Manual_tools/src/latex_converter_config/html/latex.sty index 3fd9c863ab8..37da9211e31 100644 --- a/Manual_tools/src/latex_converter_config/html/latex.sty +++ b/Manual_tools/src/latex_converter_config/html/latex.sty @@ -70,8 +70,7 @@ l% ___________________________________________________________________________ % |#########################################################################| -% Load latex_to_html.sty that provides the basic converter capabilities. -% redefined in latex_to_html.sty + \newcommand{\lcFalse}[2]{#2} \newcommand{\lcTrue}[2]{#1} @@ -95,6 +94,37 @@ l% ___________________________________________________________________________ \newcommand{\lcStyleFile}[1]{\lciInputStyleFile{\lciConfigPath}{#XC1}} \newcommand{\lciInputStyleFile}[2]{\lciInclude{#XC1#C2.sty}} } + +% ___________________________________________________________________________ +% ########################################################################### +% | Regular Expressions +% ########################################################################### + + +\newcommand{\lcRegexRegister}[1]{% + \def\lciRegexNameToBeRegistered{#1}% + \lciParseUntilDelimiter{\lciRegexRegisterX}} + +\newcommand{\lciRegexRegisterX}[1]{\lciRegexRegisterXX{\lciRegexNameToBeRegistered}{#1}} +\newcommand{\lciRegexRegisterXX}[2]{\lciRegexRegister{#XC1}{#C2}} + +\lcRegexRegister{checkforlabel}@(.+)(\\label[^\}]+\})(.*)@ + + +\newcommand{\lciCheckForLabelInsideHeading}[3]{% + \lcRegexDoesMatch{checkforlabel}{#1}{% + % xdef doesnt work, either .. + \gdef#2{\lcRegexResult{1}\lcRegexResult{3}}% + \gdef#3{\lcRegexResult{2}} + }{% + \gdef#2{#1}% + \gdef#3{}% + }% +}% + + +% Load latex_to_html.sty that provides the basic converter capabilities. +% redefined in latex_to_html.sty \lcStyleFile{latex_to_html} % print own release number @@ -196,6 +226,7 @@ l% ___________________________________________________________________________ \lciHtmlFileHeader{Package Description}% \lciHtmlNavigationTop \lcRawHtml{

Package Description

} + \lcRawHtml{} \lciPopOutput% }{% % print remaining footnotes at the end of the conversion @@ -211,6 +242,7 @@ l% ___________________________________________________________________________ \lciOpenTmpFile{\lciIndexHeader}\lciIndexFileHeader\lciCloseFile \lciOpenTmpFile{\lciIndexFooter}\lciIndexFileFooter\lciCloseFile \lciPushOutput{description}% + \lcRawHtml{
} \lciHtmlNavigationBottom \lciHtmlFileFooter% \lciPopOutput% @@ -1087,14 +1119,18 @@ l% ___________________________________________________________________________ \gdef{\lciIfHtmlLinks}{\lcTrue}% \gdef{\lciIfHtmlIndex}{\lcTrue}% \refstepcounter{chapter}% - \lciChapter{#1}% does also a PushOutput + + \lciCheckForLabelInsideHeading{#1}% + {\lciLocalVariableChapterNameTOC}% + {\lciLocalVariableLabel}% + \lciChapter% does also a PushOutput % cross linking rules \lciPushOutput{anchor}% \lcRawHtml{i Next_chapter_link_}\value{part}\_\value{chapter}% \lcRawHtml{