`
toflyhigh
  • 浏览: 7624 次
  • 性别: Icon_minigender_1
  • 来自: 广州
文章分类
社区版块
存档分类
最新评论

General Formatting Conventions

阅读更多
The Open For Business projects follows the Sun coding standards for Java source code.
For information regarding this standard please visit http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

HTML code should be XHTML compliant. Groovy files should follow the same convention as Java files.

In accordance with this standard we use 4 space indention rather than tabs, and set the tab size to 8 spaces to make code with tabs easier to pick out. Make sure no code contains tab characters.
For XML/HTML/FTL files we follow the standard XML/HTML/FTL format (TODO: add link to a reference here). XML/HTML/FTL files should use 2 spaces instead of 4, but there are still number of files using 4 space indention. So it's better to keep the indentation used in each file to avoid confusion when committing.

We don't want tab characters in text files in SVN, because different editors and tools interpret tabs differently. All indentation should be done purely with spaces.

To change tabs to spaces in Eclipse, change these preferences in Window -> Preferences ->

   1. Java -> Code Style -> Code Formatter -> Show... -> Java Conventions [built-in] -> Indentation, select Tab policy as "space only". Enter a new name for this profile and click "OK".
   2. Java -> Editor -> Typing, and check "Insert spaces for tab".
   3. Ant -> Editor -> Formatter, and uncheck "Use tab character instead of spaces".
   4. If you installed Colorer, Colorer Library Editor -> Uses spaces instead of tabs.
   5. If you installed XML Buddy, XMLBuddy -> Formatting -> Uses spaces instead of tabs.
   6. If you installed Oxygen, Oxygen -> Editor -> Format -> uncheck Indent with tabs, indent size 4.
   7. Unfortunaltely neither of the 2 main FreeMarker pluggin have similar functionnality yet. But there is a solution :
          * Install AnyEdit plugin (http://andrei.gmxhome.de/eclipse/) and set its parameters in General -> Editors -> AnyEdit Tools. When using AnyEdit plugin, you should set it to
                o Strip trailing whitespaces
                o Create new line at the end of file
                o Convert tab to space (it's by default in last versions)

In Eclipse, for Java, you may use Ctrl+I to be sure of correct indentation.
分享到:
评论

相关推荐

    System.Net.Http.Formatting.dll

    System.Net.Http.Formatting.dll

    System.Net.Http.Formatting各版本.zip

    在.NET框架中,`System.Net.Http.Formatting`是一个关键的组件,主要用于处理HTTP客户端的输入和输出数据格式化。这个库提供了对JSON(JavaScript Object Notation)和XML等数据格式的支持,使得C#开发者能够方便地...

    System.Net.Http.Formatting 4.0各版本

    System.Net.Http.Formatting 4.0 是ASP.NET Web API框架中的一个重要组成部分,主要用于处理HTTP消息的序列化和反序列化,支持JSON、XML等多种数据格式。这个库为C#开发者提供了强大的工具,使得在构建RESTful服务时...

    System.Net.Http.Formatting.xml

    System.Net.Http.Formatting.xml

    System.Net.Http.Formatting

    标题“System.Net.Http.Formatting”指的是.NET Framework或.NET Core中的一个关键组件,它是ASP.NET Web API框架的一部分,主要用于处理HTTP请求和响应的格式化工作。这个组件使得开发人员能够轻松地支持多种数据...

    Block Formatting Contexts Demo

    Block Formatting Contexts(块级格式化上下文)是CSS布局中的一个重要概念,它定义了元素如何在其内部以及与其他元素交互时进行布局。在Block Formatting Contexts Demo中,我们可以深入理解这一概念并探索其实际...

    Basic Visual Formatting in CSS

    formatting ■ Explore key concepts of inline layout: anonymous text, em box, content area, leading, inline box, and line box ■ Understand formatting differences between nonreplaced and replaced ...

    Box Formatting Context

    BFC是Box Formatting Context的缩写

    string_formatting.py

    string_formatting

    Excel: Formatting

    ### Excel: 格式化详解 #### 概述 Microsoft Excel 是一款强大的电子表格软件,提供了多种格式化选项,帮助用户使数据呈现更加美观、易读。格式化操作包括更改行高、列宽以及单元格格式等,这些功能极大地提高了...

    address-formatting, 设置地理地址格式的模板.zip

    address-formatting, 设置地理地址格式的模板 电子邮件地址格式一个快速示例给定一组地址部件 house_number: 17 road: Rue du Médecin-Colonel Calbairac neighbourhood: Lafourguet

    RTW embaded coder_rtw_matlab_Before_

    This section includes the following topicsPrerequisites What you need to know before reading this ...Time WorkshopEmbedded Coder.Typographical Conventions Formatting conventions used in this document

    netbeans-psr-formatting, PSR 1 & 2的NetBeans配置设置.zip

    netbeans-psr-formatting, PSR 1 & 2的NetBeans配置设置 用于NetBeans的 PSR自动格式库提供了 PHP PSR1 和 PSR2标准的源代码自动格式设置。尽管并不提供对所有和 PSR2'规则'的自动格式支持( 例如。 重构类和方法名...

    Conditionally Formatting Data: Examples and Guidelines

    好多“条件格式”例子; 实用,易学; 从Office2007 Help

    前端开源库-ape-formatting

    【ape-formatting】是一个专为前端开发者设计的开源库,主要功能是对文件进行格式化处理,特别是针对APE(Advanced Post Effects)格式的文件。在前端开发中,数据格式的处理和展示是至关重要的,ape-formatting 库...

    04_string_formatting.py

    04_string_formatting

    Python库 | gspread-formatting-0.3.7.tar.gz

    《Python库gspread-formatting-0.3.7:优雅操作Google Sheets的利器》 在Python的世界里,有一个强大的库,名为gspread-formatting,它为开发者提供了方便、高效的手段来管理和格式化Google Sheets。这个库是...

    前端开源库-strip-formatting

    这就是"strip-formatting"这个前端开源库的作用。它专注于删除文本中的格式,尤其是那些无用的前导空格,从而让数据更纯净,更容易处理。 首先,让我们深入了解一下什么是前导空格。前导空格是指在一行文本的开始...

    Python库 | lb_dev_formatting-0.0.1-py3-none-any.whl

    《Python库 lb_dev_formatting-0.0.1-py3-none-any.whl:解析与应用》 在Python的世界里,库是开发者不可或缺的工具,它们提供了丰富的功能,简化了编程工作。今天我们要关注的是一款名为`lb_dev_formatting`的...

Global site tag (gtag.js) - Google Analytics