<commit_before>{{template "header" "Wiki"}}

<script>
    function renderTitle(data) {
	return '<a href="/wiki/view/' + data +'">' + data + '</a>'
    }
    function renderElement(data) {
	return '<div>' + data + '</div>'
    }
    function renderWiki(data) {
	return '<div>' + 
	    renderTitle(data.Title) + 
	    renderElement(data.Body) + 
	    renderElement(data.Modified) + 
	    '</div>'
    }
    async function getWiki(name) {
	let response = await fetch('/api?wiki=' + name)
	let data = await response.json()
	console.log(data)
	document.getElementById("wiki").innerHTML = renderWiki(data)
	return
    }

</script>

<body>

    {{template "leftnav" .}}
    <div class="content">
        <h1> List </h1>
        <!-- -->
	<form onsubmit="getWiki('test')">
	    Wiki: <input type="text">
	    <input type="submit">
	</form><commit_msg>got get wiki working for single page<commit_after>{{template "header" "Wiki"}}

<script>
    (function(history){
	var pushState = history.pushState;
	history.pushState = function(state, title, url) {
	  console.log(state, title, url);
	  return pushState.apply(history, arguments);
	};
    })(window.history);

    function renderTitle(data) {
	return '<a href="/wiki/view/' + data +'">' + data + '</a>'
    }
    function renderElement(data) {
	return '<div>' + data + '</div>'
    }
    function renderWiki(data) {
	return '<div>' + 
	    renderTitle(data.Title) + 
	    renderElement(data.Body) + 
	    renderElement(data.Modified) + 
	    '</div>'
    }
    async function getWiki(that) {
	let name = that.wikiName.value
	let response = await fetch('/api?wiki=' + name)
	if (response.status != 200) {
	    document.getElementById("wiki").innerHTML = 'Unknown Wiki'
	    return false
	}

	let data = await response.json()
	document.getElementById("wiki").innerHTML = renderWiki(data)
	window.history.pushState('listpage', data.Title, data.Title);
	return false
    }

</script>

<body>

    {{template "leftnav" .}}
    <div class="content">
        <h1> List </h1>
        <!-- -->
	<form onsubmit="getWiki(this); return false">
	    Wiki: <input type="text" name="wikiName">
	    <button>Submit</button>
	</form>
{'fraction_non_alphanumeric': 0.17685185185185184, 'fraction_numerical': 0.0032407407407407406, 'mean_word_length': 3.228962818003914, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 38, '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': '5747899', 'n_tokens_mistral': 740, 'n_tokens_neox': 703, 'n_words': 154}