mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 00:21:19 +00:00
Adds moule to remote check library functionality
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -10,6 +10,7 @@
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/demo" />
|
||||
<option value="$PROJECT_DIR$/demo-remote" />
|
||||
<option value="$PROJECT_DIR$/opengraphkt" />
|
||||
</set>
|
||||
</option>
|
||||
|
||||
28
demo-remote/build.gradle.kts
Normal file
28
demo-remote/build.gradle.kts
Normal file
@@ -0,0 +1,28 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
application
|
||||
}
|
||||
|
||||
group = "fr.lengrand"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jsoup:jsoup:1.20.1")
|
||||
implementation("fr.lengrand:opengraphkt:0.0.1")
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(23)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass = "fr.lengrand.opengraphkt.MainKt"
|
||||
}
|
||||
38
demo-remote/src/main/kotlin/fr/lengrand/opengraphkt/Main.kt
Normal file
38
demo-remote/src/main/kotlin/fr/lengrand/opengraphkt/Main.kt
Normal file
@@ -0,0 +1,38 @@
|
||||
package fr.lengrand.opengraphkt
|
||||
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
/**
|
||||
* This module is only here to verify that the latest Maven Central release can be imported and used as intended.
|
||||
*/
|
||||
fun main() {
|
||||
val parser = OpenGraphParser()
|
||||
|
||||
val html = """
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Open Graph Example</title>
|
||||
<meta property="og:title" content="The Rock" />
|
||||
<meta property="og:type" content="video.movie" />
|
||||
<meta property="og:url" content="https://example.com/the-rock" />
|
||||
<meta property="og:image" content="https://example.com/rock.jpg" />
|
||||
<meta property="og:image:width" content="300" />
|
||||
<meta property="og:image:height" content="200" />
|
||||
<meta property="og:description" content="An action movie about a rock" />
|
||||
<meta property="og:site_name" content="Example Movies" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Example Page</h1>
|
||||
</body>
|
||||
</html>
|
||||
""".trimIndent()
|
||||
|
||||
println("Parsing from JSoup Document")
|
||||
|
||||
val doc = Jsoup.parse(html)
|
||||
val openGraphDataDoc = parser.parse(doc)
|
||||
|
||||
println("Title: ${openGraphDataDoc.title}")
|
||||
println("Is valid: ${openGraphDataDoc.isValid()}")
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
import org.gradle.kotlin.dsl.implementation
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.21"
|
||||
kotlin("jvm")
|
||||
application
|
||||
}
|
||||
|
||||
group = "nl.lengrand"
|
||||
version = "0.1-SNAPSHOT"
|
||||
group = "fr.lengrand"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -18,22 +17,10 @@ dependencies {
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
manifest {
|
||||
attributes(mapOf("Implementation-Title" to project.name,
|
||||
"Implementation-Version" to project.version))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(23)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import com.vanniktech.maven.publish.SonatypeHost
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.21"
|
||||
kotlin("jvm")
|
||||
id("com.vanniktech.maven.publish") version "0.30.0"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.21"
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
||||
rootProject.name = "OpenGraphKt"
|
||||
include("opengraphkt")
|
||||
include("demo")
|
||||
include("demo")
|
||||
include("demo-remote")
|
||||
Reference in New Issue
Block a user