insert anchor link into section
432069
function insertAnchors(content) {
    var $ = cheerio.load(content);
    $(':header').each(function(i, elem) {
        var header = $(elem);
        var id = header.attr("id");
        if (!id) {
            id = slug(header.text());
            header.attr("id", id);
        }
        header.prepend('<a name="' + id + '" class="plugin-anchor" '
                   + 'href="#' + id + '">'
                   + '<i class="fa fa-link" aria-hidden="true"></i>'
                   + '</a>');
    });
    return $.html();
}
271717
function (header) {
      var links = {};

      if (header && header.length) {
        // Split parts by comma
        var parts = header.split(',');
        // Parse each part into a named link
        for (var i = 0; i < parts.length; i++) {
          var section = parts[i].split(';');
          if (section.length !== 2) {
            throw new Error("section could not be split on ';'");
          }
          var url = section[0].replace(/<(.*)>/, '$1').trim();
          var name = section[1].replace(/rel="(.*)"/, '$1').trim();
          links[name] = url;
        }
      }

      return links;
    }
292
function link(node, href) {
  var self = this
  var value = 'children' in node ? self.all(node).join('') : node.alt
  var url = escape(typeof href === 'string' ? href : node.url || '')
  var head

  if (url && url.slice(0, mailto.length) === mailto) {
    url = url.slice(mailto.length)
  }

  head = url.charAt(0) === '#' && self.headings[url.slice(1)]

  if (head) {
    url = '(' + escape(toString(head)) + ')'
  } else {
    if (value && escape(url) === value) {
      value = ''
    }

    if (url) {
      url = '\\(la' + escape(url) + '\\(ra'
    }
  }

  if (value) {
    value = bold.call(self, value)

    if (url) {
      value += ' '
    }
  }

  return value + (url ? italic.call(self, url) : '')
}
1153251
function insert(node, parent, tight) {
    var children = parent.children;
    var length = children.length;
    var last = children[length - 1];
    var isLoose = false;
    var index;
    var item;

    if (node.depth === 1) {
        item = listItem();

        item.children.push({
            type: PARAGRAPH,
            children: [
                {
                    type: LINK,
                    title: null,
                    url: '#' + node.id,
                    children: [
                        {
                            type: TEXT,
                            value: node.value
                        }
                    ]
                }
            ]
        });

        children.push(item);
    } else if (last && last.type === LIST_ITEM) {
        insert(node, last, tight);
    } else if (last && last.type === LIST) {
        node.depth--;

        insert(node, last, tight);
    } else if (parent.type === LIST) {
        item = listItem();

        insert(node, item, tight);

        children.push(item);
    } else {
        item = list();
        node.depth--;

        insert(node, item, tight);

        children.push(item);
    }

    /*
    * Properly style list-items with new lines.
    */

    parent.spread = !tight;

    if (parent.type === LIST && parent.spread) {
        parent.spread = false;
        index = -1;

        while (++index < length) {
            if (children[index].children.length > 1) {
                parent.spread = true;
                break;
            }
        }
    }

    // To do: remove `loose` in next major release.
    if (parent.type === LIST_ITEM) {
        parent.loose = tight ? false : children.length > 1;
    } else {
        if (tight) {
            isLoose = false;
        } else {
            index = -1;

            while (++index < length) {
                if (children[index].loose) {
                    isLoose = true;

                    break;
                }
            }
        }

        index = -1;

        while (++index < length) {
            children[index].loose = isLoose;
        }
    }
}
1241981
def _insert_contents(self, fzpage, newcont, overlay):
        """"""
        return _fitz.Tools__insert_contents(self, fzpage, newcont, overlay)
115996
private void insertLinks(Theme theme) {
		if (theme != null) {
			for (CssLink link : theme.getLinks()) {
				this.getHead().appendChild(link.getLink());
			}
		}
	}
303212
public function addLink($linkSrc, $linkName = null, $style = null) {
		if($this->_insideOf == 'section') {
			
			$link = new PHPWord_Section_Link($linkSrc, $linkName, $style);
			$rID = PHPWord_Media::addSectionLinkElement($linkSrc);
			$link->setRelationId($rID);
			
			$this->_elementCollection[] = $link;
			return $link;
		} else {
			trigger_error('Unsupported Link header / footer reference');
			return false;
		}
	}
276680
function append() {
  var i, l = this.length, el, args = this.slice.call(arguments);
  function it(node, index) {
    // content elements to insert
    el.each(function(ins) {
      ins = (index < (l - 1)) ? ins.cloneNode(true) : ins;
      node.appendChild(ins);
    });
  }
  for(i = 0;i < args.length;i++) {
    // wrap content
    el = this.air(args[i]);
    // matched parent elements (targets)
    this.each(it);
  }
  return this;
}
443691
def add_html_link(app, pagename, templatename, context, doctree):
    """"""
    app.sitemap_links.append(pagename + ".html")
178229
public function addCrumbReverse($section = null, $link = null)
    {
        array_unshift($this->path, ['section'=>$section, 'link'=>$link]);
    }
290795
function parseLinkHeader(header) {
    if (!header) {
        return {};
    }

    // Split parts by comma
    const parts = header.split(',');
    const links = {};

    // Parse each part into a named link
    parts.forEach((p) => {
        const section = p.split(';');
        if (section.length != 2) {
            throw new Error('section could not be split on ";"');
        }
        const url = section[0].replace(/<(.*)>/, '$1').trim();
        const name = section[1].replace(/rel="(.*)"/, '$1').trim();
        links[name] = url;
    });

    return links;
}
1293770
def link(self, content, link, title=''):
        

        link = links.resolve(link, self._search_path,
                             self._config.get('absolute'))

        return '{}{}</a>'.format(
            utils.make_tag('a', {
                'href': link,
                'title': title if title else None
            }),
            content)
1226070
private void beginInternalLink(ResourceReference reference, boolean freestanding,
        Map<String, String> parameters)
    {
        Map<String, String> spanAttributes = new LinkedHashMap<String, String>();
        Map<String, String> anchorAttributes = new LinkedHashMap<String, String>();

        // Add all parameters to the A attributes
        anchorAttributes.putAll(parameters);

        if (StringUtils.isEmpty(reference.getReference())) {
            spanAttributes.put(CLASS, WIKILINK);
            renderAutoLink(reference, spanAttributes, anchorAttributes);
        } else if (this.wikiModel.isDocumentAvailable(reference)) {
            spanAttributes.put(CLASS, WIKILINK);
            anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentViewURL(reference));
        } else {
            // The wiki document doesn't exist
            spanAttributes.put(CLASS, "wikicreatelink");
            anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentEditURL(reference));
        }

        getXHTMLWikiPrinter().printXMLStartElement(SPAN, spanAttributes);
        getXHTMLWikiPrinter().printXMLStartElement(XHTMLLinkRenderer.ANCHOR, anchorAttributes);
    }
304684
function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {

		if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
			previousParentElement = element;
			for( var i = 0; i < element.childNodes.length; i++ ) {
				childElement = element.childNodes[i];
				if ( i > 0 ) {
					j = i - 1;
					while ( j >= 0 ) {
						aPreviousChildElement = element.childNodes[j];
						if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
							previousParentElement = aPreviousChildElement;
							break;
						}
						j = j - 1;
					}
				}
				parentSection = section;
				if( childElement.nodeName ==  "section" ) {
					parentSection = childElement ;
					previousParentElement = childElement ;
				}
				if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
					addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
				}
			}
		}

		if ( element.nodeType == Node.COMMENT_NODE ) {
			if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
				addAttributeInElement( element, section, separatorSectionAttributes );
			}
		}
	}
513046
private List<Content> rewriteAnchor(Element element) {

    // detect empty anchor elements and insert at least an empty string to avoid "self-closing" elements
    // that are not handled correctly by most browsers
    if (element.getContent().isEmpty()) {
      element.setText("");
    }

    // resolve link metadata from DOM element
    Link link = getAnchorLink(element);

    // build anchor for link metadata
    Element anchorElement = buildAnchorElement(link, element);

    // Replace anchor tag or remove anchor tag if invalid - add any sub-content in every case
    List<Content> content = new ArrayList<Content>();
    if (anchorElement != null) {
      anchorElement.addContent(element.cloneContent());
      content.add(anchorElement);
    }
    else {
      content.addAll(element.getContent());
    }
    return content;
  }
223924
function addLinkTooltips(elementOrDialog) {
        var $element;
        if (elementOrDialog.getElement) {
            $element = elementOrDialog.getElement().find(".dialog-message");
        } else {
            $element = elementOrDialog;
        }
        $element.find("a").each(function (index, elem) {
            var $elem = $(elem);
            var url = $elem.attr("href");
            if (url && url !== "#" && !$elem.attr("title")) {
                $elem.attr("title", url);
            }
        });
    }
471509
private void insert(String url, List<Article> newArticles) {
		if(!articleMap.containsKey(url))
			articleMap.put(url, new ArrayList<Article>());

		List<Article> articleList = articleMap.get(url);
		articleList.addAll(newArticles);

		log("New size for " + url + " is " + articleList.size());
	}