anonymous group photoblog software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
399 B

  1. #!/bin/sed -rnf
  2. # usage: ./config.sed config.pl > config.py
  3. s/^my %config;$/config = {}/
  4. s/\$config\{([A-Z0-9_]+)\} ?= ?(.+);(\s*#?.*)$/config['\1'] = \2\3/;
  5. s/\$config\{([A-Z0-9_]+)\} ?= ?\{$/config['\1'] = {/;
  6. s/(config\['[A-Z0-9_]+'\] = )\((.+)\)/\1[\2]/;
  7. s/\};/}/;
  8. s/ => /: /;
  9. s/^\\%config;$//;
  10. s/^#? ?(use|no) encoding.*$//;
  11. # multiline hack
  12. 1h;1!H;
  13. $ {
  14. g;
  15. s/\n\n\n+/\n/g;
  16. p
  17. }