GitHub PullRequestEvent at 2014-12-02 12:17:56
Repository: dotliquid
Actor: azturner
Payload: {"action":"opened","number":118,"pull_request":{"url":"https://api.github.com/repos/formosatek/dotliquid/pulls/118","id":25337358,"html_url":"https://github.com/formosatek/dotliquid/pull/118","diff_url":"https://github.com/formosatek/dotliquid/pull/118.diff","patch_url":"https://github.com/formosatek/dotliquid/pull/118.patch","issue_url":"https://api.github.com/repos/formosatek/dotliquid/issues/118","number":118,"state":"open","locked":false,"title":"Add support for displaying and comparing enums","user":{"login":"azturner","id":548180,"avatar_url":"https://avatars.githubusercontent.com/u/548180?v=3","gravatar_id":"","url":"https://api.github.com/users/azturner","html_url":"https://github.com/azturner","followers_url":"https://api.github.com/users/azturner/followers","following_url":"https://api.github.com/users/azturner/following{/other_user}","gists_url":"https://api.github.com/users/azturner/gists{/gist_id}","starred_url":"https://api.github.com/users/azturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azturner/subscriptions","organizations_url":"https://api.github.com/users/azturner/orgs","repos_url":"https://api.github.com/users/azturner/repos","events_url":"https://api.github.com/users/azturner/events{/privacy}","received_events_url":"https://api.github.com/users/azturner/received_events","type":"User","site_admin":false},"body":"Currently whenever an Enum property is used in dotliquid it results in a 'Liquid syntax error'. This fixes that. For example, given the following classes: \r\n\r\n    public class Person\r\n    {\r\n        public string NickName { get; set; }\r\n        public Gender Gender {get; set; }\r\n    }\r\n    public enum Gender\r\n    {\r\n        Unknown = 0,\r\n        Male = 1,\r\n        Female = 2\r\n    }\r\n\r\nAnd the following liquid template:\r\n\r\n\t<p>Output the Name: {{ Person.NickName }}</p>\r\n\t<p>Output the Gender: {{ Person.Gender }}</p>\r\n\t<p> Enum First Compare say's \"{% if Person.Gender == 'Male' %}he's a Dude!{% else %}NOT a Dude!{% endif %}\"</p>\r\n\t<p> Enum Second Compare say's \"{% if 'Male' == Person.Gender %}he's a Dude!{% else %}NOT a Dude!{% endif %}\"</p>\r\n\r\nThe current result is:\r\n\r\n\tOutput the Name: David\r\n\tOutput the Gender: Liquid syntax error: Object 'Male' is invalid because it is neither a built-in type nor implements ILiquidizable\r\n\tEnum First Compare say's \"Liquid syntax error: Object 'Male' is invalid because it is neither a built-in type nor implements ILiquidizable\"\r\n\tEnum Second Compare say's \"Liquid syntax error: Object 'Male' is invalid because it is neither a built-in type nor implements ILiquidizable\"\r\n\r\nAdding the check for Enum in the Liquidize(object obj) method of Context.cs fixes the display, but there's still an issue when comparing (with Enum on left side of compare):\r\n\r\n\tOutput the Name: David\r\n\tOutput the Gender: Male\r\n\tEnum First Compare say's \"NOT a Dude!\"\r\n\tEnum Second Compare say's \"he's a Dude!\"\r\n\r\nUpdating the EqualVariables(object left, object right) method in Condition.cs fixes the compare issue:\r\n\r\n    Output the Name: David\r\n    Output the Gender: Male\r\n    Enum First Compare say's \"he's a Dude!\"\r\n    Enum Second Compare say's \"he's a Dude!\"\r\n\r\n","created_at":"2014-12-02T12:17:56Z","updated_at":"2014-12-02T12:17:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/formosatek/dotliquid/pulls/118/commits","review_comments_url":"https://api.github.com/repos/formosatek/dotliquid/pulls/118/comments","review_comment_url":"https://api.github.com/repos/formosatek/dotliquid/pulls/comments/{number}","comments_url":"https://api.github.com/repos/formosatek/dotliquid/issues/118/comments","statuses_url":"https://api.github.com/repos/formosatek/dotliquid/statuses/e19076d76ce41dd5b2ad55175a14204777628ae9","head":{"label":"azturner:master","ref":"master","sha":"e19076d76ce41dd5b2ad55175a14204777628ae9","user":{"login":"azturner","id":548180,"avatar_url":"https://avatars.githubusercontent.com/u/548180?v=3","gravatar_id":"","url":"https://api.github.com/users/azturner","html_url":"https://github.com/azturner","followers_url":"https://api.github.com/users/azturner/followers","following_url":"https://api.github.com/users/azturner/following{/other_user}","gists_url":"https://api.github.com/users/azturner/gists{/gist_id}","starred_url":"https://api.github.com/users/azturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azturner/subscriptions","organizations_url":"https://api.github.com/users/azturner/orgs","repos_url":"https://api.github.com/users/azturner/repos","events_url":"https://api.github.com/users/azturner/events{/privacy}","received_events_url":"https://api.github.com/users/azturner/received_events","type":"User","site_admin":false},"repo":{"id":26915329,"name":"dotliquid","full_name":"azturner/dotliquid","owner":{"login":"azturner","id":548180,"avatar_url":"https://avatars.githubusercontent.com/u/548180?v=3","gravatar_id":"","url":"https://api.github.com/users/azturner","html_url":"https://github.com/azturner","followers_url":"https://api.github.com/users/azturner/followers","following_url":"https://api.github.com/users/azturner/following{/other_user}","gists_url":"https://api.github.com/users/azturner/gists{/gist_id}","starred_url":"https://api.github.com/users/azturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azturner/subscriptions","organizations_url":"https://api.github.com/users/azturner/orgs","repos_url":"https://api.github.com/users/azturner/repos","events_url":"https://api.github.com/users/azturner/events{/privacy}","received_events_url":"https://api.github.com/users/azturner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/azturner/dotliquid","description":".NET Port of Tobias Lütke's Liquid template language.","fork":true,"url":"https://api.github.com/repos/azturner/dotliquid","forks_url":"https://api.github.com/repos/azturner/dotliquid/forks","keys_url":"https://api.github.com/repos/azturner/dotliquid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azturner/dotliquid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azturner/dotliquid/teams","hooks_url":"https://api.github.com/repos/azturner/dotliquid/hooks","issue_events_url":"https://api.github.com/repos/azturner/dotliquid/issues/events{/number}","events_url":"https://api.github.com/repos/azturner/dotliquid/events","assignees_url":"https://api.github.com/repos/azturner/dotliquid/assignees{/user}","branches_url":"https://api.github.com/repos/azturner/dotliquid/branches{/branch}","tags_url":"https://api.github.com/repos/azturner/dotliquid/tags","blobs_url":"https://api.github.com/repos/azturner/dotliquid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azturner/dotliquid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azturner/dotliquid/git/refs{/sha}","trees_url":"https://api.github.com/repos/azturner/dotliquid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azturner/dotliquid/statuses/{sha}","languages_url":"https://api.github.com/repos/azturner/dotliquid/languages","stargazers_url":"https://api.github.com/repos/azturner/dotliquid/stargazers","contributors_url":"https://api.github.com/repos/azturner/dotliquid/contributors","subscribers_url":"https://api.github.com/repos/azturner/dotliquid/subscribers","subscription_url":"https://api.github.com/repos/azturner/dotliquid/subscription","commits_url":"https://api.github.com/repos/azturner/dotliquid/commits{/sha}","git_commits_url":"https://api.github.com/repos/azturner/dotliquid/git/commits{/sha}","comments_url":"https://api.github.com/repos/azturner/dotliquid/comments{/number}","issue_comment_url":"https://api.github.com/repos/azturner/dotliquid/issues/comments/{number}","contents_url":"https://api.github.com/repos/azturner/dotliquid/contents/{+path}","compare_url":"https://api.github.com/repos/azturner/dotliquid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azturner/dotliquid/merges","archive_url":"https://api.github.com/repos/azturner/dotliquid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azturner/dotliquid/downloads","issues_url":"https://api.github.com/repos/azturner/dotliquid/issues{/number}","pulls_url":"https://api.github.com/repos/azturner/dotliquid/pulls{/number}","milestones_url":"https://api.github.com/repos/azturner/dotliquid/milestones{/number}","notifications_url":"https://api.github.com/repos/azturner/dotliquid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azturner/dotliquid/labels{/name}","releases_url":"https://api.github.com/repos/azturner/dotliquid/releases{/id}","created_at":"2014-11-20T14:13:30Z","updated_at":"2014-12-02T12:06:41Z","pushed_at":"2014-12-02T12:06:40Z","git_url":"git://github.com/azturner/dotliquid.git","ssh_url":"git@github.com:azturner/dotliquid.git","clone_url":"https://github.com/azturner/dotliquid.git","svn_url":"https://github.com/azturner/dotliquid","homepage":"http://dotliquidmarkup.org","size":9170,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"formosatek:master","ref":"master","sha":"895ed30d28cb3e9a19ae2e10b1dc6c0066b56063","user":{"login":"formosatek","id":366984,"avatar_url":"https://avatars.githubusercontent.com/u/366984?v=3","gravatar_id":"","url":"https://api.github.com/users/formosatek","html_url":"https://github.com/formosatek","followers_url":"https://api.github.com/users/formosatek/followers","following_url":"https://api.github.com/users/formosatek/following{/other_user}","gists_url":"https://api.github.com/users/formosatek/gists{/gist_id}","starred_url":"https://api.github.com/users/formosatek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/formosatek/subscriptions","organizations_url":"https://api.github.com/users/formosatek/orgs","repos_url":"https://api.github.com/users/formosatek/repos","events_url":"https://api.github.com/users/formosatek/events{/privacy}","received_events_url":"https://api.github.com/users/formosatek/received_events","type":"Organization","site_admin":false},"repo":{"id":847744,"name":"dotliquid","full_name":"formosatek/dotliquid","owner":{"login":"formosatek","id":366984,"avatar_url":"https://avatars.githubusercontent.com/u/366984?v=3","gravatar_id":"","url":"https://api.github.com/users/formosatek","html_url":"https://github.com/formosatek","followers_url":"https://api.github.com/users/formosatek/followers","following_url":"https://api.github.com/users/formosatek/following{/other_user}","gists_url":"https://api.github.com/users/formosatek/gists{/gist_id}","starred_url":"https://api.github.com/users/formosatek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/formosatek/subscriptions","organizations_url":"https://api.github.com/users/formosatek/orgs","repos_url":"https://api.github.com/users/formosatek/repos","events_url":"https://api.github.com/users/formosatek/events{/privacy}","received_events_url":"https://api.github.com/users/formosatek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/formosatek/dotliquid","description":".NET Port of Tobias Lütke's Liquid template language.","fork":false,"url":"https://api.github.com/repos/formosatek/dotliquid","forks_url":"https://api.github.com/repos/formosatek/dotliquid/forks","keys_url":"https://api.github.com/repos/formosatek/dotliquid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/formosatek/dotliquid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/formosatek/dotliquid/teams","hooks_url":"https://api.github.com/repos/formosatek/dotliquid/hooks","issue_events_url":"https://api.github.com/repos/formosatek/dotliquid/issues/events{/number}","events_url":"https://api.github.com/repos/formosatek/dotliquid/events","assignees_url":"https://api.github.com/repos/formosatek/dotliquid/assignees{/user}","branches_url":"https://api.github.com/repos/formosatek/dotliquid/branches{/branch}","tags_url":"https://api.github.com/repos/formosatek/dotliquid/tags","blobs_url":"https://api.github.com/repos/formosatek/dotliquid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/formosatek/dotliquid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/formosatek/dotliquid/git/refs{/sha}","trees_url":"https://api.github.com/repos/formosatek/dotliquid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/formosatek/dotliquid/statuses/{sha}","languages_url":"https://api.github.com/repos/formosatek/dotliquid/languages","stargazers_url":"https://api.github.com/repos/formosatek/dotliquid/stargazers","contributors_url":"https://api.github.com/repos/formosatek/dotliquid/contributors","subscribers_url":"https://api.github.com/repos/formosatek/dotliquid/subscribers","subscription_url":"https://api.github.com/repos/formosatek/dotliquid/subscription","commits_url":"https://api.github.com/repos/formosatek/dotliquid/commits{/sha}","git_commits_url":"https://api.github.com/repos/formosatek/dotliquid/git/commits{/sha}","comments_url":"https://api.github.com/repos/formosatek/dotliquid/comments{/number}","issue_comment_url":"https://api.github.com/repos/formosatek/dotliquid/issues/comments/{number}","contents_url":"https://api.github.com/repos/formosatek/dotliquid/contents/{+path}","compare_url":"https://api.github.com/repos/formosatek/dotliquid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/formosatek/dotliquid/merges","archive_url":"https://api.github.com/repos/formosatek/dotliquid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/formosatek/dotliquid/downloads","issues_url":"https://api.github.com/repos/formosatek/dotliquid/issues{/number}","pulls_url":"https://api.github.com/repos/formosatek/dotliquid/pulls{/number}","milestones_url":"https://api.github.com/repos/formosatek/dotliquid/milestones{/number}","notifications_url":"https://api.github.com/repos/formosatek/dotliquid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/formosatek/dotliquid/labels{/name}","releases_url":"https://api.github.com/repos/formosatek/dotliquid/releases{/id}","created_at":"2010-08-19T01:50:46Z","updated_at":"2014-11-30T22:05:12Z","pushed_at":"2014-09-12T13:50:38Z","git_url":"git://github.com/formosatek/dotliquid.git","ssh_url":"git@github.com:formosatek/dotliquid.git","clone_url":"https://github.com/formosatek/dotliquid.git","svn_url":"https://github.com/formosatek/dotliquid","homepage":"http://dotliquidmarkup.org","size":9170,"stargazers_count":176,"watchers_count":176,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":25,"forks":64,"open_issues":25,"watchers":176,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/formosatek/dotliquid/pulls/118"},"html":{"href":"https://github.com/formosatek/dotliquid/pull/118"},"issue":{"href":"https://api.github.com/repos/formosatek/dotliquid/issues/118"},"comments":{"href":"https://api.github.com/repos/formosatek/dotliquid/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/formosatek/dotliquid/pulls/118/comments"},"review_comment":{"href":"https://api.github.com/repos/formosatek/dotliquid/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/formosatek/dotliquid/pulls/118/commits"},"statuses":{"href":"https://api.github.com/repos/formosatek/dotliquid/statuses/e19076d76ce41dd5b2ad55175a14204777628ae9"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":11,"deletions":0,"changed_files":2}}