Initialize the page-links component
@param  {Array} links Links configuration array
@returns {void}
@TODO (possible): make a links data-provider instead of passing
them in as an argument?
966660
function (el, links) {
            $el = $(el);
            this.createLinks(links);
            if (!browser.ie) {
                // @NOTE: event handlers are individually bound in IE, because
                // the ctrl+click workaround fails when using event delegation
                $el.on('click', '.' + CSS_CLASS_PAGE_LINK, handleClick);
            }
        }
328054
public void createLinks(ServiceReference<S> declarationBinderRef) {
        for (D declaration : linkerManagement.getMatchedDeclaration()) {
            if (linkerManagement.canBeLinked(declaration, declarationBinderRef)) {
                linkerManagement.link(declaration, declarationBinderRef);
            }
        }
    }
708534
@SuppressWarnings("unchecked")
	public T add(Link... links) {

		Assert.notNull(links, "Given links must not be null!");

		add(Arrays.asList(links));

		return (T) this;
	}
596520
function setRefs(allPages, pages) {
            if (!pages) {
                pages = allPages;
            }

            for (var index = 0; index < pages.length; index++) {
                var stateRef;

                if (pages[index].stateRef) {
                    stateRef = stateRefSearch(allPages, pages[index].stateRef);

                    if (null !== stateRef) {
                        pages[index] = merge({}, stateRef, pages[index]);
                    }
                }

                if (pages[index].pages) {
                    pages[index].pages = setRefs(allPages, pages[index].pages);
                }
            }

            return pages;
        }
318012
public void setEnvironmentLinks(java.util.Collection<EnvironmentLink> environmentLinks) {
        if (environmentLinks == null) {
            this.environmentLinks = null;
            return;
        }

        this.environmentLinks = new com.amazonaws.internal.SdkInternalList<EnvironmentLink>(environmentLinks);
    }
914559
private static Map<String, LinkAndRels> urlRelMap(Links links) {

		Map<String, LinkAndRels> urlRelMap = new LinkedHashMap<>();

		links.forEach(link -> {
			LinkAndRels linkAndRels = urlRelMap.computeIfAbsent(link.getHref(), s -> new LinkAndRels());
			linkAndRels.setLink(link);
			linkAndRels.getRels().add(link.getRel());
		});

		return urlRelMap;
	}
634336
@SuppressWarnings("unchecked")
	public T add(Iterable<Link> links) {

		Assert.notNull(links, "Given links must not be null!");

		links.forEach(this::add);

		return (T) this;
	}
328559
void initPageNavIndexes() {

        if (m_pageIndex < m_pageNavLength) {

            m_pageNavStartIndex = 1;
            m_pageNavEndIndex = m_pageCount < m_pageNavLength ? m_pageCount : m_pageNavLength;

        } else {

            int middle = m_pageNavLength / 2;
            m_pageNavStartIndex = m_pageIndex - middle;
            m_pageNavEndIndex = (m_pageNavStartIndex + m_pageNavLength) - 1;

            if (m_pageNavStartIndex < 1) {
                m_pageNavStartIndex = 1;
            } else if (m_pageNavEndIndex < 1) {
                m_pageNavEndIndex = m_pageCount;
            } else if (m_pageNavEndIndex > m_pageCount) {

                // adjust end index
                m_pageNavEndIndex = m_pageCount;
                m_pageNavStartIndex = (m_pageNavEndIndex - m_pageNavLength) + 1;

                if (m_pageNavStartIndex < 1) {
                    // adjust the start index again
                    m_pageNavStartIndex = 1;
                }
            }
        }
    }
698899
private static List<Link> sortLinks(List<Link> links)
	{
		List<Link> result = new ArrayList<Link>();
		for (Link l : links)
		{
			int pos = 0;
			while (pos < result.size()
					&& l.getPos().getStart() > result.get(pos).getPos()
							.getStart())
			{
				pos++;
			}
			result.add(pos, l);
		}
		return result;
	}
538400
function initSubHeaders () {
    var each = [].forEach
    var main = document.getElementById('main')
    var header = document.getElementById('header')
    var sidebar = document.querySelector('.sidebar')
    var content = document.querySelector('.content')

    // build sidebar
    var currentPageAnchor = sidebar.querySelector('.sidebar-link.current')
    var isAPI = document.querySelector('.content').classList.contains('api')
    if (currentPageAnchor || isAPI) {
      var allHeaders = []
      var sectionContainer
      if (isAPI) {
        sectionContainer = document.querySelector('.menu-root')
      } else {
        sectionContainer = document.createElement('ul')
        sectionContainer.className = 'menu-sub'
        currentPageAnchor.parentNode.appendChild(sectionContainer)
      }
      var headers = content.querySelectorAll('h2')
      if (headers.length) {
        each.call(headers, function (h) {
          sectionContainer.appendChild(makeLink(h))
          var h3s = collectH3s(h)
          allHeaders.push(h)
          allHeaders.push.apply(allHeaders, h3s)
          if (h3s.length) {
            sectionContainer.appendChild(makeSubLinks(h3s, isAPI))
          }
        })
      } else {
        headers = content.querySelectorAll('h3')
        each.call(headers, function (h) {
          sectionContainer.appendChild(makeLink(h))
          allHeaders.push(h)
        })
      }

      var animating = false
      sectionContainer.addEventListener('click', function (e) {
        e.preventDefault()
        if (e.target.classList.contains('section-link')) {
          sidebar.classList.remove('open')
          setActive(e.target)
          animating = true
          setTimeout(function () {
            animating = false
          }, 400)
        }
      }, true)

      // make links clickable
      allHeaders.forEach(makeHeaderClickable)

      smoothScroll.init({
        speed: 400,
        offset: 0
      })
    }

    var hoveredOverSidebar = false
    sidebar.addEventListener('mouseover', function () {
      hoveredOverSidebar = true
    })
    sidebar.addEventListener('mouseleave', function () {
      hoveredOverSidebar = false
    })

    // listen for scroll event to do positioning & highlights
    window.addEventListener('scroll', updateSidebar)
    window.addEventListener('resize', updateSidebar)

    function updateSidebar () {
      var doc = document.documentElement
      var top = doc && doc.scrollTop || document.body.scrollTop
      if (animating || !allHeaders) return
      var last
      for (var i = 0; i < allHeaders.length; i++) {
        var link = allHeaders[i]
        if (link.offsetTop > top) {
          if (!last) last = link
          break
        } else {
          last = link
        }
      }
      if (last)
      setActive(last.id, !hoveredOverSidebar)
    }

    function makeLink (h) {
      var link = document.createElement('li')
      var text = h.textContent.replace(/\(.*\)$/, '')
      link.innerHTML =
        '<a class="section-link" data-scroll href="#' + h.id + '">' +
          htmlEscape(text) +
        '</a>'
      return link
    }

    function htmlEscape (text) {
      return text
        .replace(/&/g, '&amp;')
        .replace(/"/g, '&quot;')
        .replace(/'/g, '&#39;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
    }

    function collectH3s (h) {
      var h3s = []
      var next = h.nextSibling
      while (next && next.tagName !== 'H2') {
        if (next.tagName === 'H3') {
          h3s.push(next)
        }
        next = next.nextSibling
      }
      return h3s
    }

    function makeSubLinks (h3s, small) {
      var container = document.createElement('ul')
      if (small) {
        container.className = 'menu-sub'
      }
      h3s.forEach(function (h) {
        container.appendChild(makeLink(h))
      })
      return container
    }

    function setActive (id, shouldScrollIntoView) {
      var previousActive = sidebar.querySelector('.section-link.active')
      var currentActive = typeof id === 'string'
        ? sidebar.querySelector('.section-link[href="#' + id + '"]')
        : id
      if (currentActive !== previousActive) {
        if (previousActive) previousActive.classList.remove('active')
        currentActive.classList.add('active')
        if (shouldScrollIntoView) {
          var currentPageOffset = currentPageAnchor
            ? currentPageAnchor.offsetTop - 8
            : 0
          var currentActiveOffset = currentActive.offsetTop + currentActive.parentNode.clientHeight
          var sidebarHeight = sidebar.clientHeight
          var currentActiveIsInView = (
            currentActive.offsetTop >= sidebar.scrollTop &&
            currentActiveOffset <= sidebar.scrollTop + sidebarHeight
          )
          var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight
          var newScrollTop = currentActiveIsInView
            ? sidebar.scrollTop
            : linkNotFurtherThanSidebarHeight
              ? currentPageOffset
              : currentActiveOffset - sidebarHeight
          sidebar.scrollTop = newScrollTop
        }
      }
    }

    function makeHeaderClickable (link) {
      var wrapper = document.createElement('a')
      wrapper.href = '#' + link.id
      wrapper.setAttribute('data-scroll', '')
      link.parentNode.insertBefore(wrapper, link)
      wrapper.appendChild(link)
    }
  }
898443
function linkInPage (link) {
    const pageUrl = location.hash
      ? stripHash(location.href)
      : location.href;

    return link.tagName.toLowerCase() === 'a'
      && link.hash.length > 0
      && stripHash(link.href) === pageUrl;
  }
963110
function(pageLinks) {
			this._categorizedPageLinks = {};
			pageLinks.getAllLinks().forEach(function(link) {
				var category = link.category;
				this._categorizedPageLinks[category] = this._categorizedPageLinks[category] || [];
				this._categorizedPageLinks[category].push({
					title: link.textContent,
					order: link.order || 100,
					href: link.href
				});
			}, this);
		}
359016
def pages_linking_to(urls)
      unless urls.is_a?(Array)
        urls = [urls]
        single = true
      end

      urls.map! do |url|
        unless url.is_a?(URI)
          URI(url) rescue nil
        else
          url
        end
      end
      urls.compact

      links = {}
      urls.each { |url| links[url] = [] }
      values.each do |page|
        urls.each { |url| links[url] << page if page.links.include?(url) }
      end

      if single and !links.empty?
        return links[urls.first]
      else
        return links
      end
    end
14583
function initModelUnlink (args) {
    var controller = this
    var model = this.model
    // if model does not have id column then cannot use default controller
    if (!defined(model.columnName('id'))) {
        return
    }
    // set true if model has ny relations that link via another model
    var hasVia = false
    // check for relations
    _.each(model.relations, relation => {
        if (defined(relation.via)) {
            hasVia = true
        }
    })
    // if model does not have via then do not create link endpoing
    if (!hasVia) {
        return
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = defined(args.defaultRole) 
        ? args.defaultRole
        : defined(accountIdColumn) && model.columns[accountIdColumn].null === false
            ? 'authenticated'
            : 'all'
    // index inputs
    var input = {
        // get current revision of record
        current: ['query.current', 'body.current'],
        // get record even if deleted
        deleted: ['query.deleted', 'body.deleted'],
        // ignore conflicts
        force: ['query.force', 'body.force'],
        // record id
        id: 'params.id',
        // url to redirect to when done
        redirect: ['query.redirect', 'body.redirect'],
        // http referrer
        referrer: 'headers.referer',
        // name of model to link to
        relation: ['query.relation', 'body.relation'],
        // id of model to link to
        relationId: ['query.relationId', 'body.relationId'],
    }
    // create path if it does not exist
    if (!this.paths['/:id/unlink']) {
        this.paths['/:id/unlink'] = {}
    }
    // add handler for POST /:id/link to link record to another
    this.paths['/:id/unlink'].post = this.paths['/:id/unlink'].get = [
        {
            before: function (args) {
                // load primary record and related record
                return loadRecordAndRelation(controller, args)
            },
            input: input,
            method: function (args) {
                // unlink related record from primary record
                return unlinkModel(controller, args)
            },
            methodName: 'unlink',
            role: role,
        },
    ]
}
700413
protected function prepareLink(string &$link = null): void
	{
		if ($link !== null) {
			if (Strings::endsWith($link, ':default')) {
				$link = substr($link, 0, -7);
			}
			$pos = strrpos($link, ':');
			if ($pos !== strlen($link)) {
				$link = substr($link, 0, $pos + 1);
			}
		}
	}
390102
function init(_models) {
  _.forEach(_models, (model) =>  {
    models[model.modelName] = model;
  });

  generateTypeDefs(models);
  generateNodeDefinitions(models);
}
399927
void setAnchor(int page, Map.Entry anchor) {
        SimpleImmutableEntry anchorEntry = new SimpleImmutableEntry(page, anchor);
        int anchorCount = anchorList.size();
        if (page < anchorCount) {
            anchorList.set(page, anchorEntry);
        } else if (page == anchorCount) {
            anchorList.add(anchorEntry);
        } else {
            throw new IllegalArgumentException("Anchor index is not correct, expected: " + page + " found: " + anchorCount);
        }
    }