From 88d27da569789b80844418af4d941c7a93299311 Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Thu, 19 Dec 2019 15:07:01 -0800 Subject: Update 1.0.0 --- webgenerator/WebGenerator.kt | 76 -------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 webgenerator/WebGenerator.kt (limited to 'webgenerator') diff --git a/webgenerator/WebGenerator.kt b/webgenerator/WebGenerator.kt deleted file mode 100644 index 29150f0..0000000 --- a/webgenerator/WebGenerator.kt +++ /dev/null @@ -1,76 +0,0 @@ -@file:JvmName("WebGenerator") - -package thedarkcolour.kotlinforforge.webgenerator - -import org.apache.commons.io.FileUtils -import org.jsoup.Jsoup -import org.jsoup.nodes.Attribute -import org.jsoup.nodes.Attributes -import org.jsoup.nodes.Document -import org.jsoup.nodes.Element -import org.jsoup.parser.Tag -import java.io.File -import java.nio.charset.Charset - -fun main() = run() - -fun run() { - // val v = Files.newDirectoryStream(File("C:\\Things\\mods\\thedarkcolour.kotlinforforge\\thedarkcolour\\thedarkcolour.kotlinforforge").toPath()) - // val mavenMetadata = File("C:\\Things\\mods\\thedarkcolour.kotlinforforge\\thedarkcolour\\thedarkcolour.kotlinforforge\\maven-metadata.xml") - - //val webHtml = Jsoup.parse(File("..\\KotlinForForge\\thedarkcolour\\thedarkcolour.kotlinforforge\\web.html"), null).childNodes()[0] - //webHtml.childNodes()[2].childNodes()[5].childNodes().filterIsInstance().forEach(::println) - - val thedarkcolour = File("C:\\Things\\mods\\KotlinForForge\\thedarkcolour") - - val web = File("C:\\Things\\mods\\KotlinForForge\\thedarkcolour\\web.html") - val webHtml = Jsoup.parse(web, "UTF-8") - - for (file in thedarkcolour.listFiles()!!) { - if (file.isDirectory) { - val pre = webHtml.getElementsByAttributeValue("href", "../index.html") - .parents() - .first() - val attr = Attributes().put(Attribute("href", file.absolutePath.replace("${thedarkcolour.absolutePath}\\", "") + "/web.html")) - - if (pre.getElementsByAttributeValue("href", attr.get("href")).isEmpty()) { - pre.appendChild(Element(Tag.valueOf("a"), webHtml.baseUri(), attr)) - - val innerWeb = File("${file.absolutePath}\\web.html") - innerWeb.createNewFile() - } - //webHtml.allElements.find { - // it.tagName() == "body" - //}!!.allElements.find { - // it.tagName() == "pre" - //}!!.allElements.find { - // print(it.attr("href")) - // it.className() == "" - //}//.appendChild((Element(Tag.valueOf("a"), "hi"))) - } - } - - FileUtils.writeStringToFile(web, webHtml.outerHtml(), Charset.defaultCharset()) - - /* - -

Index of /thedarkcolour.kotlinforforge/

-
-
../
-    1.0.0
-    maven-metadata.xml
-    maven-metadata.xml.md5
-    maven-metadata.xml.sha1
-    
-
- - */ -} - -fun getPre(doc: Document): Element { - return doc.getElementsByAttributeValue("href", "../web.html") - .parents() - .first() ?: doc.getElementsByAttributeValue("href", "../index.html") - .parents() - .first() -} \ No newline at end of file -- cgit