Rev 7076 | Rev 13310 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7076 | Rev 8796 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | itex2MML 1.3.3 |
2 | itex2MML 1.3.3 |
3 | renamed to "wims_mathml" |
3 | renamed to "wims_mathml" |
4 | Slightly modified for WIMS mathml usage 05/2012 |
4 | Slightly modified for WIMS mathml usage 05/2012 |
5 | J.M. Evers, B. Perrin-Riou |
5 | J.M. Evers, B. Perrin-Riou |
6 | |
6 | |
7 | */ |
7 | */ |
8 | 8 | ||
9 | #include <cstdio> |
9 | #include <cstdio> |
10 | #include <string> |
10 | #include <string> |
11 | #include "wims_mathml.h" |
11 | #include "wims_mathml.h" |
12 | 12 | ||
13 | // these C headers are needed to compile on OpenSuSE Linux (and others?) to use atoi/strlen |
13 | // these C headers are needed to compile on OpenSuSE Linux (and others?) to use atoi/strlen |
14 | #include <string.h> |
14 | #include <string.h> |
15 | #include <stdlib.h> |
15 | #include <stdlib.h> |
16 | #include <sys/time.h> |
16 | #include <sys/time.h> |
Line 29... | Line 29... | ||
29 | return 0; |
29 | return 0; |
30 | } |
30 | } |
31 | } |
31 | } |
32 | const char * read_mathml_id(){ |
32 | const char * read_mathml_id(){ |
33 | return wims_mathml_id; // wims_mathml.y will use this in first <mstyle id="read_mathml_id()" ... |
33 | return wims_mathml_id; // wims_mathml.y will use this in first <mstyle id="read_mathml_id()" ... |
34 | // the whole mathml-string will get this "id" ; does not interfere (?) with "maction" tag, which is on "sub math level" |
34 | // the whole mathml-string will get this "id" ; does not interfere (?) with "maction" tag, which is on "sub math level" |
35 | } |
35 | } |
36 | 36 | ||
37 | const char * read_fontsize(){ // declared in wims_mathml.h |
37 | const char * read_fontsize(){ // declared in wims_mathml.h |
38 | // in not given : mathsize="110%" |
38 | // in not given : mathsize="110%" |
39 | if(strlen(wims_texfontsize) == 0){snprintf(wims_texfontsize,sizeof(wims_texfontsize),"%s","110%");} |
39 | if(strlen(wims_texfontsize) == 0){snprintf(wims_texfontsize,sizeof(wims_texfontsize),"%s","110%");} |
40 | return wims_texfontsize; // wims_mathml.y will use this in first <mstyle mathsize="read_fontsize()" ... |
40 | return wims_texfontsize; // wims_mathml.y will use this in first <mstyle mathsize="read_fontsize()" ... |
41 | } |
41 | } |
42 | // count number of substring occurences |
42 | // count number of substring occurences |
43 | int count_substrings( const std::string & str , const std::string & obj ) { |
43 | int count_substrings( const std::string & str , const std::string & obj ) { |
44 | int n = 0; |
44 | int n = 0; |
45 | std::string ::size_type position = 0; |
45 | std::string ::size_type position = 0; |
46 | while( (position = obj.find( str, position )) != std::string::npos ){ |
46 | while( (position = obj.find( str, position )) != std::string::npos ){ |
47 | n++; |
47 | n++; |
Line 137... | Line 137... | ||
137 | bPrintItex = false; |
137 | bPrintItex = false; |
138 | bInline = false; |
138 | bInline = false; |
139 | bDisplay = false; |
139 | bDisplay = false; |
140 | continue; |
140 | continue; |
141 | } |
141 | } |
142 | // wims |
142 | // wims |
143 | if (args == "--use-zoom"){ |
143 | if (args == "--use-zoom"){ |
144 | use_javascript = atoi( argv[arg+1] ); |
144 | use_javascript = atoi( argv[arg+1] ); |
145 | continue; |
145 | continue; |
146 | } |
146 | } |
147 | if (args == "--tex-size"){ |
147 | if (args == "--tex-size"){ |
Line 203... | Line 203... | ||
203 | } |
203 | } |
204 | } |
204 | } |
205 | } |
205 | } |
206 | 206 | ||
207 | // finish the math mode with appropriate $-signs |
207 | // finish the math mode with appropriate $-signs |
208 | if( dollarcnt > 2 ){ |
208 | if( dollarcnt > 2 ){ |
209 | bDisplay = true; // use display mode |
209 | bDisplay = true; // use display mode |
210 | itex="$$" + itex; |
210 | itex="$$" + itex; |
211 | itex+="$$"; |
211 | itex+="$$"; |
212 | } |
212 | } |
213 | else |
213 | else |