mirror of https://github.com/CGAL/cgal
bugfix: [cccbegin]someclass<K,bla>[cccend] can now be matched
new feature: \ref[text]{\somelabel} will produce to an html-link with "text"
being the link text, and somelabel as the link target. if no text is given,
the default is to show an image with an up-arrow
This commit is contained in:
parent
4e08ca1821
commit
62d97773d3
|
|
@ -91,7 +91,10 @@ int linknesting;
|
|||
|
||||
Dictionary dict_labels, dict_bib, dict_anchormode_bib, dict_cc, dict_internal;
|
||||
|
||||
string output_path;
|
||||
const string reference_icon = "<IMG SRC=\"cc_ref_up_arrow.gif\" "
|
||||
"ALT=\"reference\" WIDTH=\"10\" HEIGHT=\"10\">";
|
||||
|
||||
string output_path, reftext;
|
||||
ofstream output_file;
|
||||
|
||||
bool
|
||||
|
|
@ -190,7 +193,7 @@ CCletter [a-zA-Z_]
|
|||
LT "<"
|
||||
GT ">"
|
||||
CCidfier ({CCletter}({CCletter}|{digit})*)
|
||||
CCidfier1 {CCidfier}({CCidfier}|[ ]?({LT}[ ]?)+{CCidfier}|([ ]?{GT})*[ ]?"::"[ ]?{CCidfier}|{CCidfier}[ ]?","[ ]?{CCidfier})*([ ]?{GT})*
|
||||
CCidfier1 {CCidfier}({CCidfier}|[ ]?({LT}[ ]?)+{CCidfier}|([ ]?{GT})*[ ]?"::"[ ]?{CCidfier}|[ ]?[,][ ]?{CCidfier})*([ ]?{GT})*
|
||||
ws [ \t\n\r]*
|
||||
par {ws}("<"[pP]">"{ws})*
|
||||
glue {ws}("<"[pP]">"{ws})*"<!GLUE>"{ws}("<"[pP]">"{ws})*
|
||||
|
|
@ -261,14 +264,25 @@ cccend "[cccend]"
|
|||
"<"[^ \t\n\r] { BEGIN(ANCHORMODE); ECHO; }
|
||||
<ANCHORMODE>[^>]*[>] { BEGIN(INITIAL); ECHO; }
|
||||
|
||||
[\[]reftext[:][^\]]+[\]] {
|
||||
yytext [ yyleng - 1 ] = '\0'; // cut off trailing ]
|
||||
reftext = string(yytext + 9); // skip \reftext:
|
||||
}
|
||||
|
||||
[\[]ref[:][^\]]+[\]] {
|
||||
yytext [ yyleng - 1 ] = '\0'; // cut off trailing ]
|
||||
const char *my_yytext = yytext + 5; // skip [ref:"
|
||||
if( dict_labels.is_defined( my_yytext ) ) {
|
||||
//cerr << " !! label [" << my_yytext << "] is defined as [" << dict_labels[ my_yytext ] << endl;
|
||||
output_file << dict_labels[ my_yytext ];
|
||||
output_file << "<A HREF=\"" << dict_labels[ my_yytext ] << "\">";
|
||||
if( reftext != string() )
|
||||
output_file << reftext;
|
||||
else
|
||||
output_file << reference_icon;
|
||||
output_file << "</A>";
|
||||
} else
|
||||
cerr << " !! Warning: undefined label \"" << my_yytext << "\"" << endl;
|
||||
reftext = string();
|
||||
}
|
||||
|
||||
[\[]internal[:][^\]]+[\]] {
|
||||
|
|
@ -279,16 +293,9 @@ cccend "[cccend]"
|
|||
output_file << dict_internal[ my_yytext ];
|
||||
}
|
||||
|
||||
<CROSSLINKMODE>{CCidfier1} {
|
||||
/*stringstream s_stream;
|
||||
|
||||
// remove all spaces
|
||||
for( const char *s = yytext; *s != '\0'; ++s )
|
||||
if( *s != ' ' && *s != '\n' && *s != '\r' && *s != '\t')
|
||||
s_stream << *s;*/
|
||||
|
||||
//match_cc_idfier( s_stream.str() );
|
||||
match_cc_idfier( yytext, &output_file );
|
||||
<CROSSLINKMODE>{CCidfier1} {
|
||||
//output_file << "matched [" << yytext << "] as ccidfieR" << std::endl;
|
||||
match_cc_idfier( yytext, &output_file );
|
||||
}
|
||||
<CROSSLINKMODE>[<][^>]+[>] { ECHO; } // do not crosslink inside html tags
|
||||
<CROSSLINKMODE>. { ECHO; }
|
||||
|
|
|
|||
|
|
@ -38,12 +38,6 @@ using namespace std;
|
|||
const string prog_name = "cc_extract_html";
|
||||
const string prog_release = "$Id$";
|
||||
|
||||
|
||||
/* Constant string used for referencing. */
|
||||
/* ===================================== */
|
||||
const string reference_icon = "<IMG SRC=\"cc_ref_up_arrow.gif\" "
|
||||
"ALT=\"reference\" WIDTH=\"10\" HEIGHT=\"10\">";
|
||||
|
||||
/* Configurable command line options */
|
||||
/* ================================= */
|
||||
Switch V_switch = NO_SWITCH;
|
||||
|
|
@ -81,7 +75,6 @@ void init_commandline_args() {
|
|||
insertInternalGlobalMacro( "\\lciConfigPath", config_path);
|
||||
insertInternalGlobalMacro( "\\lciTmpPath", tmp_path);
|
||||
insertInternalGlobalMacro( "\\lciExtractHtmlRelease", prog_release);
|
||||
insertInternalGlobalMacro( "\\lciReferenceIcon", reference_icon);
|
||||
insertInternalGlobalMacro( "\\lciManualDate", manual_date);
|
||||
// check for date format as provided by latex_to_html
|
||||
if ( std::count( manual_date.begin(), manual_date.end(), ',') == 2) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ extern Switch onlyheader_switch;
|
|||
|
||||
extern const string prog_name;
|
||||
extern const string prog_release;
|
||||
extern const string reference_icon;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1743,13 +1743,15 @@
|
|||
\newcommand{\ref}[1]{\lcAsciiToHtml{[ref:#1]}}
|
||||
\newcommand{\pageref}[1]{\lcAsciiToHtml{[ref:#1]}}
|
||||
|
||||
\newcommand{\ref@om}{\lcAsciiToHtml{[reftext:#1][ref:#2]}}
|
||||
|
||||
\newcommand{\label}[1]{\lcRawHtml{<A NAME="#C1"></A>}%
|
||||
\edef\lciOut{\lciOutputBasename}%
|
||||
\edef\lciOutPath{\lciReplaceWithCurrentPathToken}%
|
||||
\lciPushOutput{anchor}%
|
||||
\lciLabel{#1}{\lciOutPath}{\lciOut}{\lciReferenceIcon}\lciPopOutput}
|
||||
\lciLabel{#1}{\lciOutPath}{\lciOut}\lciPopOutput}
|
||||
|
||||
\newcommand{\lciLabel}[4]{\lciRawOutput{l #C1 <A HREF="#XC2#XC3###C1">#X4</A>
|
||||
\newcommand{\lciLabel}[3]{\lciRawOutput{l #C1 #XC2#XC3###C1
|
||||
}}
|
||||
|
||||
% +--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@ done
|
|||
|
||||
# Cleanup
|
||||
# -------
|
||||
if [ $KeepTmp -eq 0 ]; then
|
||||
if [ $KeepTmp -eq 0 ]; then
|
||||
\rm -r ${TmpDir}
|
||||
else
|
||||
echo "NOTE: The tmp directory '${TmpDir}' was kept." 1>&2
|
||||
|
|
|
|||
Loading…
Reference in New Issue