Introduce idl definition for SVGMaskElement
This commit is contained in:
@@ -34,7 +34,7 @@ generateGrammarSource {
|
||||
compileKotlin.dependsOn generateGrammarSource
|
||||
compileTestKotlin.dependsOn generateTestGrammarSource
|
||||
|
||||
task downloadAllIdls(type: JavaExec) {
|
||||
task downloadIDL(type: JavaExec) {
|
||||
main = "org.jetbrains.idl2k.dl.DownloadKt"
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
@@ -42,4 +42,4 @@ task downloadAllIdls(type: JavaExec) {
|
||||
task idl2k(type: JavaExec) {
|
||||
main = "org.jetbrains.idl2k.MainKt"
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ val urls = listOf(
|
||||
"http://www.w3.org/TR/pointerevents/" to "org.w3c.dom.pointerevents",
|
||||
|
||||
"https://drafts.csswg.org/cssom/" to "org.w3c.dom.css",
|
||||
"https://www.w3.org/TR/css-masking-1/" to "org.w3c.css.masking",
|
||||
|
||||
"http://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
|
||||
"https://raw.githubusercontent.com/whatwg/url/master/url.html" to "org.w3c.dom.url",
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ fun main(args: Array<String>) {
|
||||
val arg = argsIterator.next()
|
||||
|
||||
when (arg) {
|
||||
"-package", "-pkg", "--package" -> if (argsIterator.hasNext()) packageFilter = argsIterator.next() else throw IllegalArgumentException("argument $arg requires argument")
|
||||
"--pkg" -> if (argsIterator.hasNext()) packageFilter = argsIterator.next() else throw IllegalArgumentException("argument $arg requires argument")
|
||||
else -> throw IllegalArgumentException("Argument $arg is unknown")
|
||||
}
|
||||
}
|
||||
@@ -79,23 +79,28 @@ private fun fetch(url: String): String? {
|
||||
}
|
||||
}
|
||||
|
||||
private fun Appendable.append(element: Element) {
|
||||
val text = element.text()
|
||||
appendln(text)
|
||||
if (!text.trimEnd().endsWith(";")) {
|
||||
appendln(";")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun List<Element>.attachTo(out: Appendable) = map { element ->
|
||||
if (!element.tag().preserveWhitespace()) {
|
||||
Element(Tag.valueOf("pre"), element.baseUri()).appendChild(element)
|
||||
} else element
|
||||
}.forEach { out.append(it) }
|
||||
|
||||
|
||||
private fun extractIDLText(rawContent: String, out: Appendable) {
|
||||
val soup = Jsoup.parse(rawContent)
|
||||
fun append(it : Element) {
|
||||
if (!it.tag().preserveWhitespace()) {
|
||||
return append(Element(Tag.valueOf("pre"), it.baseUri()).appendChild(it))
|
||||
}
|
||||
|
||||
val text = it.text()
|
||||
out.appendln(text)
|
||||
if (!text.trimEnd().endsWith(";")) {
|
||||
out.appendln(";")
|
||||
}
|
||||
}
|
||||
|
||||
soup.select(".dfn-panel").remove()
|
||||
|
||||
soup.select("pre.idl").filter {!it.hasClass("extract")}.forEach(::append)
|
||||
soup.select("code.idl-code").forEach(::append)
|
||||
soup.select("spec-idl").forEach(::append)
|
||||
soup.select("pre.idl").filter {!it.hasClass("extract")}.attachTo(out)
|
||||
soup.select("code.idl-code").attachTo(out)
|
||||
soup.select("spec-idl").attachTo(out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user