4 Commits

Author SHA1 Message Date
f734a96a56 remove github CI 2022-09-06 19:55:45 +08:00
c340f971d1 Add Qt doc map 2022-09-06 19:52:52 +08:00
89d6038c9f Update qt index 2022-09-06 18:25:32 +08:00
c25cebc838 Add qt 5.13.0 doc index 2022-09-06 18:07:30 +08:00
7 changed files with 220114 additions and 64 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

View File

@@ -1,45 +0,0 @@
name: Gradle CI
# Controls when the action will run.
on:
# Triggers the workflow on push and pull request events but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
name: Gradle-Build
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
# Setup JDK
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 11
# Validate Gradle Wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.0.3
# Build
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build

View File

@@ -1,5 +1,5 @@
plugins {
val kotlinVersion = "1.6.10"
val kotlinVersion = "1.7.10"
kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
@@ -7,7 +7,7 @@ plugins {
}
group = "top.jie65535"
version = "0.2.0"
version = "0.3.0"
repositories {
maven("https://maven.aliyun.com/repository/public") // 阿里云国内代理仓库

Binary file not shown.

View File

@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -14,13 +14,14 @@ object JCppReferencePlugin : KotlinPlugin(
JvmPluginDescription(
id = "top.jie65535.mirai-console-jcr-plugin",
name = "J Cpp Reference Plugin",
version = "0.2.0"
version = "0.3.0"
) {
author("jie65535")
info("cppreference.com 帮助插件")
info("C++ 参考搜索插件")
}
) {
private const val cppreferencePrefix = "https://zh.cppreference.com/w/"
private const val qtDocPrefix = "https://doc.qt.io/qt-5/"
private fun loadMap(path: String): Map<String, String> {
val map = mutableMapOf<String, String>()
@@ -28,21 +29,47 @@ object JCppReferencePlugin : KotlinPlugin(
if (stream == null) {
logger.error("资源文件为空")
} else {
val br = BufferedReader(InputStreamReader(stream))
while (br.ready()) {
val line = br.readLine()
val s = line.indexOf('\t')
if (s > 0) {
map[line.substring(0, s)] = line.substring(s+1)
stream.use {
val br = BufferedReader(InputStreamReader(stream))
while (br.ready()) {
val line = br.readLine()
val s = line.indexOf('\t')
if (s > 0) {
val key = line.substring(0, s)
val url = line.substring(s+1)
map.putIfAbsent(key, url)
val lowerKey = key.lowercase()
map.putIfAbsent(lowerKey, url)
}
}
}
splitKeys(map)
}
logger.info("\"$path\" ${map.size} keywords loaded")
return map
}
private fun splitKeys(map: MutableMap<String, String>) {
val subMap = mutableMapOf<String, String>()
for (item in map) {
val s = item.key.indexOf("::")
if (s >= 0) {
val sub = item.key.substring(s+2)
if (!map.containsKey(sub)) {
subMap[sub] = item.value
}
}
}
if (subMap.isNotEmpty()) {
splitKeys(subMap)
for (item in subMap) {
map.putIfAbsent(item.key, item.value)
}
}
}
private val indexC by lazy { loadMap("/devhelp-index-c.txt") }
// private val indexCpp by lazy { loadMap("/devhelp-index-cpp.txt") }
private val indexQt by lazy { loadMap("/qt-5.13.0.txt") }
override fun onEnable() {
logger.info { "Plugin loaded" }
@@ -51,12 +78,18 @@ object JCppReferencePlugin : KotlinPlugin(
val eventChannel = GlobalEventChannel.parentScope(this)
eventChannel.subscribeMessages {
startsWith("c ") { keyword ->
if (keyword.isEmpty()) return@startsWith
logger.info("check c \"$keyword\"")
val link = indexC[keyword]
if (link != null) {
subject.sendMessage(message.quote() + cppreferencePrefix + link)
var cLink = indexC[keyword]
if (cLink != null) {
subject.sendMessage(message.quote() + cppreferencePrefix + cLink)
} else {
cLink = indexC[keyword.lowercase()]
if (cLink != null) {
subject.sendMessage(message.quote() + cppreferencePrefix + cLink)
}
}
}
@@ -68,6 +101,20 @@ object JCppReferencePlugin : KotlinPlugin(
subject.sendMessage(message.quote() + cppreferencePrefix + index.link)
}
}
startsWith("qt ") { keyword ->
if (keyword.isEmpty()) return@startsWith
logger.info("check qt \"$keyword\"")
var qtLink = indexQt[keyword]
if (qtLink != null) {
subject.sendMessage(message.quote() + qtDocPrefix + qtLink)
} else {
qtLink = indexQt[keyword.lowercase()]
if (qtLink != null) {
subject.sendMessage(message.quote() + qtDocPrefix + qtLink)
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff