Strip out YAML blocks

wow, can’t believe I just wrote something (jank 1000) for this last week:
https://github.com/Moelf/BigG.jl/blob/9f79a16266da89584018bd324198a2874c3146fb/src/BigG.jl#L79-L85

if you want the block inclusively, just remove +1 and -1

now that I’m posting my inefficient code, I have to make a version where you don’t have to read the whole file:

function revise(path)    
    t = open(path)       
    lines = []               
    c = 0                
    while c<2       
        r = readline(t)
        (r == "---" && (c+=1))              
        push!(lines, r)                  
    end                           
    return join(lines, "\n")    
end  
1 Like