ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> idk what im looking at
ur5us has quit [Ping timeout: 258 seconds]
<FromGitter> <gregoryc> OK, I got things working well
<FromGitter> <gregoryc> a@a:~$ crystal code 'cat {sc|{sc|{sc|dog}}} cat' '{.*' } ⏎ ⏎ cat {sc|{sc|{sc|dog}}} cat ⏎ ⏎ cat [ ] cat ... [https://gitter.im/crystal-lang/crystal?at=629ff015c9382316a6435177]
<FromGitter> <gregoryc> https://carc.in/#/r/da58
<FromGitter> <gregoryc> Public domain is the license
<FromGitter> <Blacksmoke16> you can wrap code in three backticks, make it easier to read
<FromGitter> <gregoryc> Where? Here?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <gregoryc> '''
<FromGitter> <gregoryc> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=629ff05bc9382316a64351f0]
<FromGitter> <gregoryc> oh wow
<FromGitter> <gregoryc> I got it working
<FromGitter> <gregoryc> But idk if there is a nicer solution
<FromGitter> <gregoryc> Re macros
<FromGitter> <Blacksmoke16> yea that code is totally unreadable on here
<FromGitter> <Blacksmoke16> backticks werent done right :S
<FromGitter> <Blacksmoke16> has to be on its own line, but for larger snippets a gist or playground link is better
<FromGitter> <gregoryc> I'll try again, sorry, lol
<FromGitter> <Blacksmoke16> i wouldnt bother, not worth pasting again
<FromGitter> <gregoryc> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=629ff117deea5616bbe80f1f]
<FromGitter> <gregoryc> Yeah, it's nice
<FromGitter> <Blacksmoke16> but whats that code do?
<FromGitter> <gregoryc> It's a recursive gsub that is generic. Argument 1 is a string, argument 2 is the beginning section (which gets removed), argument 3 is the ending section (which gets removed). The function yields to a block, and the new value is the block's value, surrounded by spaces
<FromGitter> <gregoryc> Works for string and regexs so far, can be extended easily to other data types
<FromGitter> <gregoryc> crystal code 'cat {sc|{sc|{sc|dog}}} cat' '{.*' } ⏎ ⏎ cat {sc|{sc|{sc|dog}}} cat ⏎ ⏎ cat [ ] cat [https://gitter.im/crystal-lang/crystal?at=629ff18bdeea5616bbe80fd7]
<FromGitter> <gregoryc> That is string and regexp
<FromGitter> <gregoryc> Showing how the values can differ. It's not the best for the string because it doesn't match of course
<FromGitter> <gregoryc> crystal code 'cat {sc|{sc|{sc|dog}}} cat' '{' } ⏎ ⏎ cat [ sc|[ sc|[ sc|dog ] ] ] cat ⏎ ⏎ cat [ sc|[ sc|[ sc|dog ] ] ] cat [https://gitter.im/crystal-lang/crystal?at=629ff1c809eea00aded31795]
<FromGitter> <Blacksmoke16> mmk
<FromGitter> <gregoryc> It's a little awkward because I have to use macro conditionals to make it work.
<FromGitter> <gregoryc> Is there a better way ? :)
<FromGitter> <Blacksmoke16> quite frankly i still dont know what it does/what the use case is so not sure
<FromGitter> <gregoryc> It could be used to parse a lot of things, including html and xml
<FromGitter> <gregoryc> It's very very useful, because it yields
<FromGitter> <gregoryc> Just as gsub is useful
<FromGitter> <gregoryc> Can be used to get rid of unwanted markup
<FromGitter> <gregoryc> Or extended to do something else
ur5us has joined #crystal-lang
irc_user has joined #crystal-lang
wmoxam has joined #crystal-lang
<wmoxam> Hey, this isn't strictly a crystal question, but I'm looking to recursively render a template in ECR (in order to display a tree). Anyone have experience doing this?
irc_user has quit [Quit: Connection closed for inactivity]
ur5us has quit [Ping timeout: 272 seconds]
_ht has joined #crystal-lang
ua_ has quit [Ping timeout: 255 seconds]
_ht has quit [Remote host closed the connection]
renich has joined #crystal-lang
* renich is reading "Crystal Programming" atm.
renich has quit [Quit: Leaving]
ur5us has joined #crystal-lang
hightower4 has joined #crystal-lang
hightower3 has quit [Ping timeout: 258 seconds]
ua_ has joined #crystal-lang
<FromGitter> <moe:busyloop.net> blacksmoke is becoming bigger than j.k. rowling
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
Sankalp has quit [Ping timeout: 255 seconds]
Sankalp has joined #crystal-lang
ur5us has quit [Ping timeout: 255 seconds]
jmdaemon has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> wmoxam you could try that ECR method object to s
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/ECR.html#def_to_s%28filename%29-macro this one
ua_ has quit [Ping timeout: 240 seconds]
ua_ has joined #crystal-lang
renich has joined #crystal-lang
Sankalp has quit [Ping timeout: 246 seconds]
Sankalp has joined #crystal-lang
yxhuvud has quit [Read error: Connection reset by peer]
_ht has joined #crystal-lang
yxhuvud has joined #crystal-lang
HumanG33k has quit [Quit: WeeChat 3.0]
HumanG33k has joined #crystal-lang
_ht has quit [Remote host closed the connection]
jmdaemon has joined #crystal-lang
ur5us has joined #crystal-lang
brokkoli_ori has joined #crystal-lang
brokkoli_origin has quit [Ping timeout: 240 seconds]
sagax has quit [Excess Flood]