Hi Mauricio,

Yeap. I've just ported the test =)

https://github.com/hatjhie/NVelocity/tree/master/src/NVelocity.Tests/Test

It will be good if we can put this break feature up in NVelocity
for .NET :)

Thanks for your helps!

Best Regards,
Hatjhie

On Mar 24, 6:36 am, Mauricio Scheffer <[email protected]>
wrote:
> Hi Hatjhie,
> Can you also port the 
> tests?https://issues.apache.org/jira/secure/attachment/12388465/ForeachBrea...
>
> --
> Mauricio
>
>
>
>
>
>
>
> On Wed, Mar 23, 2011 at 4:52 AM, hatjhie <[email protected]> wrote:
> > Hi Mauricio,
>
> > Thanks a lot for your helps =)
>
> > Yeah. Now I'm getting used to github :D.
>
> > I have checked in my changes in the project at github.
>
> > I wonder how to solve the break exception?
>
> > Thanks!
>
> > Best Regards,
> > Hatjhie
>
> > On Mar 23, 11:29 am, Mauricio Scheffer <[email protected]>
> > wrote:
> > > Hi Hatjhie,
>
> > > While you can edit files directly on github, that feature is only
> > intended
> > > for quick edits, not for development.
> > > From git-gui, you should have your own fork as a remote. The repo
> > location
> > > looks like [email protected]:hatjhie/NVelocity.git
> > > If you don't have it yet, add it (in git-gui: Remote -> Add)
> > > You can test it by fetching from this remote (in git-gui: Remote -> Fetch
> > > From)
> > > After making your changes in Visual Studio, click Rescan on git-gui. Your
> > > modified files should show up in the "Unstaged Changes" frame. Select
> > them,
> > > then click Commit -> Stage to commit. Enter the commit message, then
> > click
> > > commit.
> > > Once committed, you can publish your changes to your github fork by
> > > selecting Remote -> Push.
> > > You can make multiple commits before pushing.
> > > Let us know if you have any other issues.
>
> > > Cheers,
> > > MauricioOn Wed, Mar 23, 2011 at 12:16 AM, hatjhie <
> > [email protected]> wrote:
> > > > Hi All,
>
> > > > Yeah. I would love to add it but I'm still trying to familiarize
> > > > myself with github. Haha. Newbie :D
>
> > > > I now can figure it out how to add new files. Thanks to Mauricio.
>
> > > > But, how to edit files using gitbash? Which command should I use to
> > > > make the github forks synchronize with my local?
>
> > > > I've tried git add command to update the file but it's not working.
>
> > > > Any idea?
>
> > > > I've updated my fork:
>
> > > > ssh: [email protected]:hatjhie/NVelocity.git
> > > > Web Url:https://github.com/hatjhie/NVelocity
>
> > > > Including the update for break, and foreach directives. Please try it,
> > > > because I don't know why it's still make the errors when trying to
> > > > break the loop.
>
> > > > I've no idea about this. >.<
>
> > > > Thanks for your helps!
>
> > > > Best Regards,
> > > > Hatjhie
>
> > > > On Mar 23, 4:55 am, John Simons <[email protected]> wrote:
> > > > > Hi Hatjhie,
>
> > > > > I don't think #stop is implemented either.
> > > > > If you have the time and wiliness you may want to implement that one
> > > > > too :)
>
> > > > > Cheers
> > > > > John
>
> > > > > On Mar 22, 8:59 pm, hatjhie <[email protected]> wrote:
>
> > > > > > Hi Mauricio,
>
> > > > > > Sorry for asking noob question.
>
> > > > > > I have created the trunk which is here:
>
> >https://github.com/hatjhie/NVelocity/tree/master/src/NVelocity/Runtim.
> > > > ..
>
> > > > > > However I'm still figuring out how to add new file inside there.
>
> > > > > > I tried, googled, and found thishttp://
> > > > nathanj.github.com/gitguide/tour.html
>
> > > > > > I've used the Git Gui but no luck, it's denied. The tool asked me
> > > > > > about the public key, which I don't know how to get it.
>
> > > > > > Should it be any other way beside this?
>
> > > > > > Thanks a lot for your helps!
>
> > > > > > Best Regards,
> > > > > > Hatjhie
>
> > > > > > On Mar 22, 2:15 pm, Mauricio Scheffer <[email protected]>
> > > > > > wrote:
>
> > > > > > > Can you push your changes to a fork in github, so we can review
> > them?
> > > > > > > Also, you should only catch BreakException, not all exceptions.
>
> > > > > > > --
> > > > > > > Mauricio
>
> > > > > > > On Tue, Mar 22, 2011 at 2:24 AM, hatjhie <
> > [email protected]>
> > > > wrote:
> > > > > > > > Hi All,
>
> > > > > > > > I have changed accordingly based on the java file in JIRA, but
> > I've
> > > > > > > > encountered this problem
>
> > > > > > > > Encountered "\r\n" at line 37, column 31.Was expecting one of:
> > > > > > > > "(" ...    <WH
> > > > > > > > ITESPACE> ... when I use my "#break"
>
> > > > > > > > :D
>
> > > > > > > > Break.cs
>
> > > > > > > > namespace NVelocity.Runtime.Directive
> > > > > > > > {
> > > > > > > >    public class Break : Directive
> > > > > > > >    {
> > > > > > > >        /**
> > > > > > > >         *  simple init - init the tree and get the elementKey
> > from
> > > > > > > >         *  the AST
> > > > > > > >         * @param rs
> > > > > > > >         * @param context
> > > > > > > >         * @param node
> > > > > > > >         * @throws TemplateInitException
> > > > > > > >         */
> > > > > > > >        public override void Init(IRuntimeServices rs,
> > > > > > > > IInternalContextAdapter context, INode node)
> > > > > > > >        //throws TemplateInitException
> > > > > > > >        {
> > > > > > > >            base.Init(rs, context, node);
> > > > > > > >        }
>
> > > > > > > >        public override string Name
> > > > > > > >        {
> > > > > > > >            get
> > > > > > > >            {
> > > > > > > >                return "break";
> > > > > > > >            }
> > > > > > > >            set { throw new NotSupportedException(); }
> > > > > > > >        }
>
> > > > > > > >        /**
> > > > > > > >         * Return type of this directive.
> > > > > > > >         * @return The type of this directive.
> > > > > > > >         */
> > > > > > > >        public override DirectiveType Type
> > > > > > > >        {
> > > > > > > >            get
> > > > > > > >            {
> > > > > > > >                return DirectiveType.LINE;
> > > > > > > >            }
> > > > > > > >        }
>
> > > > > > > >        /**
> > > > > > > >         * Break directive does not actually do any rendering.
> > > > > > > >         *
> > > > > > > >         * This directive throws a BreakException
> > (RuntimeException)
> > > > > > > > which
> > > > > > > >         * signals foreach directive to break out of the loop.
> > Note
> > > > > > > > that this
> > > > > > > >         * directive does not verify that it is being called
> > inside
> > > > a
> > > > > > > > foreach
> > > > > > > >         * loop.
> > > > > > > >         *
> > > > > > > >         * @param context
> > > > > > > >         * @param writer
> > > > > > > >         * @param node
> > > > > > > >         * @return true if the directive rendered successfully.
> > > > > > > >         * @throws IOException
> > > > > > > >         * @throws MethodInvocationException
> > > > > > > >         * @throws ResourceNotFoundException
> > > > > > > >         * @throws ParseErrorException
> > > > > > > >         */
> > > > > > > >        public override bool Render(IInternalContextAdapter
> > context,
> > > > > > > > TextWriter writer, NVelocity.Runtime.Parser.Node.INode node)
> > > > > > > >        {
> > > > > > > >            throw new BreakException();
> > > > > > > >        }
> > > > > > > >    }
>
> > > > > > > >    public class BreakException : System.Exception
> > > > > > > >    {
>
> > > > > > > >    }
> > > > > > > > }
>
> > > > > > > > and in the Foreach.cs, I modified this part:
>
> > > > > > > > try
> > > > > > > >                    {
> > > > > > > >                        if (isFancyLoop)
> > > > > > > >                        {
> > > > > > > >                            if (counter == counterInitialValue)
> > > > > > > >                            {
>
> > > > > > > > ProcessSection(ForeachSectionEnum.BeforeAll, sections, context,
> > > > > > > > writer);
> > > > > > > >                            }
> > > > > > > >                            else
> > > > > > > >                            {
>
> > > > > > > > ProcessSection(ForeachSectionEnum.Between, sections, context,
> > > > writer);
> > > > > > > >                            }
>
> > > >  ProcessSection(ForeachSectionEnum.Before,
> > > > > > > > sections, context, writer);
>
> > > > > > > >                            // since 1st item is zero we invert
> > odd/
> > > > > > > > even
> > > > > > > >                            if ((counter - counterInitialValue)
> > % 2
> > > > ==
> > > > > > > > 0)
> > > > > > > >                            {
>
> > > >  ProcessSection(ForeachSectionEnum.Odd,
> > > > > > > > sections, context, writer);
> > > > > > > >                            }
> > > > > > > >                            else
> > > > > > > >                            {
>
> > > > > > > > ProcessSection(ForeachSectionEnum.Even, sections, context,
> > writer);
> > > > > > > >                            }
>
> >  ProcessSection(ForeachSectionEnum.Each,
> > > > > > > > sections, context, writer);
>
> >  ProcessSection(ForeachSectionEnum.After,
> > > > > > > > sections, context, writer);
> > > > > > > >                        }
> > > > > > > >                        else
> > > > > > > >                        {
> > > > > > > >                            bodyNode.Render(context, writer);
> > > > > > > >                        }
> > > > > > > >                    }
> > > > > > > >                    catch
> > > > > > > >                    {
> > > > > > > >                        bodyNode.Render(context, writer);
> > > > > > > >                        break;
> > > > > > > >                    }
> > > > > > > >                    counter++;
>
> > > > > > > > Any suggestion about this? I'm very new about this NVelocity
> > but I
> > > > > > > > found that the component's very useful :D
>
> > > > > > > > Thanks for your helps
>
> > > > > > > > Best Regards,
> > > > > > > > Hatjhie
>
> > > > > > > > On Mar 22, 11:02 am, hatjhie <[email protected]>
> > wrote:
> > > > > > > > > Hi Mauricio,
>
> > > > > > > > > Thanks a lot for your helps.
>
> > > > > > > > > I'll try this and once I've tried, I'll update the result.
>
> > > > > > > > > Best Regards,
> > > > > > > > > Hatjhie
>
> > > > > > > > > On Mar 22, 10:00 am, Mauricio Scheffer <
> > > > [email protected]>
> > > > > > > > > wrote:
>
> > > > > > > > > > There are two attached files in the JIRA issue, they
> > implement
> > > > the
> > > > > > > > feature
> > > > > > > > > > in Apache Velocity.
> > > > > > > > > > Download these patches and
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to