1、 本科毕业设计说明书(论文) (2012 届)届) 论文题目 JavaScript 在线 API 文档生成 I 摘要摘要 JavaScript 是目前最流行的脚本语言。它起初是为网页提供交互能力而设计 的一门基于对象的普通脚本语言。 但随着一些 Web 新标准的出现和一些像 Nodejs 之类的 JavaScript 客户端宿主程序的流行,JavaScript 的用途也越来越广,一个 JavaScript 的项目也随之变大。 因此现在对 JavaScript 项目的 API 文档的需求也迅 速膨胀。 为了将作者从手动书写 API 文档的繁琐过程中解脱出来,必须要有一个强大 的工具能够提取代码中
2、的注释,并自动生成一份完整的 API 文档。传统的一些 JavaScript 文档生成项目,比如 jsdoc,只能生成比较简单的文档,无法很好地满 足现在的新需求。本文研究对 JavaScript 源码中的注释进行解析,然后提取有用 的 API 信息,并最后生成一个完整的文档页面供读者阅读。解析过程充分考虑了 JavaScript 语言的灵活特性,让 JavaScript 源码作者可以快速地为自己的代码生成 对应的文档。 同时为了方便用户进行文档生成操作,使用 C#开发一个 WinForm软件。生 成的文档是一个普通的网页,用户可以自定义文档界面模板。生成的文档可以放 在 ASP.NET 服务
3、器上直接运行。 读者可以在线阅读文档, 并在文档的任何一页添 加评论。 关键词:关键词:JavaScript, API, 文档生成, WinForm I Abstract JavaScript is the most popular script language nowadays, which is designed as a simple object-based script language to provide the ability of interaction for web pages at first. But along with the appearance of new
4、 web standards and the popularity of some JavaScript clients like Nodejs, the usage of JavaScript increases soon and the JavaScript projects become more complex, which leads to new requirement of JavaScript documentation as well. To avoid authors writing API Document word by word, there should be a
5、powerful tool to export an API document from the source code automatically. The traditional related projects such as Jsdoc show their shortcoming when meeting new requirements. This article focuses on analyzing source code of JavaScript and then generating a full API document. The analyzing program
6、is fit for JavaScript, which can save a lot of time for JavaScript authors. This article also talks about developing a program of WinForm to make it easier to operate. On the other hand, users can custom the templates of document if needed. The generated API document can run on ASP.NET server directly. Readers can view the document online and leave their comments on any page. Keywords:JavaScript, API, Document Generator, WinForm II 目录目录 摘要摘要I ABSTRACT I 第一章第一章 绪论绪论 3 1.1 研究开发的目的 3 1