Mercurial > hg > ltpda
view m-toolbox/html_help/help/read_item.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line source
function read_item(ch, fd) % Reads each item in the TOC and makes a nested html list. % % M Hewitson 24-07-07 % % $Id: read_item.m,v 1.2 2007/08/14 09:23:01 ingo Exp $ % children = ch.getChildNodes; % Go through children of AO object for j=1:children.getLength ch = children.item(j-1); if ch.getNodeType ~= ch.COMMENT_NODE childs = ch.getChildNodes; nodeName = char(ch.getNodeName); txtcon = deblank(char(ch.getTextContent)); if childs.getLength >= 1 fprintf(fd, '<ul>\n'); read_item(ch, fd); fprintf(fd, '</ul>\n'); elseif ~isempty(txtcon) % check if this node has a target attribute p = ch.getParentNode; att = p.getAttributes; if ~isempty(att) target = deblank(char(att.getNamedItem('target'))); if ~isempty(target) fprintf(fd, '<li><a %s>%s</a></li>\n', strrep(target, 'target', 'href'), txtcon); else fprintf(fd, '<li>%s</li>\n', txtcon); end else fprintf(fd, '<li>%s</li>\n', txtcon); end else end end end