Пример #1
0
  /**
   * Generate a URL for a reference to a binding.
   *
   * @param nb the referenced binding
   * @param path the path containing the reference, or null if there was an error
   */
  private String toURL(NBinding nb, String path) {
    Def def = nb.getSignatureNode();
    if (def == null) {
      return null;
    }
    if (nb.isBuiltin()) {
      return def.getURL();
    }

    if (def.isModule()) {
      return toModuleUrl(nb);
    }

    String anchor = "#" + nb.getQname();
    if (nb.getFirstFile().equals(path)) {
      return anchor;
    }

    String destPath = def.getFile();
    try {
      String relpath = destPath.substring(rootPath.length());
      return Util.joinPath(outDir.getAbsolutePath(), relpath) + ".html" + anchor;
    } catch (Exception x) {
      System.err.println("path problem:  dest=" + destPath + ", root=" + rootPath + ": " + x);
      return null;
    }
  }