Last change
on this file since 4 was
4,
checked in by zhangj, 10 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
1.2 KB
|
Line | |
---|
1 | function str = finish(str,unknowns) |
---|
2 | %TEMPLATE/FINISH Apply given strategy to unknown fields in a string |
---|
3 | % STR = FINISH(STR,UNKNOWNS) applies on string STR the strategy defined |
---|
4 | % in UNKNOWNS to unknowns fields '{UNKNOWNS_FIELDS}'. |
---|
5 | % UNKNOWNS may be: |
---|
6 | % * 'keep' to do nothing |
---|
7 | % * 'remove' to remove all undefined fields |
---|
8 | % * 'comment' to replace undefined fields by a warning HTML comment. |
---|
9 | % This function uses Matlab REGEXPREP function coming with R13. If you |
---|
10 | % hold an older version, please comment lines 38 and 42: then you can |
---|
11 | % only apply the 'keep' strategy. |
---|
12 | |
---|
13 | % Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk> |
---|
14 | % $Revision: 1.0 $Date: 2003/05/05 22:19:51 $ |
---|
15 | |
---|
16 | error(nargchk(2,2,nargin)); |
---|
17 | |
---|
18 | switch lower(unknowns) |
---|
19 | case 'keep' |
---|
20 | %- do nothing |
---|
21 | case 'remove' |
---|
22 | %%%%%%%%%%%%%%%%%%%%%%%% WIH REGEXP ONLY %%%%%%%%%%%%%%%%%%%% |
---|
23 | % str = regexprep(str,'{[^ \t\r\n}]+}',''); |
---|
24 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
25 | case 'comment' |
---|
26 | %%%%%%%%%%%%%%%%%%%%%%%% WIH REGEXP ONLY %%%%%%%%%%%%%%%%%%%% |
---|
27 | % str = regexprep(str,'{[^ \t\r\n}]+}','<!-- Template variable undefined -->'); |
---|
28 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
29 | otherwise |
---|
30 | error('[Template] Unknown action.'); |
---|
31 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.