TODO: Is there a computationally inexpensive way to see if anything links here (without full page tree traversal?)
774959
@Override
	public boolean isApplicable(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException {
		return true;
	}
259329
public Map<Integer, String> getPageLinks() {

        Map<Integer, String> links = new TreeMap<Integer, String>();
        if (m_pageCount <= 1) {
            return links;
        }
        int startIndex, endIndex;
        String link = m_cms.getRequestContext().getUri() + m_parameters.toQueryString() + "&searchPage=";
        if (getDisplayPages() < 1) {
            // number of displayed pages not limited, build a map with all available page links
            startIndex = 1;
            endIndex = m_pageCount;
        } else {
            // limited number of displayed pages, calculate page range
            int currentPage = getSearchPage();
            int countBeforeCurrent = getDisplayPages() / 2;
            int countAfterCurrent;
            if ((currentPage - countBeforeCurrent) < 1) {
                // set count before to number of available pages
                countBeforeCurrent = currentPage - 1;
            }
            // set count after to number of remaining pages (- 1 for current page)
            countAfterCurrent = getDisplayPages() - countBeforeCurrent - 1;
            // calculate start and end index
            startIndex = currentPage - countBeforeCurrent;
            endIndex = currentPage + countAfterCurrent;
            // check end index
            if (endIndex > m_pageCount) {
                int delta = endIndex - m_pageCount;
                // decrease start index with delta to get the right number of displayed pages
                startIndex -= delta;
                // check start index to avoid values < 1
                if (startIndex < 1) {
                    startIndex = 1;
                }
                endIndex = m_pageCount;
            }
        }

        // build the sorted tree map of page links
        for (int i = startIndex; i <= endIndex; i++) {
            links.put(new Integer(i), (link + i));
        }
        return links;
    }
6535
function SymbolicLinkFinder(options) {
  this.scanDirs = options && options.scanDirs || ['.'];
  this.extensions = options && options.extensions || ['.js'];
  this.ignore = options && options.ignore || null;
}
910068
def links(self):
        
        ass = self.xpath('//a')
        for a in ass:
            text = a.xpath('./text()').extract_first()
            url = a.xpath('./@href').extract_first()
            link = Link(text, url)
            yield link
230785
function scrapeHtml(document, robots)
{
	var link,links,preliminaries,rootNode;
	
	rootNode = findRootNode(document);
	
	if (rootNode != null)
	{
		preliminaries = findPreliminaries(rootNode, robots);
		links = [];
		
		findLinks(rootNode, function(node, attrName, url)
		{
			link = linkObj(url);

			link.html.attrs = node.attrMap;
			link.html.attrName = attrName;
			link.html.base = preliminaries.base;
			link.html.index = links.length;
			link.html.selector = getSelector(node);
			link.html.tag = stringifyNode(node);
			link.html.tagName = node.nodeName;
			link.html.text = getText(node);

			// If not a "fake" (duplicated) element, as a result of adoption
			if (node.__location !== undefined)
			{
				link.html.location = node.__location.attrs[attrName];
			}
			
			links.push(link);
		});
	}
	
	return links;
}
625745
def get_collection_tree(collection_ident, cursor):
    """"""
    cursor.execute('''
    WITH RECURSIVE t(node, parent, document, path) AS (
        SELECT tr.nodeid, tr.parent_id, tr.documentid, ARRAY[tr.nodeid]
        FROM trees tr
        WHERE tr.documentid = %s and tr.is_collated = 'False'
    UNION ALL
        SELECT c.nodeid, c.parent_id, c.documentid, path || ARRAY[c.nodeid]
        FROM trees c JOIN t ON c.parent_id = t.node
        WHERE NOT c.nodeid = ANY(t.path)
    )
    SELECT t.document, m.portal_type
    FROM t JOIN modules m
    ON t.document = m.module_ident''', [collection_ident])
    for i in cursor.fetchall():
        yield i
330138
def _get_links(self,):
        
        res = ''
        if self.links:
            for l in self.links:
                res += ' links = ' + str(l[0]) + '\n'
                if l[0].child_nodes:
                    for chld in l[0].child_nodes:
                        res += '   child = ' + str(chld) + '\n'
                if l[0].links:
                    for lnk in l[0].links:
                        res += '   sublink = ' + str(lnk[0]) + '\n'
        else:
            res += ' links = None\n'
            
        return res
1223161
function at_link() {
  match(/\{@link/)
  skip_horiz_white();

  var linkText = strip(match(/.*?\}/)).replace(/\s*@link\s*/, "").slice(0,-1); 

  if (/^https?/.test(linkText)) {
    var anchor = linkText.split(/\s+/);
    var link = anchor.shift();
    current_tag["doc"] = current_tag["doc"].slice(0,-1) + 
                         "[" + anchor.join(" ") + "]" +
                         "(" + link + ")";
  }
  else { // sugar this into panino style [[ ]] link block
    current_tag["doc"] = current_tag["doc"].slice(0,-1) + 
                         "[[" + 
                         linkText
                         + "]] ";
  }

  skip_white();
}
1315807
function(elm) {
			var index = -1;
			var parts = [];
			function hasid(elm) {
				if (elm.id) {
					try {
						gui.DOMPlugin.q(elm.parentNode, elm.id);
						return true;
					} catch (malformedexception) {}
				}
				return false;
			}
			while (elm && elm.nodeType === Node.ELEMENT_NODE) {
				if (hasid(elm)) {
					parts.push("#" + elm.id);
					elm = null;
				} else {
					if (elm.localName === "body") {
						parts.push("body");
						elm = null;
					} else {
						index = gui.DOMPlugin.ordinal(elm) + 1;
						parts.push(">" + elm.localName + ":nth-child(" + index + ")");
						elm = elm.parentNode;
					}
				}
			}
			return parts.reverse().join("");
		}
379375
function searchLinks() {
    var filter, map;
    filter = Array.prototype.filter;
    map = Array.prototype.map;
    return map.call(filter.call(document.querySelectorAll("a"), function(a) {
        return (/^http:\/\/.*/i).test(a.getAttribute("href"));
    }), function(a) {
        return a.getAttribute("href");
    });
}
600248
function findRelative( url ){

    var dirName =       path.dirname( url );
    var baseName =      path.basename( url );
    var entries;

    if ( !fs.existsSync( dirName )){
        entries =       [];
    } else {
        entries =       fs.readdirSync( dirName ).filter( matches );
    }

    return entries.map( fsUtils.getFullPath( dirName ));

    /// Return true if entry === baseName.extension
    function matches( entry ){

        var len =       baseName.length;
        return entry[len] === "." && !entry.indexOf( baseName ) && entry.slice( len + 1 ).indexOf( "." ) === -1;
    }///
}
434597
function traverseToParentIf(node) {
  let parent = node.parent;
  while (parent) {
    if (parent.type === 'IfStatement') {
      return parent;
    }
    parent = parent.parent;
  }
}
640972
function traverse(node, callback) {
    callback(node);
    for (var i = 0, cn = node.childNodes, len = cn.length; i < len; i++) {
        var childNode = cn[i];
        if (childNode.tagName) {
            traverse(childNode, callback);
        }
    }
}
94577
def view_links(obj):
    ''' '''
    result=format_html('')
    result+=format_html('<a href="%s" style="white-space: nowrap">Show duplicates</a><br/>'%reverse('duplicates', args=(obj.pk,)))
    result+=format_html('<a href="%s" style="white-space: nowrap">Show submissions</a><br/>'%obj.grading_url())
    result+=format_html('<a href="%s" style="white-space: nowrap">Download submissions</a>'%reverse('assarchive', args=(obj.pk,)))
    return result
529786
def should_see_link(self, link_url):
    """"""

    elements = ElementSelector(
        world.browser,
        str('//a[@href="%s"]' % link_url),
        filter_displayed=True,
    )
    if not elements:
        raise AssertionError("Expected link not found.")
418615
private static boolean traverseTree(PointerTargetTree syn, PointerTargetNodeList ptnl, Synset source) {
        java.util.List MGListsList = syn.toList();
        for (Object aMGListsList : MGListsList) {
            PointerTargetNodeList MGList = (PointerTargetNodeList) aMGListsList;
            for (Object aMGList : MGList) {
                Synset toAdd = ((PointerTargetNode) aMGList).getSynset();
                if (toAdd.equals(source)) {
                    return true;
                }
            }
        }
        for (Object aPtnl : ptnl) {
            Synset toAdd = ((PointerTargetNode) aPtnl).getSynset();
            if (toAdd.equals(source)) {
                return true;
            }
        }
        return false;
    }
73397
function _getLinks(nodes) {
  var links = [],
      nodeHash;

  nodeHash = nodes.reduce(function (obj, node) {
    obj[node.id] = node;
    return obj;
  }, {});

  _data.links.forEach(function (link) {
    var source = nodeHash[link.sourceId],
        target = nodeHash[link.targetId];
    if(source && target) {
      link.setProperties({
        source: source,
        target: target,
        isBackwardLink: source.isSelfOrAncestor(target)
      });
      links.push(link);
    }
  });

  return links;
}