📄 980.html
字号:
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=98
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=79
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=103
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=26
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR>
<TR>
<TD colSpan=3><A title=linux知识宝库
href="index.html" tppabs="http://www.linuxhero.com/docs/index.html"><IMG height=83
src="images/header_r1_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c1.gif" width=472 border=0
name=header_r1_c1></A></TD>
<TD colSpan=3>
<form action="http://www.linuxhero.com/docs/search.html" method=get>
<table
style="BORDER-RIGHT: #c4c4c4 1px solid; BORDER-TOP: #c4c4c4 1px solid; BORDER-LEFT: #c4c4c4 1px solid; BORDER-BOTTOM: #c4c4c4 1px solid"
cellspacing=0 cellpadding=3 width="95%" border=0 align="center">
<tbody>
<tr>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif">
<div align=center><font class=normalfont>搜索文章:
<input type=hidden value=result name=action2>
<input type=radio checked value=title name=type>标题
<input type=radio value=content name=type>内容
<input type=image src="images/button_go.gif" tppabs="http://www.linuxhero.com/docs/images/button_go.gif" border=0 name=image2>
</font></div>
</td>
</tr>
<tr>
<td noWrap>
<div align="center">
<input maxlength=100 size=30 name=keyword2>
</div>
</td>
</tr></tbody>
</table>
</form>
</TD>
<TD rowSpan=2><IMG src="images/header_r1_c7.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c7.gif" width=26 border=0 name=header_r1_c7></TD>
<TD><IMG height=83 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif"><IMG height=22
src="images/header_r2_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r2_c1.gif" width=296 border=0
name=header_r2_c1></TD>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置:
<A href="index.html" tppabs="http://www.linuxhero.com/docs/index.html">本站首页</A>
<font color="#FF6699">>></font>
<A href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</A> | <A href="copyright.html" tppabs="http://www.linuxhero.com/docs/copyright.html">版权说明</A></font></DIV>
</TD>
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>c java php perl python的程序代码美化工具</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:车东 chedong@bigfoot.com<br>来自:Linux知识宝库<br>联系方式:无名<br><br>(pretty print program / source code beautifer)使用<br>
http://www.chedong.com/tech/indent_tools.html<br>
最后更新:2002-12-28 23:24:31<br>
<br>
版权声明:可以任意转载,转载时请务必标明原始出处和作者信息<br>
<br>
关键词:pretty print indent perltidy pydent astyle htmltidy source code beautifier<br>
<br>
内容摘要:写本文的目的无非是2个,首先,以前程序员缩进非常不整齐的代码非常影响我的代码阅读速度。第二,我希望新的代码(无论在什么编辑环境下编写)都能够非常好的适应公司的缩进规范,便于程序员之间的交流。<br>
<br>
当然:如果马上能从以下列表中找到你需要的就完全不必耐心的看到最后:相应工具中的文档会有更详细的使用说明<br>
<br>
c, c++ c# ==> indent astyle<br>
java ==> astyle jalopy Jacobe ImportScrbber<br>
php ==> phpCodeBeautifier<br>
perl ==> perltidy<br>
python ==> pydent<br>
<br>
程序员应该是善于沟通的,代码美化的意义在于体现了开发者对他人的尊重,使用好的编码约定可以使源代码明白、易读、准确,更加直观且与其他语言约定保持一致,从而让程序员之间更好的沟通。<br>
<br>
有统计表明缩进良好的代码可以提高代码阅读的效率40%以上,而另一个统计是软件开发工作的70%以上是维护前人的代码,因此对以往代码的格式美化往往也是系统重构(refactoring)的第一步。代码美化工具(pretty print program)的使用可以使基本的代码缩进规范成为一种更容易执行的制度。<br>
<br>
另外,如果作为部门代码规范的制订者也应该了解程序员不是机器,写代码时完全不犯代码缩进错误几乎是不可能的,另外,程序员真的不按照规范做你又能怎么办呢?所以按工具的格式化能力制定的缩进规范是一个真正有可操作性的制度。<br>
<br>
几种开放源代码的代码美化工具的介绍<br>
工具名称 适用语言 简介 安装/使用<br>
indent c indent几乎成为代码美化工具的代名词 indent是gcc附带的一个标准工具,<br>
indent [options] [input-files]<br>
indent [options] [single-input-file] [-o output-file]<br>
perltidy perl<br>
perltidy本身也是用perl写的 下载后直接运行perltidy脚本<br>
perltidy [ options ] file1 file2 file3 ...<br>
(output goes to file1.tdy, file2.tdy, file3.tdy, ...)<br>
perltidy [ options ] file1 -o outfile<br>
perltidy [ options ] file1 -st >outfile<br>
perltidy [ options ] <infile >outfile<br>
astyle c c++ java (php) 一个速度很快的C/C++/Java源代码美化工具。<br>
astyle比indent好在有很多成套的的风格定义:ansi java linux...不必记住复杂的缩进具体选项。 下载源代码解包后,make, 生成astyle可执行文件<br>
astyle [options] < Original > Beautified<br>
astyle [options] Foo.cpp Bar.cpp [...]<br>
astyle --style=ansi *.cpp<br>
我尝试过用它来格式化PHP程序也很有效(当然是不合HTML代码混在一起的纯PHP代码)。<br>
jalopy java 功能强大的JAVA代码格式化工具,除了标准界面外,命令行工具,还可作为ANT JBUILDER ECLIPSE JDEVELOPER等工具的插件使用,并提供API 从http://prdownloads.sourceforge.net/jalopy/下载<br>
并参考相应安装文档<br>
pydent python pythius包含了2个工具:<br>
pydent: 代码缩进工具<br>
pystat: 代码统计工具 下载源代码解包后:<br>
Run "python setup.py build"<br>
Run "python setup.py install"<br>
htmltidy html/xml HTML代码的纠错工具,可以帮助你的HTML代码更好的符合W3C规范,现在被称作tidy,因为它不仅只使用于HTML,也现在也适用于XHTML XML的格式化。<br>
<br>
但JSP不适合ASP PHP JSP等嵌入式脚本的代码美化<br>
<br>
<br>
下载源代码后 make 生成tidy可执行文件:<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -