<commit_before>package onthefly

import (
	"fmt"
	"log"
)

// For generating IDs
var (
	geometryCounter = 0
	materialCounter = 0
	meshCounter     = 0
)

// Unique prefixes when generating IDs
const (
	geometryPrefix = "g"
	materialPrefix = "ma"
	meshPrefix     = "m"
)

type (
	// For Three.JS elements, like a mesh or material
	Element struct {
		ID string // name of the variable
		JS string // javascript code for creating the element
	}
	// The Three.JS render function, where head and tail are standard
	RenderFunc struct {
		head, mid, tail string
	}
	// Different types of elements
	Geometry Element
	Material Element
	Mesh     Element
)

// Create a HTML5 page that links with Three.JS and sets up a scene
func NewThreeJS(titleText string) (*Page, *Tag) {
	page := NewHTML5Page(titleText)

	// Style the page for showing a fullscreen canvas
	page.FullCanvas()

	// Link to Three.JS
	page.LinkToJSInBody("http://threejs.org/build/three.min.js")

	// Add a scene
	script, _ := page.AddScriptToBody("var scene = new THREE.Scene();")

	// Return the script tag that can be used for adding additional
	// javascript/Three.JS code
	return page, script
}

// Create a HTML5 page that includes the given JavaScript code at the end of
// the <body> tag, before </body>. The given JS code must be the contents of
// the http://threejs.org/build/three.min.js script for this to work.
func NewThreeJSWithGiven(titleText, js string) (*Page, *Tag) {
	page := NewHTML5Page(titleText)

	// Style the page for showing a fullscreen canvas
	page.FullCanvas()

	// Add the given JavaScript to the body
	page.AddScriptToBody(js)
<commit_msg>Add an optional argument<commit_after>package onthefly

import (
	"fmt"
	"log"
)

// For generating IDs
var (
	geometryCounter = 0
	materialCounter = 0
	meshCounter     = 0
)

// Unique prefixes when generating IDs
const (
	geometryPrefix = "g"
	materialPrefix = "ma"
	meshPrefix     = "m"
)

type (
	// For Three.JS elements, like a mesh or material
	Element struct {
		ID string // name of the variable
		JS string // javascript code for creating the element
	}
	// The Three.JS render function, where head and tail are standard
	RenderFunc struct {
		head, mid, tail string
	}
	// Different types of elements
	Geometry Element
	Material Element
	Mesh     Element
)

// Create a HTML5 page that links with Three.JS and sets up a scene
func NewThreeJS(args ...string) (*Page, *Tag) {
	title := "Untitled"
	if len(args) > 0 {
		title = args[0]
	}

	page := NewHTML5Page(title)

	// Style the page for showing a fullscreen canvas
	page.FullCanvas()

	if len(args) > 1 {
		threeJSURL := args[1]
		page.LinkToJSInBody(threeJSURL)
	} else {
		// Link to Three.JS
		page.LinkToJSInBody("https://threejs.org/build/three.min.js")
	}

	// Add a scene
	script, _ := page.AddScriptToBody("var scene = new THREE.Scene();")

	// Return the script tag that can be used for adding additional
	// javascript/Three.JS code
	return page, script
}

// Create a HTML5 page that includes the given JavaScript code at the end of
// the <body> tag, before </body>. The given JS code must be the contents of
// the http://threejs.org/build/three.min.js script for this to work.
func NewThreeJSWithGiven(titleText, js string) (*Page, *Tag) {
	page := NewHTML5Page(titleText)

	// Style the page for showing a fullscreen canvas
	page.FullCanvas()

	// Add the given JavaScript to the body
	page.AddScriptToBody(js)

{'fraction_non_alphanumeric': 0.09918080748976009, 'fraction_numerical': 0.0052662375658279695, 'mean_word_length': 3.3721227621483374, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 1, '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': '3127160', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1060, 'n_words': 407}