diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-01-28 20:01:53 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-02-01 17:49:03 +0200 |
commit | b160ad5b9f0e38859b0a6d3c3262afbb39067584 (patch) | |
tree | 7f2fe57569bdf9d77d0bc30e3fac78ba2d32ff92 /src/doc.rs | |
parent | 4892ab97637c3727834248aba19b0407439c1f5f (diff) | |
download | subplot-b160ad5b9f0e38859b0a6d3c3262afbb39067584.tar.gz |
refactor: turn loading Markdown from a file into a constructor
Previously, we used the TryFrom<&Path> trait, but it's not clear that
converting a pathname into a Markdown value means reading it. An
associated function that reads a file is clearer.
Sponsored-by: author
Diffstat (limited to 'src/doc.rs')
-rw-r--r-- | src/doc.rs | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -13,7 +13,6 @@ use crate::{Metadata, YamlMetadata}; use crate::{Warning, Warnings}; use std::collections::HashSet; -use std::convert::TryFrom; use std::default::Default; use std::fmt::Debug; use std::fs::read; @@ -147,7 +146,7 @@ impl Document { let mdfile = meta.markdown(); let mdfile = basedir.join(mdfile); - let mut md = Markdown::try_from(mdfile.as_path())?; + let mut md = Markdown::load_file(mdfile.as_path())?; md.set_metadata(&meta); let markdowns = vec![mdfile]; |