diff --git a/app/app.go b/app/app.go index 6095df19..7b00f81f 100644 --- a/app/app.go +++ b/app/app.go @@ -17,7 +17,7 @@ const ( // 版本号 // // 版本号按照 http://semver.org 中的规则 - Version = "2.16.7+20160712" + Version = "2.16.8+20160712" // 程序的正式名称 Name = "apidoc" diff --git a/input/input_test.go b/input/input_test.go index a1c7e2c0..6197e1c3 100644 --- a/input/input_test.go +++ b/input/input_test.go @@ -16,6 +16,7 @@ func TestParse(t *testing.T) { a := assert.New(t) testParse(a, "c++") + testParse(a, "d") testParse(a, "go") testParse(a, "java") testParse(a, "javascript") @@ -62,6 +63,7 @@ func TestParseFile(t *testing.T) { a := assert.New(t) testParseFile(a, "c++", "./testdata/c++/test1.c") + testParseFile(a, "d", "./testdata/d/test1.d") testParseFile(a, "go", "./testdata/go/test1.go") testParseFile(a, "java", "./testdata/java/test1.java") testParseFile(a, "javascript", "./testdata/javascript/test1.js") diff --git a/input/lang.go b/input/lang.go index c3c9540a..f5dff2d5 100644 --- a/input/lang.go +++ b/input/lang.go @@ -22,6 +22,9 @@ var langs = map[string][]blocker{ // c/c++ "c++": cStyle, + // d + "d": cStyle, + // golang "go": []blocker{ &block{Type: blockTypeString, Begin: `"`, End: `"`, Escape: `\`}, @@ -111,6 +114,7 @@ var cStyle = []blocker{ var langExts = map[string][]string{ "c#": []string{".cs"}, "c++": []string{".h", ".c", ".cpp", ".cxx", "hpp"}, + "d": []string{".d"}, "go": []string{".go"}, "java": []string{".java"}, "javascript": []string{".js"}, diff --git a/input/testdata/d/doc.d b/input/testdata/d/doc.d new file mode 100644 index 00000000..9dd43f23 --- /dev/null +++ b/input/testdata/d/doc.d @@ -0,0 +1,12 @@ +// Copyright 2016 by caixw, All rights reserved. +// Use of this source code is governed by a MIT +// license that can be found in the LICENSE file. + + +// @apidoc title of api +// @apiVersion 2.9 +// @apiBaseURL https://api.caixw.io +// @apiLicense MIT https://opensources.org/licenses/MIT +// @apiContent +// line1 +// line2 diff --git a/input/testdata/d/test1.d b/input/testdata/d/test1.d new file mode 100644 index 00000000..bd698401 --- /dev/null +++ b/input/testdata/d/test1.d @@ -0,0 +1,48 @@ +// Copyright 2016 by caixw, All rights reserved. +// Use of this source code is governed by a MIT +// license that can be found in the LICENSE file. + +import std.stdio; + +// @api POST /users/login 登录 +// @apiGroup users +// +// @apiRequest json +// @apiParam username string 登录账号 +// @apiParam password string 密码 +// +// @apiSuccess 201 OK +// @apiParam expires int 过期时间 +// @apiParam token string 凭证 +// @apiExample json +// { +// "expires": 11111111, +// "token": "adl;kfqwer;q;afd" +// } +// +// @apiError 401 账号或密码错误 +void login(http::ResponseWriter w, http::Request& r) { + writeln("/*********", "login"); + // TODO +} + +/* + * @api DELETE /users/login 注销登录 + * @apiGroup users + * + * @apiRequest json + * @apiHeader Authorization xxxx + * + * @apiSuccess 201 OK + * @apiParam expires int 过期时间 + * @apiParam token string 凭证 + * @apiExample json + * { + * "expires": 11111111, + * "token": "adl;kfqwer;q;afd" + * } + */ +void logout(http::ResponseWriter w, http::Request& r) { + writeln("logout", "*******/"); + // TODO +}