Finish establishing section

        Wrap up title node, but stick in the section node. Add the section names
        based on all the text nodes added to the title.
169
def depart_heading(self, _):
        
        assert isinstance(self.current_node, nodes.title)
        # The title node has a tree of text nodes, use the whole thing to
        # determine the section id and names
        text = self.current_node.astext()
        if self.translate_section_name:
            text = self.translate_section_name(text)
        name = nodes.fully_normalize_name(text)
        section = self.current_node.parent
        section['names'].append(name)
        self.document.note_implicit_target(section, section)
        self.current_node = section
776312
function processNode(node) {
    if (node.tagName === 'P' || node.tagName === 'DIV' || node.tagName === 'UL' || node.tagName === 'OL' || node.tagName === 'PRE')
      setContent(node, getContent(node), '\n\n', '\n\n');
    else if (node.tagName === 'BR')
      setContent(node, '\n\n');
    else if (node.tagName === 'HR')
      setContent(node, '\n***\n');
    else if (node.tagName === 'H1')
      setContent(node, nltrim(getContent(node)), '\n# ', '\n');
    else if (node.tagName === 'H2') 
      setContent(node, nltrim(getContent(node)), '\n## ', '\n');
    else if (node.tagName === 'H3')
      setContent(node, nltrim(getContent(node)), '\n### ', '\n');
    else if (node.tagName === 'H4') 
      setContent(node, nltrim(getContent(node)), '\n#### ', '\n');
    else if (node.tagName === 'H5') 
      setContent(node, nltrim(getContent(node)), '\n##### ', '\n');
    else if (node.tagName === 'H6')
      setContent(node, nltrim(getContent(node)), '\n###### ', '\n');
    else if (node.tagName === 'B' || node.tagName === 'STRONG')
      setContent(node, nltrim(getContent(node)), '**', '**');
    else if (node.tagName === 'I' || node.tagName === 'EM')
      setContent(node, nltrim(getContent(node)), '_', '_');
    else if (node.tagName === 'A') {
      var href = node.href ? nltrim(node.href) : '', text = nltrim(getContent(node)) || href, title = node.title ? nltrim(node.title) : '';
      if (href.length > 0)
        setContent(node, '[' + text + '](' + href + (title ? ' "' + title + '"' : '') + ')');
      else
        setContent(node, '');
    } else if (node.tagName === 'IMG') {
      var src = node.getAttribute('src') ? nltrim(node.getAttribute('src')) : '', alt = node.alt ? nltrim(node.alt) : '', caption = node.title ? nltrim(node.title) : '';
      if (src.length > 0)
        setContent(node, '![' + alt + '](' + src  + (caption ? ' "' + caption + '"' : '') + ')');
      else
        setContent(node, '');
    } else if (node.tagName === 'BLOCKQUOTE') {
      var block_content = getContent(node);
      if (block_content.length > 0)
        setContent(node, prefixBlock('> ', block_content), '\n\n', '\n\n');
      else
        setContent(node, '');
    } else if (node.tagName === 'CODE') {
      if (node._bfs_parent.tagName === 'PRE' && node._bfs_parent._bfs_parent !== null)
        setContent(node, prefixBlock('    ', getContent(node)));
      else
        setContent(node, nltrim(getContent(node)), '`', '`');
    } else if (node.tagName === 'LI') {
      var list_content = getContent(node);
      if (list_content.length > 0)
        if (node._bfs_parent.tagName === 'OL') 
          setContent(node, trim(prefixBlock('    ', list_content, true)), '1. ', '\n\n');
        else
          setContent(node, trim(prefixBlock('    ', list_content, true)), '- ', '\n\n');
      else
        setContent(node, '');
    } else 
      setContent(node, getContent(node));
  }
188435
def do_header(self, node):
        """"""
        data = self.extract_text(node)
        self.add_text('\n/*\n %s \n*/\n' % data)
        # If our immediate sibling is a 'description' node then we
        # should comment that out also and remove it from the parent
        # node's children.
        parent = node.parentNode
        idx = parent.childNodes.index(node)
        if len(parent.childNodes) >= idx + 2:
            nd = parent.childNodes[idx + 2]
            if nd.nodeName == 'description':
                nd = parent.removeChild(nd)
                self.add_text('\n/*')
                self.subnode_parse(nd)
                self.add_text('\n*/\n')
1268687
public void addSection(String key, String value) {
    this.sections = addToMap(key, value, this.sections);
  }
730765
public void updateTitle() {
        Project project = getProject();
        String name = project.getProjectName();
        if ((name == null || "".equals(name.trim())) && saveFile != null) {
            name = saveFile.getAbsolutePath();
        }
        if (name == null) {
            name = "";//Project.UNNAMED_PROJECT;
        }
        String oldTitle = this.getTitle();
        String newTitle = TITLE_START_TXT + ("".equals(name.trim()) ? "" : " - " + name);
        if (oldTitle.equals(newTitle)) {
            return;
        }
        this.setTitle(newTitle);
    }
497741
def _append(self, node, contents):
        """"""
        if isinstance(contents, basestring):
            if contents != '':
                if len(node) == 0:
                    if node.text is None:
                        node.text = contents
                    else:
                        node.text += contents
                else:
                    last = node[-1]
                    if last.tail is None:
                        last.tail = contents
                    else:
                        last.tail += contents
        elif et.iselement(contents):
            contents.tail = ''
            node.append(contents)
        else:
            try:
                for content in contents:
                    self._append(node, content)
            except TypeError:
                self._append(node, self._format(contents))
262291
def add_section(self, section):
        
        if section.lower() == "default":
            raise ValueError('Invalid section name: %s' % section)

        if section in self._sections:
            raise DuplicateSectionError(section)
        self._sections[section] = self._dict()
97516
def add_text(self, text):
        """"""
        index = self.findText(text)
        while index != -1:
            self.removeItem(index)
            index = self.findText(text)
        self.insertItem(0, text)
        index = self.findText('')
        if index != -1:
            self.removeItem(index)
            self.insertItem(0, '')
            if text != '':
                self.setCurrentIndex(1)
            else:
                self.setCurrentIndex(0)
        else:
            self.setCurrentIndex(0)
128295
public void addSection(String pstrSection, String pstrComments)
    {
        INISection objSec   = null;

        objSec = (INISection) this.mhmapSections.get(pstrSection);
        if (objSec == null)
        {
            objSec = new INISection(pstrSection);
            this.mhmapSections.put(pstrSection, objSec);
        }
        objSec.setSecComments(delRemChars(pstrComments));
        objSec = null;
    }
418643
private void addEmptyElements() {
        for (Node node : nodes) {
            boolean empty = true;
            if(node instanceof NestableNode) {
	            List<Node> nl = ((NestableNode) node).getChildren();
	            for (Node n : nl) {
	                if (n instanceof Element) {
	                    empty = false;
	                    break;
	                } else if (n instanceof Text) {
	                    // TODO: Should we trim the text and see if it's length 0?
	                    String value = ((Text) n).getContent();
	                    if (value.length() > 0) {
	                        empty = false;
	                        break;
	                    }
	                }
	            }
            }            
            if (empty) {
                result.add(node);
            }
        }
    }
330031
private void buildDefinitionTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) {
        markupDocBuilder.sectionTitleWithAnchorLevel2(title, anchor);
    }
1077784
private void appendNode(Node appendNode) {
        if (currentElement==null) {
            currentDocument.appendChild(appendNode);
        } else {
            currentElement.appendChild(appendNode);
        }
    }
846781
protected void appendNode(Node n)
    {
        if (mRootNode != null) {
            mRootNode.appendChild(n);
        } else {
            mElement.appendChild(n);
        }
    }
704399
public synchronized void addTextNode(String text) throws IOException {
		// check for non-empty string
		if(text == null || text.trim().length() == 0) {
			return;
		}
		// reject modification of already closed node
		if(isOpen==false) {
			throw new IOException("Attempted to add child text node to already closed tag '" + name + "'!");
		}
		if(lastChildNode==null) {
			// no child nodes yet, close opening tag
			writer.write(">");
		} else {
			// close previous sibling and move to new line
			// FIXME: is this a legal situation, and if: how do we format this issue nicely?
			lastChildNode.close();
			writer.write("\n");
			indentLine();
		}
		SXTextNode textNode = new SXTextNode(text, writer, tabLevel, tabString);
		lastChildNode = textNode;
	}
914782
private void addGeneralSiblingElements() {
		for (Node node : nodes) {
			Node n = helper.getNextSibling(node);
			while (n != null) {
				String tag = selector.getTagName();
				if (helper.nameMatches(n, tag))
					result.add(n);

				n = helper.getNextSibling(n);
			}
		}
	}
1145506
private void addAdjacentSiblingElements() {
		for (Node node : nodes) {
			Node n = helper.getNextSibling(node);
			if (n != null)
				if (matchTag(n))
					result.add(n);
		}
	}
830722
private void __addLayoutSection(String name, String section, boolean def) {
        Map<String, String> m = def ? layoutSections0 : layoutSections;
        if (m.containsKey(name)) return;
        m.put(name, section);
    }