HTML重构:工具篇


本文是《HTML重构》读书笔记的第三篇:工具篇;从战略到战术,真正实践过程中没有好的工具HTML重构也将成为开发者的噩梦。所以之前就有朋友问是否有工具可以减轻工作量,由于作者介绍的工具多是Java开发的,因此我把作者给出的工具列表作为线索给出了更多可能选择。

  如果你不知道我在做什么,那么请看前情提要:

HTML重构:战略篇

HTML重构:战术篇

 

   嗯哼,我们开始:

  版本管理工具Version Control

  作者原来的标题是"Backups, Staging Servers, and Source Code Control"

  难以想象没有Source Control我们的工作将会是什么模样,早在1972年就已经有源码管理软件问世。你也许在使用SVN或者VSTS,它们都提供基础的服务:

  文档存储Backup and Restore

  保持文档一致性Synchronization

  文件比较合并Diff&Merge

  Sandboxing:可以按照需要搭建一个方便的沙盒,记得签入之前清理代码:)

  从软件开发过程的角度

  跟踪开发进度,团队协同工作

  根据需要做版本回滚:The Big Undo

  根据需要做分支(Branches)打标签Tags,分支可以看做是一个巨大的沙盒

  标识变化,跟踪变化Track Changes&Ownership

  大家可以看看关于Source Control的资料:

  Revision control

  源文档 <http://en.wikipedia.org/wiki/Revision_control>

  Source Code Control System (SCCS)

  源文档 <http://en.wikipedia.org/wiki/Source_Code_Control_System>

  Subversion

  源文档 <http://subversion.tigris.org/>

  Pragmatic Version Control: Using Subversion (The Pragmatic Starter Kit Series)(2nd Edition)

  源文档 <http://www.douban.com/subject/2038779/>

  Pragmatic Version Control Using CVS

  源文档 <http://www.douban.com/subject/1313341/?i=1>

  页面验证工具Validators

  W3C在线验证工具

  源文档 <http://validator.w3.org/>

  提供三种验证方式:提交URL,提交文件,直接输入代码

  The Log Validator

  一个Perl的命令行工具,可以对整站进行验证。www.w3.org/QA/Tools/LogValidator/

  Xmllint

  纯XML验证工具,从http://xmlsoft.org/可以下载.除了这个命令行工具,你可以在UltraEdit中找到它。

  Visual Studio

  在Visual Studio中打开一个页面文件,你可以看到一个Target schema for validation的下拉列表框,你可以在这里选择要用什么标准来做验证,而且Error List框中会列出所有的错误和警告信息.

  工具名称

  开发者

  开发语言

  DSD Processor

  Anders Moller Michael I. Schwartzbach

  Java

  Jing

  James Clark

  Java

  PyTREX

  James Tauber

  Python

  Sample TREX implementation

  James Clark

  Java

  Schematron

  Rick Jelliffe

  Perl, Python, XSLT

  Schematron.NET

  NMatrix

  C#

  Sun MSV Schematron Add-on

  Sun Microsystems

  Java

  Sun Multi-Schema Validator

  Sun Microsystems

  Java

  VBRELAXNG

  YONEKURA Koji

  Visual Basic

  XML Schema Validator

  Richard Tobin Henry Thompson

  Python

  测试工具

  测试对于重构的重要性是毋庸置疑的,我还是援引《Refactoring: Improving the Design of Existing Code》中的阐述:

  "If you want to refactor, the essential precondition is having solid tests. Even if you are fortunate enough to have a tool that can automate the refactorings, you still need tests. It will be a long time before all possible refactorings can be automated in a refactoring tool."

  HtmlUnit http://htmlunit.sourceforge.net/

  JsUnit www.junit.org/

  HttpUnithttp://httpunit.sourceforge.net/

  JWebUnit

  FitNessehttp://fitnesse.org/

  Selenium

  Visual Studio测试工具集

  或者去SF上去翻翻:http://sourceforge.net/search/?words=unit&sort=score&sortdir=desc&offset=10&type_of_search=soft&pmode=0

  正则表达式工具

  正则表达式的作用自不必多讲,已经被包装成程序员的X种武器之一。同样的正则表达式工具太多了,推荐:

  UltraEdit

  Visual Studio :记得查找的时候勾选正则表达式选项

  VisualRegex:一个小而强大的正则表达式工具,支持从文本构造正则表达式

  Html清理工具

  作者推荐了Tidy和Tagsoup,其中Tidy我找到了它的.net版本:

  Tidy & TidyForNet

  TidyForNet and wvForNet provide a native .NET/Mono Wrapper for HTML Tidy and wvWare, using C# and interop. It programmers, using languages such as C# or Visual Basic .NET to interact with HTML Tidy and wvWare. Both wrappers run on Windows and Linux.

  源文档 <http://sourceforge.net/projects/tidyfornet/>

  源文档 <http://sourceforge.net/projects/tidy/>

  Tagsoup

  http://home.ccil.org/~cowan/XML/tagsoup/

  XSLT工具

  维基百科上对XSLT的描述:Extensible Stylesheet Language Transformations (XSLT) is an XML-based language used for the transformation of XML documents into other XML or "human-readable" documents. The original document is not changed; rather, a new document is created based on the content of an existing one. The new document may be serialized (output) by the processor in standard XML syntax or in another format, such as HTML or plain text.[3] XSLT is most often used to convert data between different XML schemas or to convert XML data into HTML or XHTML documents for web pages, creating a dynamic web page, or into an intermediate XML format that can be converted to PDF documents.

  As a language, XSLT is influenced by functional languages,and by text-based pattern matching languages like SNOBOL and awk. Its most direct predecessor was DSSSL, a language that performed the same function for SGML that XSLT performs for XML. XSLT can also be considered as a Turing-complete template processor.

  源文档 <http://en.wikipedia.org/wiki/XSLT>

  XSLT使得数据和呈现分离,将理论落实到实践,它的工具:

  工具名称

  开发者

  平台

  FOA

  Fabio Giannetti

  Java

  HTML-Kit

  Chami.com

  Win32

  XPath Visualizer

  Alexandre Fayolle

  Java

  XSL Tester

  VBXML.COM

  Win32

  XSLT-process

  Ovidiu Predescu

  Emacs

  xslide

  Mulberry Technologies

  Emacs

  4Suite

  Fourthought

  Python 2.x

  MDC-XSL

  Minoru Development Corporation

  C++, Linux

  Pyana

  Brian Quinlan

  Python

  SAXON

  Michael H. Kay

  Java

  Sablotron

  Ginger Alliance

  Win32

  TclXSLT

  Steve Ball

  tcl

  Unicorn XSLT Processor

  Unicorn Enterprises

  Win32

  XML::LibXSLT

  Matt Sergeant

  Perl

  XML::XSLT

  Geert Josten Egon Willighagen

  Perl

  XSLTC

  Olivier Gerardin

  C++

  XT

  James Clark Bill Lindsey

  Java

  Xalan-C++

  The Apache XML Project

  C++

  Xalan-Java

  The Apache XML Project

  Java

  jd.xslt

  Johannes D?bler

  Java

  libxslt

  Daniel Veillard

  C

  总结

      昨天看香港金像奖颁奖典礼没写完,今天补上功课.

   本文是《HTML重构》读书笔记的最后一篇,前面我们已经从战略和战术的层面了解了HTML重构,真正的HTML重构实践过程中我们可能在Visual Studio中就可以完成所有的工作,本文介绍的工具仅仅是一个开拓视野作用。

   Html重构介绍的差不多了,但是它仅仅是网站重构过程中的其中一个环节而已,前面的路还长着呢


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3