feat(skills): add tsl api reference skill

Bundle the TSL API index and markdown references under the skill, route TSL docs to use it, and update the codegen index generator to maintain the bundled data.
This commit is contained in:
csh
2026-07-07 16:36:15 +08:00
parent 4cd6b9410f
commit e1f7ce052c
267 changed files with 185908 additions and 11996 deletions
@@ -0,0 +1,233 @@
# Builtin - 外部交互 / CGI
## `unsetEchoString()`
取出被SetEchoString后的重定向输出流,取出后重置输出流为空。
返回:string
## `isEchoRedirect()`
判断目前是否被SetEchoString重定向,如果被重定向了,返回为真,否则为假。
返回:bool
## `readLn()`
从控制台读字符串并返回结果(输入以回车结束)。
返回:string
## `writeln(p1, pn)`
带回车地输出字符串,如果在平台运行,会输出信息到客户端。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `p1` | string | string 字符串1 |
| `pn` | string | string 字符串n |
返回:any
### 示例
```tsl
// 先输出111222,接着另起一行显示空白,再接着另起一行输出333
writeln("111", "222");
writeln("333");
{结果页面中,运行信息下打印:
111222
333
}
```
## `write(p1, pn)`
输出字符串,如果在平台运行,会输出信息到客户端。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `p1` | string | string 字符串1 |
| `pn` | string | string 字符串n |
返回:any
### 示例
```tsl
// 先输出123456,接着另起一行输出789
write("123", "456");
write("789");
return;
{在结果页面中打印:
123456
789}
```
## `httpGetContent()`
返回前端发送的内容串,如果内容串长度和HttpGetContentLength不一致,则需要用TWebRequest类来读取剩余内容。
返回:string
## `httpGetContentLength()`
返回前端发送的内容串的长度。
返回:integer
## `httpGetQueryString()`
返回前端发送的查询串。
返回:string
### 示例
```tsl
// 前端执行的是http: // hostname/test.tsl?name=billgates&sex=male
// 则返回的值为name=billgates&sex=male
```
## `httpGetRequestMethod()`
返回前端发送请求的类型。如get或者put。
返回:string
## `httpGetQueryValues()`
分解前端发送的查询串为字符串下标的字符串数组。
返回:array[key:string] of string
## `httpGetQueryValueByName(name, additional_info)`
得到指定参数的查询串的值。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `name` | string | 字符串类型。查询串中的变量名。 |
| `additional_info` | string | 字符串类型,返回附加信息。最常见的是当查询的Name为文件上传的ID时,函数返回文件的内容,而AdditionalInfo返回包括文件名等内容的附加信息。 |
返回:string
## `httpGetQueryValueByNameEx(name)`
得到查询串的值,网页多文件一次性上传可能会用多同名多个内容的情况,返回二维数组结构。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `name` | string | 字符串,查询串中的变量名。 |
返回:array
## `httpGetScriptName()`
返回所执行的CGI名。
返回:string
## `httpGetPathInfo()`
返回所执行的CGI的虚拟路径名。
返回:string
## `httpGetPathTranslated()`
返回所执行的CGI的实路径名。
返回:string
## `httpGetRemoteHost()`
返回所执行的CGI的前端主机名。
返回:string
## `httpGetRemoteAddr()`
返回所执行的CGI的前端IP地址。
返回:string
## `httpGetRemoteUser()`
返回所执行的CGI的远端登录用户名。
返回:string
## `httpGetRemoteIdent()`
返回所执行的CGI的远端识别串。
返回:string
## `httpGetHttpAccept()`
返回接受的类型种类。
返回:string
## `httpGetHttpUserAgent()`
返回用户代理串。
返回:string
## `httpGetServerName()`
返回服务器名。
返回:string
## `httpGetServerPort()`
返回服务器端口。
返回:string
## `httpGetServerProtocol()`
返回服务器协议类别。
返回:string
## `httpGetServerSoftware()`
返回服务器软件的名称。
返回:string
## `httpGetGatewayInterface()`
返回网关接口。
返回:string
## `httpGetCookie()`
返回Cookie串。
返回:string
## `httpGetEnvVar(env_name)`
返回指定名称的环境串。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `env_name` | string | 字符串类型,环境变量名。 |
返回:string
## `httpSetHeadString(header)`
设置返回的HTTP头。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `header` | string | 字符串类型,Http头,以连续两个回车换行作为结尾。 |
返回:string