Compare commits
No commits in common. "org-images" and "master" have entirely different histories.
org-images
...
master
198
flake.lock
198
flake.lock
|
@ -1,198 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"advisory-db": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689698236,
|
|
||||||
"narHash": "sha256-Qz9JxGKeA3jwuj1CdK9ejMJ7VsJRdiZniF8lx4mft9s=",
|
|
||||||
"owner": "rustsec",
|
|
||||||
"repo": "advisory-db",
|
|
||||||
"rev": "4aa517564d1d06f0e79784c8ad973a59d68aa9c8",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "rustsec",
|
|
||||||
"repo": "advisory-db",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"crane": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1688772518,
|
|
||||||
"narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=",
|
|
||||||
"owner": "ipetkov",
|
|
||||||
"repo": "crane",
|
|
||||||
"rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "ipetkov",
|
|
||||||
"repo": "crane",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fenix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"rust-analyzer-src": []
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689834114,
|
|
||||||
"narHash": "sha256-btRpL43gvbP+5+gHjaaeZ9Uv6x8LkjaO1kyvEN5rQTE=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "fenix",
|
|
||||||
"rev": "d55d856bcc50ae831f9355465f6a651034f6c8d4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "fenix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673956053,
|
|
||||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1687709756,
|
|
||||||
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689068808,
|
|
||||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689752456,
|
|
||||||
"narHash": "sha256-VOChdECcEI8ixz8QY+YC4JaNEFwQd1V8bA0G4B28Ki0=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "7f256d7da238cb627ef189d56ed590739f42f13b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"advisory-db": "advisory-db",
|
|
||||||
"crane": "crane",
|
|
||||||
"fenix": "fenix",
|
|
||||||
"flake-utils": "flake-utils_2",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": [
|
|
||||||
"crane",
|
|
||||||
"flake-utils"
|
|
||||||
],
|
|
||||||
"nixpkgs": [
|
|
||||||
"crane",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1688351637,
|
|
||||||
"narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "f9b92316727af9e6c7fee4a761242f7f46880329",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
137
flake.nix
137
flake.nix
|
@ -1,137 +0,0 @@
|
||||||
{
|
|
||||||
description = "Build a cargo project";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
||||||
|
|
||||||
crane = {
|
|
||||||
url = "github:ipetkov/crane";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fenix = {
|
|
||||||
url = "github:nix-community/fenix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
inputs.rust-analyzer-src.follows = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
|
|
||||||
advisory-db = {
|
|
||||||
url = "github:rustsec/advisory-db";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, crane, fenix, flake-utils, advisory-db, ... }:
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
};
|
|
||||||
|
|
||||||
inherit (pkgs) lib;
|
|
||||||
|
|
||||||
craneLib = crane.lib.${system};
|
|
||||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
|
||||||
|
|
||||||
# Common arguments can be set here to avoid repeating them later
|
|
||||||
commonArgs = {
|
|
||||||
inherit src;
|
|
||||||
cargoVendorDir = null;
|
|
||||||
buildInputs = [
|
|
||||||
] ++ lib.optionals pkgs.stdenv.isDarwin [
|
|
||||||
# Additional darwin specific inputs can be set here
|
|
||||||
pkgs.libiconv
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
craneLibLLvmTools = craneLib.overrideToolchain
|
|
||||||
(fenix.packages.${system}.complete.withComponents [
|
|
||||||
"cargo"
|
|
||||||
"llvm-tools"
|
|
||||||
"rustc"
|
|
||||||
]);
|
|
||||||
|
|
||||||
# Build *just* the cargo dependencies, so we can reuse
|
|
||||||
# all of that work (e.g. via cachix) when running in CI
|
|
||||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
||||||
|
|
||||||
# Build the actual crate itself, reusing the dependency
|
|
||||||
# artifacts from above.
|
|
||||||
my-crate = craneLib.buildPackage (commonArgs // {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
});
|
|
||||||
in
|
|
||||||
{
|
|
||||||
checks = {
|
|
||||||
# Build the crate as part of `nix flake check` for convenience
|
|
||||||
inherit my-crate;
|
|
||||||
|
|
||||||
# Run clippy (and deny all warnings) on the crate source,
|
|
||||||
# again, resuing the dependency artifacts from above.
|
|
||||||
#
|
|
||||||
# Note that this is done as a separate derivation so that
|
|
||||||
# we can block the CI if there are issues here, but not
|
|
||||||
# prevent downstream consumers from building our crate by itself.
|
|
||||||
my-crate-clippy = craneLib.cargoClippy (commonArgs // {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
|
||||||
});
|
|
||||||
|
|
||||||
my-crate-doc = craneLib.cargoDoc (commonArgs // {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
});
|
|
||||||
|
|
||||||
# Check formatting
|
|
||||||
my-crate-fmt = craneLib.cargoFmt {
|
|
||||||
inherit src;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Audit dependencies
|
|
||||||
my-crate-audit = craneLib.cargoAudit {
|
|
||||||
inherit src advisory-db;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Run tests with cargo-nextest
|
|
||||||
# Consider setting `doCheck = false` on `my-crate` if you do not want
|
|
||||||
# the tests to run twice
|
|
||||||
my-crate-nextest = craneLib.cargoNextest (commonArgs // {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
partitions = 1;
|
|
||||||
partitionType = "count";
|
|
||||||
});
|
|
||||||
} // lib.optionalAttrs (system == "x86_64-linux") {
|
|
||||||
# NB: cargo-tarpaulin only supports x86_64 systems
|
|
||||||
# Check code coverage (note: this will not upload coverage anywhere)
|
|
||||||
my-crate-coverage = craneLib.cargoTarpaulin (commonArgs // {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = {
|
|
||||||
default = my-crate;
|
|
||||||
my-crate-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
apps.default = flake-utils.lib.mkApp {
|
|
||||||
drv = my-crate;
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
|
||||||
inputsFrom = builtins.attrValues self.checks.${system};
|
|
||||||
|
|
||||||
# Additional dev-shell environment variables can be set directly
|
|
||||||
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
|
|
||||||
|
|
||||||
# Extra inputs can be added here
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
cargo
|
|
||||||
rustc
|
|
||||||
rust-analyzer
|
|
||||||
];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -60,7 +60,6 @@ pub struct DefaultHtmlHandler;
|
||||||
|
|
||||||
impl HtmlHandler<Error> for DefaultHtmlHandler {
|
impl HtmlHandler<Error> for DefaultHtmlHandler {
|
||||||
fn start<W: Write>(&mut self, mut w: W, element: &Element) -> IOResult<()> {
|
fn start<W: Write>(&mut self, mut w: W, element: &Element) -> IOResult<()> {
|
||||||
let image_pattern = ["png", "jpeg", "jpg", "gif", "tiff", "tif", "xbm", "xpm", "pbm", "pgm", "ppm", "pnm", "svg", "webp"];
|
|
||||||
match element {
|
match element {
|
||||||
// container elements
|
// container elements
|
||||||
Element::SpecialBlock(_) => (),
|
Element::SpecialBlock(_) => (),
|
||||||
|
@ -122,26 +121,12 @@ impl HtmlHandler<Error> for DefaultHtmlHandler {
|
||||||
Element::Code { value } => write!(w, "<code>{}</code>", HtmlEscape(value))?,
|
Element::Code { value } => write!(w, "<code>{}</code>", HtmlEscape(value))?,
|
||||||
Element::FnRef(_fn_ref) => (),
|
Element::FnRef(_fn_ref) => (),
|
||||||
Element::InlineCall(_) => (),
|
Element::InlineCall(_) => (),
|
||||||
Element::Link(link) => {
|
Element::Link(link) => write!(
|
||||||
let link_extension = &link.path.split(".").last().unwrap();
|
w,
|
||||||
// Orgmode considers something an image both if the pattern
|
"<a href=\"{}\">{}</a>",
|
||||||
// matches /and/ the description is empty.
|
HtmlEscape(&link.path),
|
||||||
if image_pattern.contains(link_extension) && link.desc.is_none() {
|
HtmlEscape(link.desc.as_ref().unwrap_or(&link.path)),
|
||||||
write!(
|
)?,
|
||||||
w,
|
|
||||||
"<img src=\"{}\" alt=\"{}\">",
|
|
||||||
HtmlEscape(&link.path),
|
|
||||||
HtmlEscape(link.desc.as_ref().unwrap_or(&link.path)),
|
|
||||||
)?
|
|
||||||
} else {
|
|
||||||
write!(
|
|
||||||
w,
|
|
||||||
"<a href=\"{}\">{}</a>",
|
|
||||||
HtmlEscape(&link.path),
|
|
||||||
HtmlEscape(link.desc.as_ref().unwrap_or(&link.path)),
|
|
||||||
)?
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Element::Macros(_macros) => (),
|
Element::Macros(_macros) => (),
|
||||||
Element::RadioTarget => (),
|
Element::RadioTarget => (),
|
||||||
Element::Snippet(snippet) => {
|
Element::Snippet(snippet) => {
|
||||||
|
|
Loading…
Reference in a new issue