Skip to content

Commit e1c9566

Browse files
authored
Merge pull request #865 from pkgw/html
Sketch out HTML support
2 parents fa60f6d + 96c218c commit e1c9566

19 files changed

Lines changed: 2835 additions & 610 deletions

File tree

Cargo.lock

Lines changed: 505 additions & 300 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ members = [
3737
"crates/dep_support",
3838
"crates/docmodel",
3939
"crates/engine_bibtex",
40+
"crates/engine_spx2html",
4041
"crates/engine_xdvipdfmx",
4142
"crates/engine_xetex",
4243
"crates/errors",
@@ -72,6 +73,7 @@ tectonic_bridge_core = { path = "crates/bridge_core", version = "0.0.0-dev.0" }
7273
tectonic_bundles = { path = "crates/bundles", version = "0.0.0-dev.0", default-features = false }
7374
tectonic_docmodel = { path = "crates/docmodel", version = "0.0.0-dev.0", optional = true }
7475
tectonic_engine_bibtex = { path = "crates/engine_bibtex", version = "0.0.0-dev.0" }
76+
tectonic_engine_spx2html = { path = "crates/engine_spx2html", version = "0.0.0-dev.0" }
7577
tectonic_engine_xdvipdfmx = { path = "crates/engine_xdvipdfmx", version = "0.0.0-dev.0" }
7678
tectonic_engine_xetex = { path = "crates/engine_xetex", version = "0.0.0-dev.0" }
7779
tectonic_errors = { path = "crates/errors", version = "0.0.0-dev.0" }
@@ -87,6 +89,9 @@ url = "^2.0"
8789
watchexec = "^1.15.3"
8890
zip = { version = "^0.5", default-features = false, features = ["deflate"] }
8991

92+
[patch.crates-io]
93+
pinot = { git = 'https://github.com/tectonic-typesetting/pinot', branch = 'basic-math' }
94+
9095
[features]
9196
default = ["geturl-reqwest", "serialization"]
9297

@@ -135,10 +140,11 @@ tectonic_bridge_icu = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
135140
tectonic_bundles = "207e6e796b1827330ee03a4c395fe6db059bddd9"
136141
tectonic_cfg_support = "thiscommit:aeRoo7oa"
137142
tectonic_dep_support = "5faf4205bdd3d31101b749fc32857dd746f9e5bc"
138-
tectonic_docmodel = "cd77b60d48b1ae3ef80d708e6858ea91cd9fa812"
143+
tectonic_docmodel = "thiscommit:2022-02-20:2SpEl4c"
139144
tectonic_engine_bibtex = "thiscommit:2021-01-17:KuhaeG1e"
145+
tectonic_engine_spx2html = "thiscommit:2021-10-29:96yOlD8"
140146
tectonic_engine_xdvipdfmx = "7dcbc52e58f9774b3d592919a9105377faeac509"
141-
tectonic_engine_xetex = "b7a4085fa67c831d4532da6661bddafd1f9c24ff"
147+
tectonic_engine_xetex = "thiscommit:2022-02-20:J4dXT3x"
142148
tectonic_errors = "317ae79ceaa2593fb56090e37bf1f5cc24213dd9"
143149
tectonic_geturl = "68c5fc525c5fead75913bd90380043761bde9f61"
144150
tectonic_io_base = "thiscommit:2021-06-13:XFjtSsZ"

crates/docmodel/src/document.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,18 @@ impl Document {
178178

179179
let mut p = self.build_dir.clone();
180180
p.push(&profile.name);
181-
p.push(&profile.name);
182-
p.set_extension(match profile.target_type {
183-
BuildTargetType::Pdf => "pdf",
184-
});
181+
182+
match profile.target_type {
183+
BuildTargetType::Pdf => {
184+
p.push(&profile.name);
185+
p.set_extension("pdf");
186+
}
187+
188+
BuildTargetType::Html => {
189+
p.push("index.html");
190+
}
191+
}
192+
185193
p
186194
}
187195
}
@@ -218,6 +226,9 @@ pub struct OutputProfile {
218226
/// The output target type of a document build.
219227
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
220228
pub enum BuildTargetType {
229+
/// Output a tree of HTML files
230+
Html,
231+
221232
/// Output to the Portable Document Format (PDF).
222233
Pdf,
223234
}
@@ -394,18 +405,21 @@ mod syntax {
394405

395406
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
396407
pub enum BuildTargetType {
408+
Html,
397409
Pdf,
398410
}
399411

400412
impl BuildTargetType {
401413
pub fn from_runtime(rt: &super::BuildTargetType) -> Self {
402414
match rt {
415+
super::BuildTargetType::Html => BuildTargetType::Html,
403416
super::BuildTargetType::Pdf => BuildTargetType::Pdf,
404417
}
405418
}
406419

407420
pub fn to_runtime(self) -> super::BuildTargetType {
408421
match self {
422+
BuildTargetType::Html => super::BuildTargetType::Html,
409423
BuildTargetType::Pdf => super::BuildTargetType::Pdf,
410424
}
411425
}
@@ -417,6 +431,7 @@ mod syntax {
417431
S: Serializer,
418432
{
419433
serializer.serialize_str(match *self {
434+
BuildTargetType::Html => "html",
420435
BuildTargetType::Pdf => "pdf",
421436
})
422437
}
@@ -428,8 +443,14 @@ mod syntax {
428443
{
429444
let s = String::deserialize(deserializer)?;
430445
Ok(match s.as_str() {
446+
"html" => BuildTargetType::Html,
431447
"pdf" => BuildTargetType::Pdf,
432-
other => return Err(<D as Deserializer>::Error::unknown_variant(other, &["pdf"])),
448+
other => {
449+
return Err(<D as Deserializer>::Error::unknown_variant(
450+
other,
451+
&["html", "pdf"],
452+
))
453+
}
433454
})
434455
}
435456
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# See elsewhere for changelog
2+
3+
This project’s release notes are curated from the Git history of its main
4+
branch. You can find them by looking at [the version of this file on the
5+
`release` branch][branch] or the [GitHub release history][gh-releases].
6+
7+
[branch]: https://github.com/tectonic-typesetting/tectonic/blob/release/crates/engine_spx2html/CHANGELOG.md
8+
[gh-releases]: https://github.com/tectonic-typesetting/tectonic/releases

crates/engine_spx2html/Cargo.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2022 the Tectonic Project
2+
# Licensed under the MIT License.
3+
4+
# See README.md for discussion of features (or lack thereof) in this crate.
5+
6+
[package]
7+
name = "tectonic_engine_spx2html"
8+
version = "0.0.0-dev.0" # assigned with cranko (see README)
9+
authors = ["Peter Williams <peter@newton.cx>"]
10+
description = """
11+
The Tectonic engine that converts SPX output to HTML.
12+
"""
13+
homepage = "https://tectonic-typesetting.github.io/"
14+
documentation = "https://docs.rs/tectonic_engine_spx2html"
15+
repository = "https://github.com/tectonic-typesetting/tectonic/"
16+
readme = "README.md"
17+
license = "MIT"
18+
edition = "2018"
19+
20+
[dependencies]
21+
byteorder = "^1.4"
22+
percent-encoding = "^2.1"
23+
pinot = "^0.1"
24+
tectonic_bridge_core = { path = "../bridge_core", version = "0.0.0-dev.0" }
25+
tectonic_errors = { path = "../errors", version = "0.0.0-dev.0" }
26+
tectonic_io_base = { path = "../io_base", version = "0.0.0-dev.0" }
27+
tectonic_status_base = { path = "../status_base", version = "0.0.0-dev.0" }
28+
tectonic_xdv = { path = "../xdv", version = "0.0.0-dev.0" }
29+
tempfile = "^3.1"
30+
tera = "^1.13"
31+
32+
[package.metadata.internal_dep_versions]
33+
tectonic_bridge_core = "4e16bf963700aae59772a6fb223981ceaa9b5f57"
34+
tectonic_errors = "317ae79ceaa2593fb56090e37bf1f5cc24213dd9"
35+
tectonic_io_base = "thiscommit:2022-02-20:gQ6H0Gx"
36+
tectonic_status_base = "317ae79ceaa2593fb56090e37bf1f5cc24213dd9"
37+
tectonic_xdv = "c91f2ef37858d1a0a724a5c3ddc2f7ea46373c77"

crates/engine_spx2html/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# The `tectonic_engine_spx2html` crate
2+
3+
[![](http://meritbadge.herokuapp.com/tectonic_engine_spx2html)](https://crates.io/crates/tectonic_engine_spx2html)
4+
5+
This crate is part of [the Tectonic
6+
project](https://tectonic-typesetting.github.io/en-US/). It provides and engine
7+
that converts "SPX" (semantically paginated XDV) files, a customized Tectonic
8+
output, to HTML.
9+
10+
- [API documentation](https://docs.rs/tectonic_engine_spx2html/).
11+
- [Main Git repository](https://github.com/tectonic-typesetting/tectonic/).
12+
13+
14+
## Cargo features
15+
16+
This crate currently provides no [Cargo features][features].
17+
18+
[features]: https://doc.rust-lang.org/cargo/reference/features.html

0 commit comments

Comments
 (0)