Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    microalps
    @microalps
    This is the state I see right now. What's definitely clear to me is that context does not belong in RenderParameters and Render method itself should accept Context directly. That would be a breaking change, but otherwise the API is totally confusing.
    microalps
    @microalps
    @daviburg I'm probably missing something in my research - I did this purely off GitHub without verifying anything in VS. A refactor would probably make this easier to understand and eventually document on the wiki.
    David burg
    @david_burg_twitter
    Hi folks. A heads-up that I am going offline to use much unused carry-over vacations days before they vanish at the end of the calendar year.
    So if I'm unresponsive to PR review requests, it's because I'm enjoying baguette, foie gras and wine in France!
    And cheese, don't forget the many cheeses.
    Sébastien Ros
    @sebastienros
    And the local choucroute I bet. Enjoy!
    microalps
    @microalps
    @david_burg_twitter @tgjones My latest PR didn't kick off any CI. Did something change recently?
    Tim Jones
    @tgjones
    Looks like there's a problem on GitHub's end, with the webhook: https://www.githubstatus.com/incidents/tyc8wpsgr2r8
    microalps
    @microalps
    Strange that it lets me merge though without the webhook working . Oh well.
    microalps
    @microalps
    It kicked off and CI + codecov came through. Thanks @tgjones
    @david_burg_twitter @daviburg needs your stamp of approval
    David burg
    @david_burg_twitter
    Where do I need to approve?
    microalps
    @microalps
    code review on my PR please @david_burg_twitter
    dotliquid/dotliquid#475 - not sure if all the permutations are overkill
    David burg
    @david_burg_twitter
    Review done. Minor code cosmetic suggestions on the test code.
    microalps
    @microalps
    Applied changes, that was easy. Will merge once CI is done.
    microalps
    @microalps
    Error publishing package. NuGet server returned 403: The specified API key is invalid, has expired, or does not have permission to access the specified package.
    @tgjones you last updated this Feb 2021. I assume it had a 1 yr lifetime. Please update again...
    microalps
    @microalps
    ping @tgjones
    Tim Jones
    @tgjones
    I've regenerated the NuGetKey, and updated appveyor.yml with (the encrypted version of) it.
    Tim Jones
    @tgjones
    Yeah, seems like it's worked.
    microalps
    @microalps
    Thanks Tim!
    microalps
    @microalps
    @david_burg_twitter what are your thoughts about #472
    Anusha Karaka
    @AnushaKaraka
    @david_burg_twitter @tgjones code review on my PR please dotliquid/dotliquid#477
    microalps
    @microalps
    @AnushaKaraka didn't see any push to address my PR review. If you fix, I can merge.
    7 replies
    David burg
    @david_burg_twitter
    Reviewed
    microalps
    @microalps
    @david_burg_twitter dotliquid/dotliquid#478 is ready for your review as discussed yesterday
    David burg
    @david_burg_twitter
    👍 reviewed.
    microalps
    @microalps
    What is your thought about sharing the regex? Where?
    microalps
    @microalps
    Pushed my changes. Let me know if we can merge.
    microalps
    @microalps
    I added a new issue dotliquid/dotliquid#481 as @tgjones doesn't seem to get gitter notifications consistently. It is a followup to conversations I had privately with @laedit and trying to resolve.
    David Burg
    @daviburg
    Is Tim Jones the only person with access to the domain name and hosting? Anyone else has shared admin access to either? (Is there an 'at all' tag for gitter to broadcast?)
    David Burg
    @daviburg
    @tgjones could you nominate additional project owners for DotLiquid at https://github.com/orgs/dotliquid/people so they can do project settings maintenance?
    Tim Jones
    @tgjones
    Hi @daviburg - I've given you and @microalps admin permissions for the DotLiquid org.
    David Burg
    @daviburg
    Thank you, much appreciated. I do see the project settings page now.
    David Burg
    @daviburg
    Please review: dotliquid/dotliquid#484
    microalps
    @microalps
    @daviburg What do you think about dotliquid/dotliquid#265 - this is due to drop returning true on ContainsKey always. It is needed to allow BeforeMethod to execute. How should we address? Pretty annoying. Separate issue is an easier way to capture those errors in thread safe mode, but one issue at a time.
    David Burg
    @daviburg
    Hi. I'm not familiar or do not remember at the moment what BeforeMethod takes care of.
    Also... starting an on-call rotation in a few hours, so I will be quite unresponsive, sorry.
    Would be good to add your thoughts on the github issue 'though, to add that increment of figuring it out.
    schlechtOptimiziert
    @schlechtOptimiziert

    Hi, I am trying to use the DotLiquid stuff in my Project and I already have a class I would like to use as the Render object. This won't work because the object is not a an
    anonymous object. How can I render stuff with an not anonymous object?
    -
    -
    -
    using DotLiquid;

    class main
    {
    public static void Main()
    {
    var template = Template.Parse("{{Class.someStr}}");
    var obj = new CLS();
    var hash = Hash.FromAnonymousObject(obj);
    var str = template.Render(hash);
    Console.WriteLine(str);
    }
    }

    public class CLS : ILiquidizable
    {
    public CLR Class { get; set; } = new();

    public object ToLiquid()
    {
        return this;
    }

    }

    public class CLR : ILiquidizable
    {
    public string someStr { get; set; } = "some thing";

    public object ToLiquid()
    {
        return this;
    }

    }

    microalps
    @microalps
    You have various options. 1) You can inherit the drop class and skip the ToLiquid 2) You can use ILiquidizable and in ToLiquid return a Hash or other whitelisted object. This gives you full control about the object DotLiquid sees and which properties are exposed 3) One of the other options at https://github.com/dotliquid/dotliquid/wiki/DotLiquid-for-Developers#rules-for-template-rendering-parameters
    schlechtOptimiziert
    @schlechtOptimiziert
    image.png

    Thanks, that helped a lot.
    Probably this should be added to the docs. At least, that you should return a hash in the ToLiquid method. I searched through the whole solution and did not find one example where this is shown.
    This link "https://github.com/dotliquid/dotliquid/wiki" is also nice you should show it where the arrow points in the picture over this message.

    using DotLiquid;

    class main
    {
    public static void Main()
    {
    var template = Template.Parse("{{Class.someStr}}");
    var obj = new CLS();
    var hash = Hash.FromAnonymousObject(obj);
    var str = template.Render(hash);
    Console.WriteLine(str);
    }
    }

    public class CLS : ILiquidizable
    {
    public CLR Class { get; set; } = new();

    public string foo { get; set; } = "bar";
    
    public object ToLiquid()
    {
        return Hash.FromAnonymousObject(this);
    }

    }

    public class CLR : ILiquidizable
    {
    public string someStr { get; set; } = "some thing";

    public object ToLiquid()
    {
        return Hash.FromAnonymousObject(this);
    }

    }

    schlechtOptimiziert
    @schlechtOptimiziert
    May I ask one more question. How can in access properties of the base class of an object?
    This workaround works, but is very annoying to implement.
    using DotLiquid;
    
    class main
    {
        public static void Main()
        {
            var template = Template.Parse("{{Class.baseFoo}}");
            var str = template.Render(Hash.FromAnonymousObject(new CLS()));
            Console.WriteLine(str);
        }
    }
    
    public class CLS : ILiquidizable
    {
        public CLR Class { get; set; } = new();
        public object ToLiquid()
        {
            return Hash.FromAnonymousObject(this);
        }
    }
    
    public class CLR : Liquidizable
    {
        public string someStr { get; set; } = "some thing";
    
        public string baseFoo => foo;
    }
    
    public abstract class Liquidizable : ILiquidizable
    {
        public string foo { get; set; } = "bar";
        public DateTime time { get; set; } = DateTime.Now;
    
        public object ToLiquid()
        {
            return Hash.FromAnonymousObject(this);
        }
    }
    schlechtOptimiziert
    @schlechtOptimiziert
    Nevermind there is a default property in the Hash.FromAnonymousObject(this, true) which is by default false, so properties from upper classes are not included.
    schlechtOptimiziert
    @schlechtOptimiziert

    Hi, I ran into a Problem with the ILiquidizable Interface again.
    My problem is best explained in code:

    void Main()
    {
        var template = "{% for classe in classes %} {{classe.string2}} {{classe.string3}} {{classe.string4}} {% endfor %}";
    
    
        var temp = Template.Parse(template).Render(Hash.FromAnonymousObject(new class1(), true));
    
        Console.WriteLine(temp);
    }
    
    class class1 : ILiquidizable
    {
        public class2[] classes { get; set; } = new class2[] { new class2() };
    
        public object ToLiquid()
        {
            return Hash.FromAnonymousObject(this, true);
        }
    }
    
    class class2 : class3, ILiquidizable
    {
        public string string2 { get; set; } = "foo";
    
        public object ToLiquid()
        {
            return Hash.FromAnonymousObject(this, true);
        }
    }
    
    class class3 : class4
    {
        public string string3 { get; set; } = "bar";
    }
    
    class class4
    {
        public string string4 { get; set; } = "foolbar";
    }

    It returns: "foo bar "

    It does not find "Foolbar" so the true in "Hash.FromAnonymousObject(this, true);" does not support the second base class. Is there a solution for this? Shall I open an issiue?

    Extra information:
    I want a solution where I don't have to change neither class3 nor class4.

    Sunny Li
    @sunniejai
    I noticed that in my templates when im trying to use a filter like "escape" or "default", its case sensitive. Ie {{ someVar | default: "asdf" }} doesn't work but {{ someVar | Default: "asdf" }} works, is there anyway to make it not case sensitive?
    microalps
    @microalps
    See https://github.com/dotliquid/dotliquid/wiki/DotLiquid-Syntax-Compatibility#naming-convention for explanation of casing. You can create your own naming convention if you'd like a case-insensitive one (VB style?)
    @schlechtOptimiziert sounds like you are having the same issue as dotliquid/dotliquid#221
    See if TigerPoint's suggestion helps, and feel free to open a new issue now that you have a clearer picture.
    schlechtOptimiziert
    @schlechtOptimiziert

    Since you can not have a class as item in the dictionary and access the object this solution would be very annoying to implement. You would literally convert all your objects into nestled Dictionaries.

    I would prefer to just change the FromAnonymousObject methode. I opened an issue #499.