Skip to content

Commit 9fff90e

Browse files
committed
Implemented AMBER_HEADER and AMBER_FOOTER variables
1 parent d3ceda3 commit 9fff90e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/compiler.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,18 @@ impl AmberCompiler {
197197
}
198198

199199
let now = Local::now().format("%Y-%m-%d %H:%M:%S").to_string();
200-
let header = include_str!("header.sh")
200+
let raw_header = fs::read_to_string(
201+
env::var("AMBER_HEADER")
202+
.unwrap_or("".to_string()).to_string())
203+
.unwrap_or(include_str!("header.sh").to_string());
204+
let header = raw_header
201205
.replace("{{ version }}", env!("CARGO_PKG_VERSION"))
202206
.replace("{{ date }}", now.as_str());
203-
Ok(format!("{}{}", header, result))
207+
let footer = fs::read_to_string(
208+
env::var("AMBER_FOOTER")
209+
.unwrap_or("".to_string()).to_string())
210+
.unwrap_or("".to_string());
211+
Ok(format!("{}{}{}", header, result, footer))
204212
}
205213

206214
pub fn document(&self, block: Block, meta: ParserMetadata, output: String) {

0 commit comments

Comments
 (0)