Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
43aaf961
Commit
43aaf961
authored
Jul 14, 2017
by
antirez
Browse files
Markdown generation of Redis Modules API reference improved.
parent
e74f0aa6
Changes
2
Show whitespace changes
Inline
Side-by-side
src/module.c
View file @
43aaf961
...
@@ -1003,11 +1003,11 @@ int replyWithStatus(RedisModuleCtx *ctx, const char *msg, char *prefix) {
...
@@ -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 initial error code. The function only provides the initial "-", so
* the usage is, for example:
* the usage is, for example:
*
*
*
RM
_ReplyWithError(ctx,"ERR Wrong Type");
*
RedisModule
_ReplyWithError(ctx,"ERR Wrong Type");
*
*
* and not just:
* and not just:
*
*
*
RM
_ReplyWithError(ctx,"Wrong Type");
*
RedisModule
_ReplyWithError(ctx,"Wrong Type");
*
*
* The function always returns REDISMODULE_OK.
* The function always returns REDISMODULE_OK.
*/
*/
...
@@ -3238,8 +3238,7 @@ void RM_LogRaw(RedisModule *module, const char *levelstr, const char *fmt, va_li
...
@@ -3238,8 +3238,7 @@ void RM_LogRaw(RedisModule *module, const char *levelstr, const char *fmt, va_li
serverLogRaw
(
level
,
msg
);
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
* 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:
* level to use when emitting the log, and must be one of the following:
*
*
...
@@ -3318,10 +3317,12 @@ void unblockClientFromModule(client *c) {
...
@@ -3318,10 +3317,12 @@ void unblockClientFromModule(client *c) {
*
*
* The callbacks are called in the following contexts:
* The callbacks are called in the following contexts:
*
*
* reply_callback: called after a successful RedisModule_UnblockClient() call
* reply_callback: called after a successful RedisModule_UnblockClient()
* in order to reply to the client and unblock it.
* call in order to reply to the client and unblock it.
*
* reply_timeout: called when the timeout is reached in order to send an
* reply_timeout: called when the timeout is reached in order to send an
* error to the client.
* error to the client.
*
* free_privdata: called in order to free the privata data that is passed
* free_privdata: called in order to free the privata data that is passed
* by RedisModule_UnblockClient() call.
* by RedisModule_UnblockClient() call.
*/
*/
...
@@ -3683,8 +3684,8 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) {
...
@@ -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
* C_OK is returned, otherwise C_ERR is returned and errno is set
* to the following values depending on the type of error:
* to the following values depending on the type of error:
*
*
* ENONET: No such module having the specified name.
*
*
ENONET: No such module having the specified name.
* EBUSY: The module exports a new data type and can only be reloaded. */
*
*
EBUSY: The module exports a new data type and can only be reloaded. */
int
moduleUnload
(
sds
name
)
{
int
moduleUnload
(
sds
name
)
{
struct
RedisModule
*
module
=
dictFetchValue
(
modules
,
name
);
struct
RedisModule
*
module
=
dictFetchValue
(
modules
,
name
);
...
...
src/modules/gendoc.rb
View file @
43aaf961
...
@@ -6,21 +6,29 @@ def markdown(s)
...
@@ -6,21 +6,29 @@ def markdown(s)
s
=
s
.
gsub
(
/\*\/$/
,
""
)
s
=
s
.
gsub
(
/\*\/$/
,
""
)
s
=
s
.
gsub
(
/^ \* {0,1}/
,
""
)
s
=
s
.
gsub
(
/^ \* {0,1}/
,
""
)
s
=
s
.
gsub
(
/^\/\* /
,
""
)
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
]
==
" "
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
end
# Given the source code array and the index at which an exported symbol was
# Given the source code array and the index at which an exported symbol was
# detected, extracts and outputs the documentation.
# detected, extracts and outputs the documentation.
def
docufy
(
src
,
i
)
def
docufy
(
src
,
i
)
m
=
/RM_[A-z0-9]+/
.
match
(
src
[
i
])
m
=
/RM_[A-z0-9]+/
.
match
(
src
[
i
])
name
=
m
[
0
]
name
=
name
.
sub
(
"RM_"
,
"RedisModule_"
)
proto
=
src
[
i
].
sub
(
"{"
,
""
).
strip
+
";
\n
"
proto
=
src
[
i
].
sub
(
"{"
,
""
).
strip
+
";
\n
"
puts
"## `
#{
m
[
0
]
}
`
\n\n
"
proto
=
proto
.
sub
(
"RM_"
,
"RedisModule_"
)
puts
"## `
#{
name
}
`
\n\n
"
puts
"
#{
proto
}
\n
"
puts
"
#{
proto
}
\n
"
comment
=
""
comment
=
""
while
true
while
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment