tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

generate_example_stylesheet.py (519B)


      1 def main(output, stylesheet):
      2    css = open(stylesheet, "r").read()
      3    css = (
      4        css.replace("\\", "\\\\")
      5        .replace("\r", "\\r")
      6        .replace("\n", "\\n")
      7        .replace('"', '\\"')
      8    )
      9 
     10    # Work around "error C2026: string too big"
     11    # https://msdn.microsoft.com/en-us/library/dddywwsc.aspx
     12    chunk_size = 10000
     13    chunks = ('"%s"' % css[i : i + chunk_size] for i in range(0, len(css), chunk_size))
     14 
     15    header = "#define EXAMPLE_STYLESHEET " + " ".join(chunks)
     16    output.write(header)