<commit_before>// # goweave
//
// goweave creates an HTML file from a Go source file, rendering comments and
// code side-by-side. Comments can use Markdown formatting as accepted by the
// MarkdownCommon() method of the BlackFriday library; see below for details.
//
// Basically, goweave is meant to be the "weave" part of Literate Programming for Go.
//
/* Options:

* `-resdir=<dir>`: Resource directory, defaults to the go get directory of goweave.
* `-outdir=<dir>`: Output directory. Defaults to the current directory.
* `-csspath=<path>`: Output path for the CSS file.
* `-inline`: Include the CSS into the HTML file.
* `-md`: Generate Markdown output rather than HTML.
* `-bare`: Only generate the body part of the HTML document.
 */
// goweave is based on the wonderful [docgo](https://github.com/dhconnelly/docgo)
// project by <NAME>. Although I shuffled much of the code
// around, added new code, removed some, and finally ended up with substantial
// changes to the resulting behavior, docgo saved me a lot--a LOT!--of time as
// it had all the groundworks already done for me.
//
// docgo in turn is a [Go](http://golang.org) implementation of [Jeremy Ashkenas]
// (http://github.com/jashkenas)'s [docco] (http://jashkenas.github.com/docco/),
// a literate-programming-style documentation generator.
//
// Comments are processed by [Markdown]
// (http://daringfireball.net/projects/markdown) using [Russ Ross]
// (http://github.com/russross)'s [BlackFriday]
// (http://github.com/russross/blackfriday) library, and code is
// syntax-highlighted using [litebrite](http://dhconnelly.github.com/litebrite),
// a Go syntax highlighting library.
//
// Optionally you can generate a Markdown document instead of HTML. In this case,
// you need to provide your own CSS that matches the output of your Markdown
// renderer.
// Also ensure your Markdown renderer is able to process "```go" code fences correctly.
//
//
// goweave is copyright 2016 by <NAME>. All rights reserved.
// This source code is governed by a BSD-style license that can be found in
// the `LICENSE.txt` file.
//
// License files for godoc, litebrite, blackfriday, and the CopyFile function from
// github.com/pkg/fileutils/copy.go:
//
// * LICENSE_godoc.md
// * LICENSE_litebrite.md
// * LICENSE_blackfriday.txt
// * LICENSE_CopyFile.txt

// - - -
// ## Imports and globals

package main

import (
	"bytes"
	"flag"
	"go/build"
	"io"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"regexp"
	"strings"<commit_msg>Minor changes in the doc parts.<commit_after>/*
# goweave

goweave creates an HTML file from a Go source file, rendering comments and
code side-by-side. Comments can use Markdown formatting as accepted by the
MarkdownCommon() method of the BlackFriday library; see below for details.

Goweave is meant to work like "weave" in [Literate Programming]
(https://en.wikipedia.org/wiki/Literate_programming). Unlike in Literate Programming,
no "tangle" counterpart is required, as the source document is already a
valid Go source file, ready to be `go install`'ed.

Options:

* `-resdir=<dir>`: Resource directory, defaults to the go get directory of goweave.
* `-outdir=<dir>`: Output directory. Defaults to the current directory.
* `-csspath=<path>`: Output path for the CSS file. Defaults to the current directory.
* `-inline`: Include the CSS into the HTML file. Does not work with `-bare`.
* `-md`: Generate Markdown output rather than HTML.
* `-bare`: Only generate the body part of the HTML document.

goweave is based on the wonderful [docgo](https://github.com/dhconnelly/docgo)
project by <NAME>. Although I shuffled much of the code
around, added new code, removed some, and finally ended up with substantial
changes to the resulting behavior, docgo saved me a lot--a LOT!--of time as
it had all the groundworks already done for me.

docgo in turn is a [Go](http://golang.org) implementation of [Jeremy Ashkenas]
(http://github.com/jashkenas)'s [docco] (http://jashkenas.github.com/docco/),
a literate-programming-style documentation generator.

Comments are processed by [Markdown] (http://daringfireball.net/projects/markdown)
using [Russ Ross] (http://github.com/russross)'s [BlackFriday]
(http://github.com/russross/blackfriday) library, and code is
syntax-highlighted using [litebrite](http://dhconnelly.github.com/litebrite),
a Go syntax highlighting library.

Optionally you can generate a Markdown document instead of HTML. In this case,
you need to provide your own CSS that matches the output of your Markdown
renderer.
Also ensure your Markdown renderer is able to process "```go" code fences correctly.


goweave is copyright 2016 by <NAME>. All rights reserved.
This source code is governed by a BSD-style license that can be found in
the `LICENSE.txt` file.

Parts of the code are copyright 2012 by <NAME>. See `LICENSE_godoc`.

License files for litebrite, blackfriday, and the CopyFile function from
github.com/pkg/fileutils/copy.go:

* LICENSE_litebrite.md
* LICENSE_blackfriday.txt
* LICENSE_CopyFile.txt
*/

// ## Imports and globals

package main

import (
	"bytes"
	"flag"
	"go/build"
	"io"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"regexp"
	"strings"
{'fraction_non_alphanumeric': 0.11197060529878167, 'fraction_numerical': 0.002320634306710501, 'mean_word_length': 4.031128404669261, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5338900', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1567, 'n_words': 631}