{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-zeppelin/issues/164","labels_url":"https://api.github.com/repos/apache/incubator-zeppelin/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-zeppelin/issues/164/comments","events_url":"https://api.github.com/repos/apache/incubator-zeppelin/issues/164/events","html_url":"https://github.com/apache/incubator-zeppelin/pull/164","id":96798477,"number":164,"title":"Improve magic display system","user":{"login":"goi","id":2227083,"avatar_url":"https://avatars.githubusercontent.com/u/2227083?v=3","gravatar_id":"","url":"https://api.github.com/users/goi","html_url":"https://github.com/goi","followers_url":"https://api.github.com/users/goi/followers","following_url":"https://api.github.com/users/goi/following{/other_user}","gists_url":"https://api.github.com/users/goi/gists{/gist_id}","starred_url":"https://api.github.com/users/goi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goi/subscriptions","organizations_url":"https://api.github.com/users/goi/orgs","repos_url":"https://api.github.com/users/goi/repos","events_url":"https://api.github.com/users/goi/events{/privacy}","received_events_url":"https://api.github.com/users/goi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-23T12:00:31Z","updated_at":"2015-07-23T12:13:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/incubator-zeppelin/pulls/164","html_url":"https://github.com/apache/incubator-zeppelin/pull/164","diff_url":"https://github.com/apache/incubator-zeppelin/pull/164.diff","patch_url":"https://github.com/apache/incubator-zeppelin/pull/164.patch"},"body":"I have changed the InterpreterResult behavior so that if a magic word is detected all preceding text is omitted. This way we can use the display system and print out using the magic words in paragraphs such as spark.\r\nexample:\r\n```\r\nsc.parallelize(1 to 10)\r\n```\r\nwill output:\r\n```\r\nres9: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[2] at parallelize at <console>:24\r\n```  \r\n\r\nand mix paragraphs such as:\r\n```\r\nsc.parallelize(1 to 10)\r\nprintln(\"%table col\\tcol2\\nqwe\\t123\\n\")\r\n```\r\nwill output the expected magic table\r\n![selection_003](https://cloud.githubusercontent.com/assets/2227083/8849793/25ecf24c-314b-11e5-8136-ef689eaeb917.png)\r\n\r\nThis behavior can be later extended to handle complex types.\r\nI have also added a JUnit test for the class\r\n"},"comment":{"url":"https://api.github.com/repos/apache/incubator-zeppelin/issues/comments/124078145","html_url":"https://github.com/apache/incubator-zeppelin/pull/164#issuecomment-124078145","issue_url":"https://api.github.com/repos/apache/incubator-zeppelin/issues/164","id":124078145,"user":{"login":"doanduyhai","id":1532977,"avatar_url":"https://avatars.githubusercontent.com/u/1532977?v=3","gravatar_id":"","url":"https://api.github.com/users/doanduyhai","html_url":"https://github.com/doanduyhai","followers_url":"https://api.github.com/users/doanduyhai/followers","following_url":"https://api.github.com/users/doanduyhai/following{/other_user}","gists_url":"https://api.github.com/users/doanduyhai/gists{/gist_id}","starred_url":"https://api.github.com/users/doanduyhai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doanduyhai/subscriptions","organizations_url":"https://api.github.com/users/doanduyhai/orgs","repos_url":"https://api.github.com/users/doanduyhai/repos","events_url":"https://api.github.com/users/doanduyhai/events{/privacy}","received_events_url":"https://api.github.com/users/doanduyhai/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T12:13:27Z","updated_at":"2015-07-23T12:13:27Z","body":"A question. What if I mix different magics ? Example:\r\n\r\n```scala\r\nsc.parallelize(1 to 10)\r\nprintln(\"%table col\\tcol2\\nqwe\\t123\\n\")\r\nprintln(\"%html <h3> This is a hack </h3>\")\r\n```\r\n\r\n In that case, what would be displayed ? A table or the HTML bloc ? I guess that in the source code of method `getType()` when we loop through all the types enums, the first type found in the output string will be retained.\r\n\r\nBut then doing `msg.substring(magicLength + msg.indexOf(magic))` will give very different results depending on whether we match **%table%** or **%html%** before.\r\n\r\nIs this behavior deterministic or just depending on the order of the type enums ?\r\n\r\n\r\n\r\n"}}