pike.git / module.pmod.in

version» Context lines:

pike.git/module.pmod.in:1:   /*    Author: Pontus Östlund <https://profiles.google.com/poppanator>   */ +    //! Sass is a scripting language that is interpreted into Cascading Style   //! Sheets (CSS). This module is a glue for @tt{libsass@}.   //!   //! @seealso   //! SASS @url{http://sass-lang.com/@}      #pike __REAL_VERSION__   #require constant(Tools@module@)      //! @ignore   inherit Tools@module@;   //! @endignore      //! SCSS compiler   //!   //! @example   //! @code - //! Tools.Sass.SCSS compiler = Tools.Sass.SCSS(); + //! Tools.Sass.Compiler compiler = Tools.Sass.Compiler();   //! // Minify the output and create a source map file.   //! compiler->set_options(([   //! "output_style" : Tools.Sass.STYLE_COMPRESSED   //! "source_map_file" : "path/to/write/source.map"   //! ]));   //!   //! if (mixed e = catch(compiler->compile_file("input.scss", "output.css"))) {   //! werror("Failed compiling input.scss to output.css\n");   //! }   //! @endcode - class SCSS + class Compiler   { -  +  //! @ignore    inherit Tools@module@.Api; -  +  //! @endignore       //! If a Sass file is importing an external URI this flag determines if    //! thats allowed at all, or if the content type of the imported file has -  //! to be text/scss or if anything goes. Default is @[EXTERNAL_IMPORT_NONE]. +  //! to be text/scss or if anything goes. Default is @[HTTP_IMPORT_NONE].    //!    //! @seealso -  //! @[EXTERNAL_IMPORT_NONE], @[EXTERNAL_IMPORT_GREEDY] and -  //! @[EXTERNAL_IMPORT_ANY]. -  public int(0..2) external_use = EXTERNAL_IMPORT_NONE; +  //! @[HTTP_IMPORT_NONE], @[HTTP_IMPORT_GREEDY] and +  //! @[HTTP_IMPORT_ANY]. +  public int(0..2) import_http = HTTP_IMPORT_NONE;          //! @ignore    protected void create()    {    ::__set_importer_callback(__resolve_import);    }    //! @endignore       //! @ignore    //! Resolve external imports in sass files.    protected string __resolve_import(string path)    {    Standards.URI uri;       if (catch (uri = Standards.URI(path))) {    return UNDEFINED;    }    -  +  if (import_http == HTTP_IMPORT_NONE) { +  error("Imports over HTTP not allowed!\n"); +  } +     Protocols.HTTP.Query q = Protocols.HTTP.get_url(uri);       if (q->status != 200) {    error("Bad HTTP status (%d) for @import %q!\n",    q->status, (string) uri);    }       array(string) ct_parts = map(q->headers["content-type"]/";",    String.trim_all_whites);    -  if (external_use == EXTERNAL_IMPORT_GREEDY) { +  if (import_http == HTTP_IMPORT_GREEDY) {    if (ct_parts[0] != "text/scss") {    error("Returned content type from import (%s) was %q. "    "Expected \"text/scss\"!\n",    uri, ct_parts[0]);    }    }       string(8bit) data = q->data();       if (sizeof(ct_parts) > 1) {