Skip to content
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
39 changes: 27 additions & 12 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ pyproject-toml = "0.13.7"
reqwest = { version = "0.13.3", features = ["blocking"] }
rustpython-parser = "0.4.0"

serde = { version = "1", features = ["derive"] }
strum = { version = "0.28.0", features = ["derive", "strum_macros"] }
tera = "1.20.1"
serde = { version = "1", features = ["derive"] }
sphinx_inv = { version = "0.3.0" }
strum = { version = "0.28.0", features = ["derive", "strum_macros"] }
tera = "1.20.1"

tokio = { version = "1.45", features = [
"rt",
Expand Down
20 changes: 12 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ pub use crate::fs::{get_module_name, get_package_modules, walk_package};
use crate::indexing::external::cache::init_cache;
use crate::indexing::external::fetch::fill_cache;
use crate::indexing::index::RawIndex;
use crate::parsing::sphinx::inv_file::parse_objects_inv_file;
use crate::parsing::sphinx::types::{ExternalSphinxRef, StdRole};
use crate::render::formats::Renderer;
pub use crate::render::render_module;
use crate::render::{jupyter::render_notebook, render_object};
use parsing::sphinx::types::SphinxType;

use sphinx_inv::{SphinxInventoryReader, SphinxReference, SphinxType, StdRole};

use color_eyre::Result;
use color_eyre::eyre::eyre;
Expand Down Expand Up @@ -69,14 +68,16 @@ pub async fn render_docs(config_builder: ConfigBuilder) -> Result<Vec<PathBuf>>
}
let external_base_url = Url::parse(&ext_index.url)?;

let inv_references = parse_objects_inv_file(&inv_path)?;
for r in inv_references {
let reference_reader = SphinxInventoryReader::from_path(&inv_path)?;
for maybe_ref in reference_reader {
let r = maybe_ref?;
if !should_include_reference(&r) {
continue;
}
let expanded_location = &r.expanded_location();
index
.external_object_store
.insert(r.name, external_base_url.clone().join(&r.location)?);
.insert(r.name, external_base_url.clone().join(expanded_location)?);
}
}

Expand Down Expand Up @@ -175,7 +176,7 @@ pub async fn render_docs(config_builder: ConfigBuilder) -> Result<Vec<PathBuf>>
Ok(errored)
}

fn should_include_reference(r: &ExternalSphinxRef) -> bool {
fn should_include_reference(r: &SphinxReference) -> bool {
// just include python refs and std doc refs, we'll see if we actually
// need/want the rest
match r.sphinx_type {
Expand All @@ -185,7 +186,10 @@ fn should_include_reference(r: &ExternalSphinxRef) -> bool {
| SphinxType::Mathematics(_)
| SphinxType::Cpp(_)
| SphinxType::JavaScript(_)
| SphinxType::ReStructuredText(_) => false,
| SphinxType::ReStructuredText(_)
| SphinxType::Cmake(_)
| SphinxType::Sip(_)
| SphinxType::Http(_) => false,
}
}

Expand Down
1 change: 0 additions & 1 deletion src/parsing/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod python;
pub mod sphinx;

pub use python::object::ObjectDocumentation;
Loading
Loading