Formatting
This commit is contained in:
parent
3b6c22088e
commit
19abe390d4
23 changed files with 181 additions and 96 deletions
|
|
@ -1,23 +1,48 @@
|
|||
use minify_html::{minify as minify_html_native, Cfg};
|
||||
use jni::objects::{JClass, JObject, JString};
|
||||
use jni::sys::jstring;
|
||||
use jni::JNIEnv;
|
||||
use jni::objects::{ JClass, JObject, JString};
|
||||
use jni::sys::{ jstring};
|
||||
use minify_html::{minify as minify_html_native, Cfg};
|
||||
use std::str::from_utf8;
|
||||
|
||||
fn build_cfg(
|
||||
env: &JNIEnv,
|
||||
obj: &JObject,
|
||||
) -> Cfg {
|
||||
fn build_cfg(env: &JNIEnv, obj: &JObject) -> Cfg {
|
||||
Cfg {
|
||||
ensure_spec_compliant_unquoted_attribute_values: env.get_field(*obj, "ensure_spec_compliant_unquoted_attribute_values", "Z").unwrap().z().unwrap(),
|
||||
keep_closing_tags: env.get_field(*obj, "keep_closing_tags", "Z").unwrap().z().unwrap(),
|
||||
keep_comments: env.get_field(*obj, "keep_comments", "Z").unwrap().z().unwrap(),
|
||||
keep_html_and_head_opening_tags: env.get_field(*obj, "keep_html_and_head_opening_tags", "Z").unwrap().z().unwrap(),
|
||||
keep_spaces_between_attributes: env.get_field(*obj, "keep_spaces_between_attributes", "Z").unwrap().z().unwrap(),
|
||||
ensure_spec_compliant_unquoted_attribute_values: env
|
||||
.get_field(*obj, "ensure_spec_compliant_unquoted_attribute_values", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
keep_closing_tags: env
|
||||
.get_field(*obj, "keep_closing_tags", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
keep_comments: env
|
||||
.get_field(*obj, "keep_comments", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
keep_html_and_head_opening_tags: env
|
||||
.get_field(*obj, "keep_html_and_head_opening_tags", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
keep_spaces_between_attributes: env
|
||||
.get_field(*obj, "keep_spaces_between_attributes", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
minify_css: env.get_field(*obj, "minify_css", "Z").unwrap().z().unwrap(),
|
||||
minify_js: env.get_field(*obj, "minify_js", "Z").unwrap().z().unwrap(),
|
||||
remove_bangs: env.get_field(*obj, "remove_bangs", "Z").unwrap().z().unwrap(),
|
||||
remove_processing_instructions: env.get_field(*obj, "remove_processing_instructions", "Z").unwrap().z().unwrap(),
|
||||
remove_bangs: env
|
||||
.get_field(*obj, "remove_bangs", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
remove_processing_instructions: env
|
||||
.get_field(*obj, "remove_processing_instructions", "Z")
|
||||
.unwrap()
|
||||
.z()
|
||||
.unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,8 +52,7 @@ pub extern "system" fn Java_in_wilsonl_minifyhtml_MinifyHtml_minify(
|
|||
_class: JClass,
|
||||
input: JString,
|
||||
cfg: JObject,
|
||||
)
|
||||
-> jstring {
|
||||
) -> jstring {
|
||||
let source: String = env.get_string(input).unwrap().into();
|
||||
let code = source.into_bytes();
|
||||
|
||||
|
|
|
|||
Reference in a new issue