mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Markdown generation of Redis Modules API reference improved.
This commit is contained in:
parent
e74f0aa6d1
commit
43aaf96163
17
src/module.c
17
src/module.c
@ -1003,11 +1003,11 @@ int replyWithStatus(RedisModuleCtx *ctx, const char *msg, char *prefix) {
|
||||
* the initial error code. The function only provides the initial "-", so
|
||||
* the usage is, for example:
|
||||
*
|
||||
* RM_ReplyWithError(ctx,"ERR Wrong Type");
|
||||
* RedisModule_ReplyWithError(ctx,"ERR Wrong Type");
|
||||
*
|
||||
* and not just:
|
||||
*
|
||||
* RM_ReplyWithError(ctx,"Wrong Type");
|
||||
* RedisModule_ReplyWithError(ctx,"Wrong Type");
|
||||
*
|
||||
* The function always returns REDISMODULE_OK.
|
||||
*/
|
||||
@ -3238,8 +3238,7 @@ void RM_LogRaw(RedisModule *module, const char *levelstr, const char *fmt, va_li
|
||||
serverLogRaw(level,msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Produces a log message to the standard Redis log, the format accepts
|
||||
/* Produces a log message to the standard Redis log, the format accepts
|
||||
* printf-alike specifiers, while level is a string describing the log
|
||||
* level to use when emitting the log, and must be one of the following:
|
||||
*
|
||||
@ -3318,10 +3317,12 @@ void unblockClientFromModule(client *c) {
|
||||
*
|
||||
* The callbacks are called in the following contexts:
|
||||
*
|
||||
* reply_callback: called after a successful RedisModule_UnblockClient() call
|
||||
* in order to reply to the client and unblock it.
|
||||
* reply_callback: called after a successful RedisModule_UnblockClient()
|
||||
* call in order to reply to the client and unblock it.
|
||||
*
|
||||
* reply_timeout: called when the timeout is reached in order to send an
|
||||
* error to the client.
|
||||
*
|
||||
* free_privdata: called in order to free the privata data that is passed
|
||||
* by RedisModule_UnblockClient() call.
|
||||
*/
|
||||
@ -3683,8 +3684,8 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) {
|
||||
* C_OK is returned, otherwise C_ERR is returned and errno is set
|
||||
* to the following values depending on the type of error:
|
||||
*
|
||||
* ENONET: No such module having the specified name.
|
||||
* EBUSY: The module exports a new data type and can only be reloaded. */
|
||||
* * ENONET: No such module having the specified name.
|
||||
* * EBUSY: The module exports a new data type and can only be reloaded. */
|
||||
int moduleUnload(sds name) {
|
||||
struct RedisModule *module = dictFetchValue(modules,name);
|
||||
|
||||
|
@ -6,21 +6,29 @@ def markdown(s)
|
||||
s = s.gsub(/\*\/$/,"")
|
||||
s = s.gsub(/^ \* {0,1}/,"")
|
||||
s = s.gsub(/^\/\* /,"")
|
||||
if s[0] != ' '
|
||||
s = s.gsub(/RM_[A-z()]+/){|x| "`#{x}`"}
|
||||
s = s.gsub(/RedisModule_[A-z()]+/){|x| "`#{x}`"}
|
||||
s = s.gsub(/REDISMODULE_[A-z]+/){|x| "`#{x}`"}
|
||||
end
|
||||
s.chop! while s[-1] == "\n" || s[-1] == " "
|
||||
return s
|
||||
lines = s.split("\n")
|
||||
newlines = []
|
||||
lines.each{|l|
|
||||
if l[0] != ' '
|
||||
l = l.gsub(/RM_[A-z()]+/){|x| "`#{x}`"}
|
||||
l = l.gsub(/RedisModule_[A-z()]+/){|x| "`#{x}`"}
|
||||
l = l.gsub(/REDISMODULE_[A-z]+/){|x| "`#{x}`"}
|
||||
end
|
||||
newlines << l
|
||||
}
|
||||
return newlines.join("\n")
|
||||
end
|
||||
|
||||
# Given the source code array and the index at which an exported symbol was
|
||||
# detected, extracts and outputs the documentation.
|
||||
def docufy(src,i)
|
||||
m = /RM_[A-z0-9]+/.match(src[i])
|
||||
name = m[0]
|
||||
name = name.sub("RM_","RedisModule_")
|
||||
proto = src[i].sub("{","").strip+";\n"
|
||||
puts "## `#{m[0]}`\n\n"
|
||||
proto = proto.sub("RM_","RedisModule_")
|
||||
puts "## `#{name}`\n\n"
|
||||
puts " #{proto}\n"
|
||||
comment = ""
|
||||
while true
|
||||
|
Loading…
Reference in New Issue
Block a user