Skip to content

Instantly share code, notes, and snippets.

@mame
Created Sep 28, 2022
Embed
What would you like to do?
A non-trivial quine written in Liquid markup language
$ gem install liquid

$ ruby -rliquid -e 'puts Liquid::Template.parse($<.read).render' quine.liquid
{%assign a="{Passign a=QZQ|split:QQP}{Pfor c in aP}{Pif c == a[12]P}{{a}}{Pelsif c == a[1]P}P{Pelsif c == a[11]P}Q{PelseP}{{c}}{PendifP}{PendforP}"|split:""%}{%for c in a%}{%if c == a[12]%}{{a}}{%elsif c == a[1]%}%{%elsif c == a[11]%}"{%else%}{{c}}{%endif%}{%endfor%}

$ diff -s quine.liquid <(ruby -rliquid -e 'puts Liquid::Template.parse($<.read).render' quine.liquid)
Files quine.liquid and /dev/fd/63 are identical
{%assign a="{Passign a=QZQ|split:QQP}{Pfor c in aP}{Pif c == a[12]P}{{a}}{Pelsif c == a[1]P}P{Pelsif c == a[11]P}Q{PelseP}{{c}}{PendifP}{PendforP}"|split:""%}{%for c in a%}{%if c == a[12]%}{{a}}{%elsif c == a[1]%}%{%elsif c == a[11]%}"{%else%}{{c}}{%endif%}{%endfor%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment