From da2d7535e8f16139caae016805c10833082bcf27 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 5 Oct 2023 00:17:06 -0400 Subject: [PATCH] Add synonyms for name. --- .../affiliated_keyword/all_name.org | 17 +++++++++++++++++ .../affiliated_keyword/tblname_on_non_table.org | 2 ++ org_mode_samples/greater_element/table/name.org | 2 ++ src/parser/util.rs | 9 ++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 org_mode_samples/affiliated_keyword/all_name.org create mode 100644 org_mode_samples/affiliated_keyword/tblname_on_non_table.org create mode 100644 org_mode_samples/greater_element/table/name.org diff --git a/org_mode_samples/affiliated_keyword/all_name.org b/org_mode_samples/affiliated_keyword/all_name.org new file mode 100644 index 0000000..1934c83 --- /dev/null +++ b/org_mode_samples/affiliated_keyword/all_name.org @@ -0,0 +1,17 @@ +#+name: foo +: bar + +#+source: foo +: bar + +#+tblname: foo +: bar + +#+resname: foo +: bar + +#+srcname: foo +: bar + +#+label: foo +: bar diff --git a/org_mode_samples/affiliated_keyword/tblname_on_non_table.org b/org_mode_samples/affiliated_keyword/tblname_on_non_table.org new file mode 100644 index 0000000..4c8a0e0 --- /dev/null +++ b/org_mode_samples/affiliated_keyword/tblname_on_non_table.org @@ -0,0 +1,2 @@ +#+tblname: foo +: bar diff --git a/org_mode_samples/greater_element/table/name.org b/org_mode_samples/greater_element/table/name.org new file mode 100644 index 0000000..b5d3a56 --- /dev/null +++ b/org_mode_samples/greater_element/table/name.org @@ -0,0 +1,2 @@ +#+NAME: foo +| foo | bar | diff --git a/src/parser/util.rs b/src/parser/util.rs index 02dcfc6..8d4ce02 100644 --- a/src/parser/util.rs +++ b/src/parser/util.rs @@ -280,7 +280,14 @@ pub(crate) fn indentation_level<'b, 'g, 'r, 's>( pub(crate) fn get_name<'s>(affiliated_keywords: &Vec>) -> Option<&'s str> { let name_keyword = affiliated_keywords .iter() - .filter(|kw| kw.key.eq_ignore_ascii_case("name")) + .filter(|kw| { + kw.key.eq_ignore_ascii_case("name") + || kw.key.eq_ignore_ascii_case("source") + || kw.key.eq_ignore_ascii_case("tblname") + || kw.key.eq_ignore_ascii_case("resname") + || kw.key.eq_ignore_ascii_case("srcname") + || kw.key.eq_ignore_ascii_case("label") + }) .last(); name_keyword.map(|kw| kw.value) }