├── .gitignore
├── test.scml
├── head.scml
├── Cargo.toml
├── Cargo.lock
├── src
├── main.rs
├── html_processing.rs
└── js_processing.rs
├── app.html
├── gen.scml
├── app.js
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 |
--------------------------------------------------------------------------------
/test.scml:
--------------------------------------------------------------------------------
1 |
hello world
2 |
3 |
--------------------------------------------------------------------------------
/head.scml:
--------------------------------------------------------------------------------
1 | [html]
2 | Header one
3 | in[sell]
4 | [html]
5 |
6 | [html sell]
7 | sell one
8 | [html]
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "scml"
3 | version = "0.1.0"
4 | authors = ["valentine-mario "]
5 | edition = "2018"
6 |
7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8 |
9 | [dependencies]
10 | regex = "1"
11 |
12 | [target.x86_64-pc-windows-gnu]
13 | linker="x86_64-pc-windows-gnu"
14 |
15 | [target.x86_64-unknown-linux-musl]
16 | linker="x86_64-unknown-linux-musl"
17 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "aho-corasick"
5 | version = "0.7.10"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
8 | dependencies = [
9 | "memchr",
10 | ]
11 |
12 | [[package]]
13 | name = "lazy_static"
14 | version = "1.4.0"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
17 |
18 | [[package]]
19 | name = "memchr"
20 | version = "2.3.3"
21 | source = "registry+https://github.com/rust-lang/crates.io-index"
22 | checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
23 |
24 | [[package]]
25 | name = "regex"
26 | version = "1.3.7"
27 | source = "registry+https://github.com/rust-lang/crates.io-index"
28 | checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
29 | dependencies = [
30 | "aho-corasick",
31 | "memchr",
32 | "regex-syntax",
33 | "thread_local",
34 | ]
35 |
36 | [[package]]
37 | name = "regex-syntax"
38 | version = "0.6.17"
39 | source = "registry+https://github.com/rust-lang/crates.io-index"
40 | checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
41 |
42 | [[package]]
43 | name = "scml"
44 | version = "0.1.0"
45 | dependencies = [
46 | "regex",
47 | ]
48 |
49 | [[package]]
50 | name = "thread_local"
51 | version = "1.0.1"
52 | source = "registry+https://github.com/rust-lang/crates.io-index"
53 | checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
54 | dependencies = [
55 | "lazy_static",
56 | ]
57 |
--------------------------------------------------------------------------------
/src/main.rs:
--------------------------------------------------------------------------------
1 | mod html_processing;
2 | use crate::html_processing::process_html;
3 | use std::env;
4 | use std::process;
5 | use regex::Regex;
6 | mod js_processing;
7 | use crate::js_processing::process_js;
8 |
9 | fn main() {
10 |
11 | let args = env::args();
12 |
13 |
14 | let get_filename = process_html::Config::new(args).unwrap_or_else(|error| {
15 | eprintln!("{}", error);
16 | process::exit(1);
17 | });
18 | let file_content=process_html::read_file(&get_filename.filename).unwrap_or_else(|err| {
19 | eprintln!("Problem reading file: {}", err);
20 | process::exit(1)
21 | });
22 | println!("processing html");
23 | let comment_re = Regex::new(r"(?m)####.*\n").unwrap();
24 | let file_content = comment_re.replace_all(&file_content, "\n\n");
25 |
26 | let file_content_from_another_file=process_html::replace_file(&file_content);
27 | let file_content=file_content_from_another_file.replace("\n", "");
28 | let hash_value=process_html::generate_scml_hash(&file_content);
29 |
30 | let final_string=process_html::replace_variable(&file_content, &hash_value);
31 |
32 | let mut generaic_seg=process_html::replace_variable_parameter(&final_string, &hash_value);
33 |
34 | for _i in 0..10{
35 | generaic_seg=process_html::replace_variable_parameter(&generaic_seg, &hash_value);
36 | }
37 | let vector=process_js::process_innerjs(&generaic_seg);
38 | if vector.len()>0 {
39 | println!("processing javascript");
40 | }
41 |
42 |
43 | process_html::write_to_js_file(&vector, &get_filename).unwrap_or_else(|error|{
44 | eprintln!("problem writing to file {}", error);
45 | process::exit(1);
46 | });
47 |
48 |
49 | let re= Regex::new(r#"\[html (\w+)\].*?\{\{.+?\}\}.*?\[html\]|\[\s*?html \w*?\s*?\]|append\s*?=\s*?(.+?)\s*?end|limit\s*?=\s*?(\d{1,})|innerHTML\s*?=\s*?(\w+)|getValue\s*?=\s*?(\w+)|disable\s*?=\s*?true|(\w+)\s*?=\s*?\{(.*?)\}\s*?|formatInt|formatFloat|visibility\s*?=\s*?(\w+)|formatDate\s*?=\s*?(\w+/\w+/\w+)\s*?|formatTimeAgo|formatCurrency\s*?=\s*?["|']\s*?(\w+)\s*?["|']|reverseString|shortenNum|onChange=\s*?(\w+)|submitForm\s*?\[(.+?)\]\s*?=\s*?(\w+)|shareDefault=\s*?["|']\s*?(\w+)\s*?["|']|shareCustome\s*?\[\s*?(.*?)\s*?\]\s*?=\s*?["|']\s*?(\w+)\s*?["|']|copyArea=\s*?(\w+)"#).unwrap();
50 | let result=re.replace_all(&generaic_seg, "").to_string();
51 |
52 |
53 | process_html::write_to_html_file(&result, &get_filename).unwrap_or_else(|error|{
54 | eprintln!("problem writing to file {}", error);
55 | process::exit(1);
56 | });
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | app
7 |
8 |
9 |
10 |
11 | Age: 34
title:chief
hi: kenneth
age: 44
sex: male
i said hello
12 | hi: Val
age: 23
sex: male
i said helloAge: 54
title:Collect
hi: Valium
age: 23
sex: male
i said hellohi: Ibe
age: 23
sex: male
i said hellohi: Craige
age: 23
sex: male
i said hellohi: Valent
age: 23
sex: male
i said hello
13 | Header one
sell one
14 | sell one
15 | hello world
this is some long ass text longer than 10 char--------
16 | section two start
This is some text
17 | foodie here
10000
10000.234
18 | #this is a commenttext four
2020-06-10T17:47:29.156Z
2020-06-10T17:47:29.156Z
2020-06-10T17:47:29.156Z
2020-06-10T17:47:29.156Z
2020-06-16T17:47:29.156Z
19 | 1000
1000
this is some text fuckers
12000
12000000