Compare commits

...

2 Commits

Author SHA1 Message Date
Ryan Rix 320c4d7f4e another try at in_public_heading filtering woops 2024-04-19 10:34:53 -07:00
Ryan Rix 6a1c334e6a remove debug statements from last night's work 2024-04-03 12:20:20 -07:00
3 changed files with 30 additions and 28 deletions

View File

@ -710,7 +710,7 @@ And now we step in to the state machine. It iterates over each element, providin
cur_id.clone().unwrap(),
) {
Some(dir) => {
dbg!(Some(fetch_attachments(cur_id.clone().unwrap(), dir)))
Some(fetch_attachments(cur_id.clone().unwrap(), dir))
}
None => None,
}
@ -907,7 +907,7 @@ fn find_attach_dir(
if maybe_prop_dir.is_some() {
let pd = maybe_prop_dir.unwrap();
return dbg!(Some(PathBuf::from(pd)));
return Some(PathBuf::from(pd));
}
let filebuf = PathBuf::from(file_path);
@ -989,7 +989,7 @@ fn split_quoted_string(quoted_str: String) -> Result<Vec<String>, Box<dyn Error>
.map(|inner_val| match inner_val {
lexpr::Value::String(string) => string.to_string(),
lexpr::Value::Symbol(string) => string.to_string(),
others => todo!("lexpr roam_aliases or so {:?}", dbg!(others)),
others => todo!("lexpr roam_aliases or so {:?}", others),
})
.collect(),
),
@ -1209,21 +1209,21 @@ Titles need to be checked for export/ignore tags, that the current heading is no
.find(|v| self.options.ignore_tags.contains(v))
.is_some();
// if it's a new ignore tag or a subheading of one we already parsed
self.in_public_heading =
dbg!(!has_ignore_tag && dbg!(title.level) <= dbg!(self.ignore_deeper_than));
self.in_public_heading = !has_ignore_tag && title.level <= self.ignore_deeper_than;
self.in_public_heading = self.in_public_heading
&& dbg!(self.options.limit_headings.is_empty())
|| dbg!(self
&& self.options.limit_headings.is_empty()
|| self
.options
.limit_headings
.intersection(&HashSet::from_iter(
self.heading_breadcrumbs.clone().into_iter(),
))
.count())
.count()
!= 0;
if self.in_public_heading {
self.ignore_deeper_than = 999;
}
self.in_public_heading;
if has_ignore_tag {
self.ignore_deeper_than = title.level;
@ -1277,8 +1277,7 @@ Text parsing is a bit weird to handle rewriting [[id:2e31b385-a003-4369-a136-c6b
",
)
.unwrap();
dbg!(before.clone());
if dbg!(self.in_public_heading) {
if self.in_public_heading {
let after =
re.replace_all(before, "<span class='fc-cloze' title='$2'>$1</span>");
if after.eq(before) {
@ -1335,11 +1334,13 @@ Source blocks should include any information necessary to re-tangle them.
#+begin_src rust
Element::SourceBlock(block) => {
let args = String::from(block.arguments.clone());
if args.len() > 0 {
write!(w, "<span class='babel-args'>{}</span>", args)?
if self.in_public_heading {
let args = String::from(block.arguments.clone());
if args.len() > 0 {
write!(w, "<span class='babel-args'>{}</span>", args)?
}
self.inner.start(w, &Element::SourceBlock(block.clone()))?
}
self.inner.start(w, &Element::SourceBlock(block.clone()))?
}
#+end_src

View File

@ -161,21 +161,21 @@ impl<E: From<Error>, H: HtmlHandler<E>> HtmlHandler<E> for ArroyoHtmlHandler<E,
.find(|v| self.options.ignore_tags.contains(v))
.is_some();
// if it's a new ignore tag or a subheading of one we already parsed
self.in_public_heading =
dbg!(!has_ignore_tag && dbg!(title.level) <= dbg!(self.ignore_deeper_than));
self.in_public_heading = !has_ignore_tag && title.level <= self.ignore_deeper_than;
self.in_public_heading = self.in_public_heading
&& dbg!(self.options.limit_headings.is_empty())
|| dbg!(self
&& self.options.limit_headings.is_empty()
|| self
.options
.limit_headings
.intersection(&HashSet::from_iter(
self.heading_breadcrumbs.clone().into_iter(),
))
.count())
.count()
!= 0;
if self.in_public_heading {
self.ignore_deeper_than = 999;
}
self.in_public_heading;
if has_ignore_tag {
self.ignore_deeper_than = title.level;
@ -225,8 +225,7 @@ impl<E: From<Error>, H: HtmlHandler<E>> HtmlHandler<E> for ArroyoHtmlHandler<E,
",
)
.unwrap();
dbg!(before.clone());
if dbg!(self.in_public_heading) {
if self.in_public_heading {
let after =
re.replace_all(before, "<span class='fc-cloze' title='$2'>$1</span>");
if after.eq(before) {
@ -279,11 +278,13 @@ impl<E: From<Error>, H: HtmlHandler<E>> HtmlHandler<E> for ArroyoHtmlHandler<E,
// [[file:../arroyo-native-parser.org::*The Custom HTML Exporter Extensions][The Custom HTML Exporter Extensions:6]]
Element::SourceBlock(block) => {
let args = String::from(block.arguments.clone());
if args.len() > 0 {
write!(w, "<span class='babel-args'>{}</span>", args)?
if self.in_public_heading {
let args = String::from(block.arguments.clone());
if args.len() > 0 {
write!(w, "<span class='babel-args'>{}</span>", args)?
}
self.inner.start(w, &Element::SourceBlock(block.clone()))?
}
self.inner.start(w, &Element::SourceBlock(block.clone()))?
}
// The Custom HTML Exporter Extensions:6 ends here

View File

@ -149,7 +149,7 @@ pub fn extract_headings(path: String, tree: &Org) -> Result<Vec<Heading>> {
cur_id.clone().unwrap(),
) {
Some(dir) => {
dbg!(Some(fetch_attachments(cur_id.clone().unwrap(), dir)))
Some(fetch_attachments(cur_id.clone().unwrap(), dir))
}
None => None,
}
@ -306,7 +306,7 @@ fn find_attach_dir(
if maybe_prop_dir.is_some() {
let pd = maybe_prop_dir.unwrap();
return dbg!(Some(PathBuf::from(pd)));
return Some(PathBuf::from(pd));
}
let filebuf = PathBuf::from(file_path);
@ -368,7 +368,7 @@ fn split_quoted_string(quoted_str: String) -> Result<Vec<String>, Box<dyn Error>
.map(|inner_val| match inner_val {
lexpr::Value::String(string) => string.to_string(),
lexpr::Value::Symbol(string) => string.to_string(),
others => todo!("lexpr roam_aliases or so {:?}", dbg!(others)),
others => todo!("lexpr roam_aliases or so {:?}", others),
})
.collect(),
),