Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » HTML Source Formatting
HTML Source Formatting [message #230275] Mon, 13 April 2009 10:38 Go to next message
Dominik Raymann is currently offline Dominik Raymann
Messages: 37
Registered: July 2009
Member
Hi there,

is there a way to get a proper HTML source formatting? If I chose Source
--> Format (or CleanUp...) from the context menu my indentation gets
broken really badly (results in no indentation at all).

Is this a bug or just my eclipse installation / configuration? I'm using
Eclipse Ganymede and WST 3.0.4.

Cheers,

Dominik
Re: HTML Source Formatting [message #230291 is a reply to message #230275] Mon, 13 April 2009 15:24 Go to previous messageGo to next message
Eclipse User
Originally posted by: dcarver.starstandard.org

Dominik Raymann wrote:
> Hi there,
>
> is there a way to get a proper HTML source formatting? If I chose Source
> --> Format (or CleanUp...) from the context menu my indentation gets
> broken really badly (results in no indentation at all).
>
> Is this a bug or just my eclipse installation / configuration? I'm using
> Eclipse Ganymede and WST 3.0.4.
>

One option is to use the EclipseTidy plugin from sourceforge. We are
looking at improving the formatting, some may make it into wtp 3.1 but
more than likely it'll be a 3.2 thing.

http://eclipsetidy.sourceforge.net/

Note that if you have any annotations or markers, that eclispetidy will
loose track of those, but it does a good job of formatting the document
and is highly configurable.
Re: HTML Source Formatting [message #230299 is a reply to message #230291] Mon, 13 April 2009 16:23 Go to previous messageGo to next message
Dominik Raymann is currently offline Dominik Raymann
Messages: 37
Registered: July 2009
Member
David Carver schrieb:
> Dominik Raymann wrote:
>> Hi there,
>>
>> is there a way to get a proper HTML source formatting? If I chose
>> Source --> Format (or CleanUp...) from the context menu my indentation
>> gets broken really badly (results in no indentation at all).
>>
>> Is this a bug or just my eclipse installation / configuration? I'm
>> using Eclipse Ganymede and WST 3.0.4.
>>
>
> One option is to use the EclipseTidy plugin from sourceforge. We are
> looking at improving the formatting, some may make it into wtp 3.1 but
> more than likely it'll be a 3.2 thing.
>
> http://eclipsetidy.sourceforge.net/
>
> Note that if you have any annotations or markers, that eclispetidy will
> loose track of those, but it does a good job of formatting the document
> and is highly configurable.

Thanks for your reply.

I've already given EclipseTidy a try. However, I use a special template
language which uses the <span> element heavily in order to include
template functions (such as if-blocks and so on). The span often
contains other elements (in a way that doesn't conform to the HTML
standard) and EclipseTidy is not able to handle this. It is also not
possible to change this behaviour via the properties in the property dialog.

Since I've already started to extend the HTML editor (code completion,
outline, validation) for this template language, I am absolutely willing
to add a custom formatting functionality via
StructuredTextViewerConfigurationHTML.getContentFormatter. I see two
ways, how this could be done:
- use a custom implementation similar to the existant WST HTML Formatter
- figure out how to configure JTidy to properly handle my template
language and do a custom integration (similar to EclipseTidy)

What do you think, which one is easier to implement?
Re: HTML Source Formatting [message #230351 is a reply to message #230299] Tue, 14 April 2009 13:52 Go to previous messageGo to next message
Eclipse User
Originally posted by: dcarver.starstandard.org

Dominik Raymann wrote:

>
> What do you think, which one is easier to implement?

Personally, I'd suggest trying to fix the current formatter and
contributing patches back to Eclipse. This way the community benefits.

Dave
Re: HTML Source Formatting [message #230381 is a reply to message #230351] Wed, 15 April 2009 10:19 Go to previous messageGo to next message
Dominik Raymann is currently offline Dominik Raymann
Messages: 37
Registered: July 2009
Member
David Carver schrieb:
> Dominik Raymann wrote:
>
>>
>> What do you think, which one is easier to implement?
>
> Personally, I'd suggest trying to fix the current formatter and
> contributing patches back to Eclipse. This way the community benefits.
>
> Dave

Dave,

while I completely agree with you, I'm not sure, whether I'll be able to
do it this way. I've never contributed to a project like this before (so
it's about time to start, isn't it?). Maybe you can point me to some
resources where I can learn how to get involved (processes, workspace
set up, internal documentation, ?). I'd love to contribute and I think
that the missing HTML formatter is a real show-stopper.
Re: HTML Source Formatting [message #230420 is a reply to message #230381] Wed, 15 April 2009 16:34 Go to previous message
Eclipse User
Originally posted by: dcarver.starstandard.org

Dominik Raymann wrote:
> while I completely agree with you, I'm not sure, whether I'll be able to
> do it this way. I've never contributed to a project like this before (so
> it's about time to start, isn't it?). Maybe you can point me to some
> resources where I can learn how to get involved (processes, workspace
> set up, internal documentation, ?). I'd love to contribute and I think
> that the missing HTML formatter is a real show-stopper.

Here are some resources to help get you started:

http://wiki.eclipse.org/Platform_UI/How_to_Contribute

For getting the code you need, you'll want to check out the source code
from the WTP CVS repository. This is at /cvsroot/webtools.

The HTML information is going to be under the sourceediting/plugins and
sourceediting/test modules.

If all you are interested in working on and applying patches to is the
HTML then just check out the org.eclipse.wst.html.* related plugins.

After having reviewed this information available on the WTP wiki, I see
we are either very light on Community contribution guidelines and how
tos, or they aren't easy to find and need to be re-catagorized. I'll
see what I can come up with over the next month or two to address this
situation.

We really need updated and current team project sets as the Map files
are really only useful to committers.

Dave
Previous Topic:How do I connect a default assistant to the SourceViewer?
Next Topic:Connect Custom View to XML Editor
Goto Forum:
  


Current Time: Tue Jul 29 19:06:25 EDT 2014

Powered by FUDForum. Page generated in 0.01644 seconds