Compare commits
2 Commits
5244f761d0
...
4d8eab48bf
Author | SHA1 | Date |
---|---|---|
Ryan Rix | 4d8eab48bf | |
Ryan Rix | 238445b349 |
|
@ -83,6 +83,7 @@ build-backend = "maturin"
|
|||
[tool.maturin]
|
||||
module-name = "arroyo.arroyo_rs"
|
||||
features = ["pyo3/extension-module"]
|
||||
compatibility = "linux"
|
||||
#+end_src
|
||||
|
||||
** Nix package declarations
|
||||
|
@ -160,6 +161,12 @@ python3.pkgs.buildPythonPackage rec {
|
|||
};
|
||||
};
|
||||
|
||||
# when i `nix build' everything works; when i `nix-build' it fails
|
||||
# because it tries to install a `linux' wheel and a `manylinux'
|
||||
# wheel that conflict. no idea why since maturinBuildHook etc should
|
||||
# be disabling manylinux
|
||||
postBuild = "rm dist/*manylinux*.whl || true";
|
||||
|
||||
meta = with lib; {
|
||||
description = "An Org-Mode parser library for the arcology project";
|
||||
homepage = "https://cce.whatthefuck.computer/arroyo";
|
||||
|
@ -1099,25 +1106,38 @@ Link exporting is going to be the most complicated part of this because it does
|
|||
let string_path = link.path.to_string();
|
||||
let (proto, stripped_dest) = match string_path.split_once(':') {
|
||||
Some((proto, stripped_dest)) => (proto, stripped_dest.into()),
|
||||
None => ("", string_path),
|
||||
None => ("", string_path.clone()),
|
||||
};
|
||||
let desc = link.desc.clone().unwrap_or(link.path.clone());
|
||||
|
||||
if self.in_public_heading {
|
||||
match proto {
|
||||
"id" => write!(
|
||||
let image_maybe = vec![".png", ".svg", ".jpg", ".jpeg"];
|
||||
if image_maybe
|
||||
.iter()
|
||||
.any(|&suffix| string_path.ends_with(suffix))
|
||||
{
|
||||
write!(
|
||||
w,
|
||||
"<a href=\"{}\">{}</a>",
|
||||
self.rewrite_link_from(&stripped_dest),
|
||||
"<img src=\"{}\" alt=\"{}\"/>",
|
||||
string_path,
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
"roam" => write!(
|
||||
w,
|
||||
"<a href=\"/404?key={}\">{}</a>",
|
||||
HtmlEscape(&link.path),
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
_ => self.inner.start(w, &Element::Link(link.clone()))?,
|
||||
)?
|
||||
} else {
|
||||
match proto {
|
||||
"id" => write!(
|
||||
w,
|
||||
"<a href=\"{}\">{}</a>",
|
||||
self.rewrite_link_from(&stripped_dest),
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
"roam" => write!(
|
||||
w,
|
||||
"<a href=\"/404?key={}\">{}</a>",
|
||||
HtmlEscape(&link.path),
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
_ => self.inner.start(w, &Element::Link(link.clone()))?,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,12 @@ python3.pkgs.buildPythonPackage rec {
|
|||
};
|
||||
};
|
||||
|
||||
# when i `nix build' everything works; when i `nix-build' it fails
|
||||
# because it tries to install a `linux' wheel and a `manylinux'
|
||||
# wheel that conflict. no idea why since maturinBuildHook etc should
|
||||
# be disabling manylinux
|
||||
postBuild = "rm dist/*manylinux*.whl || true";
|
||||
|
||||
meta = with lib; {
|
||||
description = "An Org-Mode parser library for the arcology project";
|
||||
homepage = "https://cce.whatthefuck.computer/arroyo";
|
||||
|
|
|
@ -21,4 +21,5 @@ build-backend = "maturin"
|
|||
[tool.maturin]
|
||||
module-name = "arroyo.arroyo_rs"
|
||||
features = ["pyo3/extension-module"]
|
||||
compatibility = "linux"
|
||||
# Python package definition:1 ends here
|
||||
|
|
|
@ -131,9 +131,9 @@ impl<E: From<Error>, H: HtmlHandler<E>> HtmlHandler<E> for ArroyoHtmlHandler<E,
|
|||
// return Ok(());
|
||||
// }
|
||||
match element {
|
||||
// The Custom HTML Exporter Extensions:1 ends here
|
||||
// The Custom HTML Exporter Extensions:1 ends here
|
||||
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:2]]
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:2]]
|
||||
Element::Title(title) => {
|
||||
let properties = title.properties.clone().into_hash_map();
|
||||
let our_new_id = properties.get("ID");
|
||||
|
@ -174,15 +174,15 @@ impl<E: From<Error>, H: HtmlHandler<E>> HtmlHandler<E> for ArroyoHtmlHandler<E,
|
|||
self.inner.start(w, &element)?
|
||||
}
|
||||
}
|
||||
// The Custom HTML Exporter Extensions:2 ends here
|
||||
// The Custom HTML Exporter Extensions:2 ends here
|
||||
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:3]]
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:3]]
|
||||
Element::Drawer(drawer) => {
|
||||
self.current_drawer = Some(drawer.name.to_string());
|
||||
}
|
||||
// The Custom HTML Exporter Extensions:3 ends here
|
||||
// The Custom HTML Exporter Extensions:3 ends here
|
||||
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:4]]
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:4]]
|
||||
Element::Text { value: before } => {
|
||||
let re = Regex::new(
|
||||
r"(?x)
|
||||
|
@ -202,38 +202,51 @@ impl<E: From<Error>, H: HtmlHandler<E>> HtmlHandler<E> for ArroyoHtmlHandler<E,
|
|||
}
|
||||
}
|
||||
}
|
||||
// The Custom HTML Exporter Extensions:4 ends here
|
||||
// The Custom HTML Exporter Extensions:4 ends here
|
||||
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:5]]
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:5]]
|
||||
Element::Link(link) => {
|
||||
let string_path = link.path.to_string();
|
||||
let (proto, stripped_dest) = match string_path.split_once(':') {
|
||||
Some((proto, stripped_dest)) => (proto, stripped_dest.into()),
|
||||
None => ("", string_path),
|
||||
None => ("", string_path.clone()),
|
||||
};
|
||||
let desc = link.desc.clone().unwrap_or(link.path.clone());
|
||||
|
||||
if self.in_public_heading {
|
||||
match proto {
|
||||
"id" => write!(
|
||||
let image_maybe = vec![".png", ".svg", ".jpg", ".jpeg"];
|
||||
if image_maybe
|
||||
.iter()
|
||||
.any(|&suffix| string_path.ends_with(suffix))
|
||||
{
|
||||
write!(
|
||||
w,
|
||||
"<a href=\"{}\">{}</a>",
|
||||
self.rewrite_link_from(&stripped_dest),
|
||||
"<img src=\"{}\" alt=\"{}\"/>",
|
||||
string_path,
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
"roam" => write!(
|
||||
w,
|
||||
"<a href=\"/404?key={}\">{}</a>",
|
||||
HtmlEscape(&link.path),
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
_ => self.inner.start(w, &Element::Link(link.clone()))?,
|
||||
)?
|
||||
} else {
|
||||
match proto {
|
||||
"id" => write!(
|
||||
w,
|
||||
"<a href=\"{}\">{}</a>",
|
||||
self.rewrite_link_from(&stripped_dest),
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
"roam" => write!(
|
||||
w,
|
||||
"<a href=\"/404?key={}\">{}</a>",
|
||||
HtmlEscape(&link.path),
|
||||
HtmlEscape(&desc),
|
||||
)?,
|
||||
_ => self.inner.start(w, &Element::Link(link.clone()))?,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// The Custom HTML Exporter Extensions:5 ends here
|
||||
// The Custom HTML Exporter Extensions:5 ends here
|
||||
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:6]]
|
||||
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:6]]
|
||||
_ => {
|
||||
if self.in_public_heading {
|
||||
self.inner.start(w, element)?
|
||||
|
|
Loading…
Reference in New Issue