/itexToMML

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/itexToMML/

« back to all changes in this revision

Viewing changes to itex-src/itex2MML.y

  • Committer: Jacques Distler
  • Date: 2013-12-08 07:03:50 UTC
  • Revision ID: distler@golem.ph.utexas.edu-20131208070350-bct56zppnyuou2jd
itex2MML 1.5.0beta

Embed equation source as an <annotation> in the
MathML output.

Show diffs side-by-side

added added

removed removed

1
 
/*             itex2MML 1.4.8
2
 
 *   itex2MML.y last modified 9/21/2011
 
1
/*             itex2MML 1.5.0
 
2
 *   itex2MML.y last modified 12/8/2013
3
3
 */
4
4
 
5
5
%{
296
296
| STARTDMATH ENDMATH {/* ditto */}
297
297
| STARTMATH compoundTermList ENDMATH {
298
298
  char ** r = (char **) ret_str;
299
 
  char * s = itex2MML_copy3("<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'>", $2, "</math>");
300
 
  itex2MML_free_string($2);
 
299
  char * p = itex2MML_copy3("<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><semantics><mrow>", $2, "</mrow><annotation encoding='application/x-tex'>");
 
300
  char * s = itex2MML_copy3(p, $3, "</annotation></semantics></math>");
 
301
  itex2MML_free_string(p);
 
302
  itex2MML_free_string($2);  
 
303
  itex2MML_free_string($3);
301
304
  if (r) {
302
305
    (*r) = (s == itex2MML_empty_string) ? 0 : s;
303
306
  }
309
312
}
310
313
| STARTDMATH compoundTermList ENDMATH {
311
314
  char ** r = (char **) ret_str;
312
 
  char * s = itex2MML_copy3("<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>", $2, "</math>");
313
 
  itex2MML_free_string($2);
 
315
  char * p = itex2MML_copy3("<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><semantics><mrow>", $2, "</mrow><annotation encoding='application/x-tex'>");
 
316
  char * s = itex2MML_copy3(p, $3, "</annotation></semantics></math>");
 
317
  itex2MML_free_string(p);
 
318
  itex2MML_free_string($2);  
 
319
  itex2MML_free_string($3);
314
320
  if (r) {
315
321
    (*r) = (s == itex2MML_empty_string) ? 0 : s;
316
322
  }