<commit_before>/TEXT /local/Sys/PassWord/db/0

/set pw:super:super gold 90
/set pw:foo:bar gold 70
/set pw:*:xyzzy gold 30
/set pw:*:* gold 10

/TEXT /root/Sys/ServeSite/db/0

/set serve:localhost:8080 site local

/TEXT /local/Main/HomePage/wiki/0

This is the HomePage.

/TEXT /root/Mixin/MixinFirst/src/0

# -- I am the first Mixin

proc Puts {str} {
	/fmt/Fprintf $W %s $str
}

proc ModeHtml {} {
	send [send $W Header] Set "Content-Type" "text/html"
}

set WikiPage_rx [RxCompile {^([A-Z]+[a-z]+[A-Z][A-Za-z0-9_]*)$}]

proc Route { path query } {
	send $R ParseForm

	set Query [send [getf $R URL] Query]
	set Form [getf $R Form]

	set content [send $R FormValue text]
	set content2 [send [send [getf $R URL] Query] Get text]

	ModeHtml

	/fmt/Fprintf $W %v $Form
	/fmt/Fprintf $W %s " == Form <br>"

	/fmt/Fprintf $W %v $Query
	/fmt/Fprintf $W %s " == Query <br>"

	if {[catch {

		set rx [RxCompile {^/([A-Z][a-z]+)/([A-Z]+[a-z]+[A-Z][A-Za-z0-9_]*)([.]([a-z]+))?$}]
		set m [send $rx FindStringSubmatch $path]
		if {[notnull $m]} {
			set Volume [lat $m 1]
			set Page [lat $m 2]
			set Verb [lat $m 4]
			Puts "Level: [level]<br>"
			Puts "Host: [host]<br>"
			Puts "Site: [site]<br>"
			Puts "User: [user]<br>"
			Puts "Vol: $Volume<br>"
			Puts "Page: $Page<br>"
			Puts "Verb: $Verb<br>"

			Verb/$Verb
		} else {
			Puts "Did not understand the path!"
		}

	} what]} {
		Puts "*** Caught an error: $what"
	}
}

proc Verb/view {} {
	set c [ReadFile [site] $Volume $Page wiki]

	Puts $c
}

proc Verb/list {} {
	Puts "<ul>"
	set pages [ListPages [site] $Volume]
	foreach p $pages {
		set m [send $WikiPage_rx FindStringSubmatch $p]
		if {[notnull $m]} {
			set page [lat $m 1]
			Puts "<li><a href=$page.view>$page</a></li>"
		}
	}
	Puts "</ul>"
}

proc Verb/edit {} {
	Puts "Method: [getf $R Method] <br>"
	if 0 {
		Puts "Content len: [slen $content] <br>"
		Puts "Content value: $content <br>"
		Puts "Content2 len: [slen $content2] <br>"
		Puts "Content2 value: $content2 <br>"

		#if {[set content]} {
		#	WriteFile [site] $Volume $Page wiki $content
		#}
	}

	set c [ReadFile [site] $Volume $Page wiki]

	Puts "<form method=POST action=/$Volume/$Page.edit>"
	Puts "<textarea name=text>$c</textarea>"
	Puts "<br>"
	Puts "<input type=submit value=Submit>"
	Puts "</form>"
}

proc Verb/db {} {
	/fmt/Fprintf $W %v [DB]
	/fmt/Fprintf $W %v [db-select-like [DB] * * * * * *]
}

<commit_msg>tolerate missing USER in run1<commit_after>/TEXT /local/Sys/PassWord/db/0

/set pw:super:super gold 90
/set pw:foo:bar gold 70
/set pw:*:xyzzy gold 30
/set pw:*:* gold 10

/TEXT /root/Sys/ServeSite/db/0

/set serve:localhost:8080 site local

/TEXT /local/Main/HomePage/wiki/0

This is the HomePage.

/TEXT /root/Mixin/MixinFirst/src/0

# -- I am the first Mixin

proc Puts {str} {
	/fmt/Fprintf $W %s $str
}

proc ModeHtml {} {
	send [send $W Header] Set "Content-Type" "text/html"
}

set WikiPage_rx [RxCompile {^([A-Z]+[a-z]+[A-Z][A-Za-z0-9_]*)$}]

proc Route { path query } {
	send $R ParseForm

	set Query [send [getf $R URL] Query]
	set Form [getf $R Form]

	set content [send $R FormValue text]
	set content2 [send [send [getf $R URL] Query] Get text]

	ModeHtml

	/fmt/Fprintf $W %v $Form
	/fmt/Fprintf $W %s " == Form <br>"

	/fmt/Fprintf $W %v $Query
	/fmt/Fprintf $W %s " == Query <br>"

	if {[catch {

		set rx [RxCompile {^/([A-Z][a-z]+)/([A-Z]+[a-z]+[A-Z][A-Za-z0-9_]*)([.]([a-z]+))?$}]
		set m [send $rx FindStringSubmatch $path]
		if {[notnull $m]} {
			set Volume [lat $m 1]
			set Page [lat $m 2]
			set Verb [lat $m 4]
			catch { Puts "Level: [level]<br>" } _
			catch { Puts "Host: [host]<br>" } _
			catch { Puts "Site: [site]<br>" } _
			catch { Puts "User: [user]<br>" } _
			catch { Puts "Vol: $Volume<br>" } _
			catch { Puts "Page: $Page<br>" } _
			catch { Puts "Verb: $Verb<br>" } _

			Verb/$Verb
		} else {
			Puts "Did not understand the path!"
		}

	} what]} {
		Puts "*** Caught an error: $what"
	}
}

proc Verb/view {} {
	set c [ReadFile [site] $Volume $Page wiki]

	Puts $c
}

proc Verb/list {} {
	Puts "<ul>"
	set pages [ListPages [site] $Volume]
	foreach p $pages {
		set m [send $WikiPage_rx FindStringSubmatch $p]
		if {[notnull $m]} {
			set page [lat $m 1]
			Puts "<li><a href=$page.view>$page</a></li>"
		}
	}
	Puts "</ul>"
}

proc Verb/edit {} {
	Puts "Method: [getf $R Method] <br>"
	if 0 {
		Puts "Content len: [slen $content] <br>"
		Puts "Content value: $content <br>"
		Puts "Content2 len: [slen $content2] <br>"
		Puts "Content2 value: $content2 <br>"

		#if {[set content]} {
		#	WriteFile [site] $Volume $Page wiki $content
		#}
	}

	set c [ReadFile [site] $Volume $Page wiki]

	Puts "<form method=POST action=/$Volume/$Page.edit>"
	Puts "<textarea name=text>$c</textarea>"
	Puts "<br>"
	Puts "<input type=submit value=Submit>"
	Puts "</form>"
}

proc Verb/db {} {
	/fmt/Fprintf $W %v [DB]
	/fmt/Fprintf $W %v [db-select-like [DB] * * * * * *]
}


{'fraction_non_alphanumeric': 0.19648692810457516, 'fraction_numerical': 0.012459150326797386, 'mean_word_length': 3.23982683982684, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, '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': '1229240', 'n_tokens_mistral': 2275, 'n_tokens_neox': 2098, 'n_words': 595}