Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move HtmlFormatter to core #358

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions numbat-wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions numbat-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ wasm-bindgen = "0.2.90"
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }

numbat = { path = "../numbat", default-features = false }
numbat = { path = "../numbat", default-features = false, features = ["html-formatter"] }
html-escape = "0.2.13"
termcolor = "1.4.1"
codespan-reporting = "0.11.1"
Expand Down
2 changes: 1 addition & 1 deletion numbat-wasm/src/jquery_terminal_formatter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::buffered_writer::BufferedWriter;
use numbat::buffered_writer::BufferedWriter;
use numbat::markup::{FormatType, FormattedString, Formatter};

use termcolor::{Color, WriteColor};
Expand Down
14 changes: 6 additions & 8 deletions numbat-wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
mod buffered_writer;
mod html_formatter;
mod jquery_terminal_formatter;
mod utils;

use numbat::diagnostic::ErrorDiagnostic;
use numbat::module_importer::BuiltinModuleImporter;
use std::sync::{Arc, Mutex};
use wasm_bindgen::prelude::*;

use crate::buffered_writer::BufferedWriter;
use html_formatter::{HtmlFormatter, HtmlWriter};
use jquery_terminal_formatter::{JqueryTerminalFormatter, JqueryTerminalWriter};

use numbat::buffered_writer::BufferedWriter;
use numbat::diagnostic::ErrorDiagnostic;
use numbat::help::help_markup;
use numbat::html_formatter::{HtmlFormatter, HtmlWriter};
use numbat::markup::Formatter;
use numbat::module_importer::BuiltinModuleImporter;
use numbat::pretty_print::PrettyPrint;
use numbat::resolver::CodeSource;
use numbat::{markup as m, NameResolutionError, NumbatError};
use numbat::{Context, InterpreterSettings};

use jquery_terminal_formatter::{JqueryTerminalFormatter, JqueryTerminalWriter};

#[wasm_bindgen]
pub fn setup_panic_hook() {
utils::set_panic_hook();
Expand Down
3 changes: 3 additions & 0 deletions numbat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ walkdir = "2"
chrono = "0.4.31"
chrono-tz = "0.8.5"
iana-time-zone = "0.1"
termcolor = { version = "1.4.1", optional = true }
html-escape = { version = "0.2.13", optional = true }

[features]
default = ["fetch-exchangerates"]
fetch-exchangerates = ["numbat-exchange-rates/fetch-exchangerates"]
html-formatter = ["termcolor", "html-escape"]

[dev-dependencies]
approx = "0.5"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::buffered_writer::BufferedWriter;
use numbat::markup::{FormatType, FormattedString, Formatter};
use crate::markup::{FormatType, FormattedString, Formatter};

use termcolor::{Color, WriteColor};

Expand Down
4 changes: 4 additions & 0 deletions numbat/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mod arithmetic;
mod ast;
#[cfg(feature = "html-formatter")]
pub mod buffered_writer;
mod bytecode_interpreter;
mod column_formatter;
mod currency;
Expand All @@ -10,6 +12,8 @@ mod dimension;
mod ffi;
mod gamma;
pub mod help;
#[cfg(feature = "html-formatter")]
pub mod html_formatter;
mod interpreter;
pub mod keywords;
pub mod markup;
Expand Down
Loading