parse.m

来自「M2HTML by itself generates an HTML docum」· M 代码 · 共 34 行

M
34
字号
function [tpl, str] = parse(tpl,target,handle,append)%TEMPLATE/PARSE Fill in replacement fields with the class properties%  [TPL, STR] = PARSE(TPL,TARGET,HANDLE) fills in the replacement field%  HANDLE using previously defined variables of template TPL and store%  it in field TARGET. HANDLE can also be a cell array of field names.%  Output is also provided in output STR (content of TARGET).%  [TPL, STR] = PARSE(TPL,TARGET,HANDLE,APPEND) allows to specify if%  TARGET field is reseted before being filled or if new content is%  appended to the previous one.%  Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk>%  $Revision: 1.0 $Date: 2003/05/05 22:19:51 $error(nargchk(3,4,nargin));if nargin == 3	append = 0;endif iscellstr(handle)	for i=1:length(handle)		[tpl, str] = subst(tpl,handle{i});		tpl = set(tpl,'var',target,str);	endelseif ischar(handle)	[tpl, str] = subst(tpl,handle);	if append		tpl = set(tpl,'var',target,[get(tpl,'var',target) str]);	else		tpl = set(tpl,'var',target,str);	endelse	error('[Template] Badly formed handle.');end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?