src/basis/template.js
function resolveResource(ref, baseURI){
    // ref ~ "#123"
    if (/^#\d+$/.test(ref))
      return templateList[ref.substr(1)];

    // ref ~ "id:foo"
    if (/^id:/.test(ref))
      return resolveSourceByDocumentId(ref.substr(3));

    // ref ~ "foo.bar.baz"
    if (/^[a-z0-9\.]+$/i.test(ref) && !/\.tmpl$/.test(ref))
      return getSourceByPath(ref);

    // ref ~ "./path/to/file.tmpl"
    return basis.resource(basis.resource.resolveURI(ref, baseURI, '<b:include src=\"{url}\"/>'));
  }
function resolveResource(ref, baseURI){
    // ref ~ "#123"
    if (/^#\d+$/.test(ref))
      return templateList[ref.substr(1)];

    // ref ~ "id:foo"
    if (/^id:/.test(ref))
      return resolveSourceByDocumentId(ref.substr(3));

    // ref ~ "foo.bar.baz"
    if (/^[a-z0-9\.]+$/i.test(ref) && !/\.tmpl$/.test(ref))
      return getSourceByPath(ref);

    // ref ~ "./path/to/file.tmpl"
    return basis.resource(basis.resource.resolveURI(ref, baseURI, '<b:include src=\"{url}\"/>'));
  }
function resolveResource ( ref , baseURI ) { // ref ~ "#123" if ( / ^#\d+$ / . test ( ref ) ) return templateList [ ref . substr ( 1 ) ] ; // ref ~ "id:foo" if ( / ^id: / . test ( ref ) ) return resolveSourceByDocumentId ( ref . substr ( 3 ) ) ; // ref ~ "foo.bar.baz" if ( / ^[a-z0-9\.]+$ / i . test ( ref ) && ! / \.tmpl$ / . test ( ref ) ) return getSourceByPath ( ref ) ; // ref ~ "./path/to/file.tmpl" return basis . resource ( basis . resource . resolveURI ( ref , baseURI , '<b:include src=\"{url}\"/>' ) ) ; }
Resolve source by given reference.
@param {string} ref
@param {string=} baseURI
Resolve source by given reference .