|
338 | 338 | % Mark the occurrence of “@example” and “@end example” to be able to find
|
339 | 339 | % example blocks after conversion from texi to plain text. Also consider
|
340 | 340 | % indentation, so we can later correctly unindent the example's content.
|
341 |
| - % Note: uses “@example” instead of “$2” to avoid ARM-specific bug #130. |
342 |
| - str = regexprep (str, ... |
343 |
| - '^([ \t]*)(\@example)(.*)$', ... |
344 |
| - [ '$1\@example$3\n', ... % retain original line |
345 |
| - '$1###### EXAMPLE START ######'], ... |
346 |
| - 'lineanchors', 'dotexceptnewline', 'emptymatch'); |
347 |
| - str = regexprep (str, ... |
348 |
| - '^([ \t]*)(\@end example)(.*)$', ... |
349 |
| - [ '$1###### EXAMPLE STOP ######\n', ... |
350 |
| - '$1\@end example$3'], ... % retain original line |
351 |
| - 'lineanchors', 'dotexceptnewline', 'emptymatch'); |
| 341 | + |
| 342 | + % These should work, but I keep hitting ARM-specific when $1 is empty: |
| 343 | + % https://savannah.gnu.org/bugs/index.php?52810 |
| 344 | + %str = regexprep (str, ... |
| 345 | + % '^([ \t]*)(\@example)(.*)$', ... |
| 346 | + % [ '$1$2$3\n', ... % retain original line |
| 347 | + % '$1###### EXAMPLE START ######'], ... |
| 348 | + % 'lineanchors', 'dotexceptnewline', 'emptymatch'); |
| 349 | + %str = regexprep (str, ... |
| 350 | + % '^([ \t]*)(\@end example)(.*)$', ... |
| 351 | + % [ '$1###### EXAMPLE STOP ######\n', ... |
| 352 | + % '$1$2$3'], ... % retain original line |
| 353 | + % 'lineanchors', 'dotexceptnewline', 'emptymatch'); |
| 354 | + |
| 355 | + % Instead we do it manually |
| 356 | + [S, E, TE, M, T, NM, SP] = regexp (str, '^([ \t]*)(\@example)(.*)$', ... |
| 357 | + 'lineanchors', 'dotexceptnewline', 'emptymatch'); |
| 358 | + str = SP{1}; |
| 359 | + for i=1:length (T) |
| 360 | + str = [str ... |
| 361 | + T{i}{:} sprintf('\n') ... % retain original line |
| 362 | + T{i}{1} '###### EXAMPLE START ######' ... |
| 363 | + SP{i+1}]; |
| 364 | + end |
| 365 | + |
| 366 | + [S, E, TE, M, T, NM, SP] = regexp (str, '^([ \t]*)(\@end example)(.*)$', ... |
| 367 | + 'lineanchors', 'dotexceptnewline', 'emptymatch'); |
| 368 | + str = SP{1}; |
| 369 | + for i=1:length (T) |
| 370 | + str = [str ... |
| 371 | + T{i}{1} '###### EXAMPLE STOP ######' sprintf('\n') ... |
| 372 | + T{i}{:} ... % retain original line |
| 373 | + SP{i+1}]; |
| 374 | + end |
352 | 375 |
|
353 | 376 | % special comments "@c doctest: cmd" are translated
|
354 | 377 | % FIXME the expression would also match @@c doctest: ...
|
|
0 commit comments