Rev 8863 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8863 | Rev 11124 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | old=p; if(*old=='<') old++; |
69 | old=p; if(*old=='<') old++; |
70 | pp=strchr(old,'>'); |
70 | pp=strchr(old,'>'); |
71 | if(pp==NULL) pp=strchr(old,'<'); |
71 | if(pp==NULL) pp=strchr(old,'<'); |
72 | if(pp==NULL) pp=find_word_end(find_word_start(old)); |
72 | if(pp==NULL) pp=find_word_end(find_word_start(old)); |
73 | } |
73 | } |
74 | if(*pp=='>') pp++ |
74 | if(*pp=='>') pp++; |
- | 75 | return pp; |
|
75 | } |
76 | } |
76 | 77 | ||
77 | char *find_tag(char *p, char *tag) |
78 | char *find_tag(char *p, char *tag) |
78 | { |
79 | { |
79 | char *pp; |
80 | char *pp; |
Line 112... | Line 113... | ||
112 | f=fopen(fn1,"r"); if(f==NULL) return; |
113 | f=fopen(fn1,"r"); if(f==NULL) return; |
113 | fseek(f,0,SEEK_END);flen=ftell(f); fseek(f,0,SEEK_SET); |
114 | fseek(f,0,SEEK_END);flen=ftell(f); fseek(f,0,SEEK_SET); |
114 | if(flen>buflim) return; |
115 | if(flen>buflim) return; |
115 | filebuf=xmalloc(2*flen+1024);flen=fread(filebuf,1,flen,f); |
116 | filebuf=xmalloc(2*flen+1024);flen=fread(filebuf,1,flen,f); |
116 | fclose(f); |
117 | fclose(f); |
117 | if(flen<0 || flen>=buflim) flen |
118 | if(flen<0 || flen>=buflim) flen=0; |
- | 119 | filebuf[flen]=0; |
|
118 | filelen=flen; |
120 | filelen=flen; |
119 | outf=fopen(fn2,"w"); if(outf==NULL) return; |
121 | outf=fopen(fn2,"w"); if(outf==NULL) return; |
120 | } |
122 | } |
121 | 123 | ||
122 | void getmath(char *p) |
124 | void getmath(char *p) |
Line 131... | Line 133... | ||
131 | pt=strchr(pt,'}')+1; |
133 | pt=strchr(pt,'}')+1; |
132 | pv=strstr(pt,"\\end{displaymath}"); |
134 | pv=strstr(pt,"\\end{displaymath}"); |
133 | if(pv==NULL) return; |
135 | if(pv==NULL) return; |
134 | goto insmath; |
136 | goto insmath; |
135 | } |
137 | } |
136 | if(*pt=='%') pt=strchr(pt,'$') |
138 | if(*pt=='%') pt=strchr(pt,'$'); |
- | 139 | if(pt==NULL) return; |
|
- | 140 | if(*pt!='$') return; |
|
137 |
|
141 | do pt++; while(*pt=='$'); |
138 | pv=strchr(pt,'$'); if(pv==NULL) return; |
142 | pv=strchr(pt,'$'); if(pv==NULL) return; |
139 | insmath: if(pv-pt>=MAX_LINELEN-256) return; |
143 | insmath: if(pv-pt>=MAX_LINELEN-256) return; |
140 | memmove(mathbuf,pt,pv-pt); mathbuf[pv-pt]=0; |
144 | memmove(mathbuf,pt,pv-pt); mathbuf[pv-pt]=0; |
141 | if(strstr(mathbuf,"...\n...")!=NULL) { |
145 | if(strstr(mathbuf,"...\n...")!=NULL) { |
142 | ovlstrcpy(mathbuf,"......"); return; |
146 | ovlstrcpy(mathbuf,"......"); return; |