<commit_before>package orc.doc;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

import orc.runtime.ReverseListIterator;

import xtc.parser.ParseException;
import xtc.parser.Result;

/**
 * @author quark
 */
public class MakeDoc {
	private static class DocNodes {
		public String file;
		public List<DocNode> nodes;
		public DocNodes(String file, List<DocNode> nodes) {
			this.file = file;
			this.nodes = nodes;
		}
	}
	
	public static void main(String[] args) throws ParseException, IOException {
		List<DocNodes> files = new LinkedList<DocNodes>();
		for (String file : args) {
			files.add(new DocNodes(file, parseFile(file)));
		}
		System.out.println("<?xml version=\"1.0\"?>");
		System.out.println("<section><title>Reference</title>");
		int anchor;
		anchor = 0;
		for (DocNodes file : files) {
			System.out.print("<section><title>");
			System.out.print(escapeXML(file.file));
			if (!file.nodes.isEmpty()) {
				DocNode first = file.nodes.get(0);
				if (first instanceof DocParagraph) {
					System.out.print(": ");
					System.out.print(firstSentence(((DocParagraph)first).body.trim()));
				}
			}
			System.out.println("</title>");
			int depth = 0;
			for (DocNode doc : file.nodes) {
				if (doc instanceof DocParagraph) {
					String body = ((DocParagraph)doc).body.trim();
					if (!body.equals("")) {
						System.out.print("<para>");
						System.out.print(body);
						System.out.println("</para>");
					}
				} else if (doc instanceof DocTag) {
					System.out.print(((DocTag)doc).value);
				} else if (doc instanceof DocType) {
					DocType type = (DocType)doc;
					if (type.depth > depth) {
						System.out.println("<variablelist>");
						depth = type.depth;
					} else {
						while (type.depth < depth) {<commit_msg>Use formatting directives to control presentation of generated docs.<commit_after>package orc.doc;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

import orc.runtime.ReverseListIterator;

import xtc.parser.ParseException;
import xtc.parser.Result;

/**
 * @author quark
 */
public class MakeDoc {
	private static class DocNodes {
		public String file;
		public List<DocNode> nodes;
		public DocNodes(String file, List<DocNode> nodes) {
			this.file = file;
			this.nodes = nodes;
		}
	}
	
	public static void main(String[] args) throws ParseException, IOException {
		List<DocNodes> files = new LinkedList<DocNodes>();
		for (String file : args) {
			files.add(new DocNodes(file, parseFile(file)));
		}
		System.out.println("<?xml version=\"1.0\"?>");
		System.out.println("<section><title>Reference</title>");
		int anchor;
		anchor = 0;
		for (DocNodes file : files) {
			System.out.print("<section><title>");
			System.out.print(escapeXML(file.file));
			if (!file.nodes.isEmpty()) {
				DocNode first = file.nodes.get(0);
				if (first instanceof DocParagraph) {
					System.out.print(": ");
					System.out.print(firstSentence(((DocParagraph)first).body.trim()));
				}
			}
			System.out.println("</title>");
			int depth = 0;
			for (DocNode doc : file.nodes) {
				if (doc instanceof DocParagraph) {
					String body = ((DocParagraph)doc).body.trim();
					if (!body.equals("")) {
						System.out.print("<para>");
						System.out.print(body);
						System.out.println("</para>");
					}
				} else if (doc instanceof DocTag) {
					System.out.print(((DocTag)doc).value);
				} else if (doc instanceof DocType) {
					DocType type = (DocType)doc;
					if (type.depth > depth) {
						System.out.println("<variablelist>");
						System.out.println("<?dbfo list-presentation=\"list\"?>");
						System.out.println("<?dbhtml list-presentation=\"table\"?>");
						depth = type.depth;
					} else {
						while (type.depth < depth) {
{'fraction_non_alphanumeric': 0.1579337617399901, 'fraction_numerical': 0.002471576866040534, 'mean_word_length': 3.6198630136986303, 'pattern_counts': {'":': 2, '<': 35, '<?xml version=': 2, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2208237', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1291, 'n_words': 282}