Add synonyms for name.

This commit is contained in:
Tom Alexander 2023-10-05 00:17:06 -04:00
parent 1351577c5a
commit da2d7535e8
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,17 @@
#+name: foo
: bar
#+source: foo
: bar
#+tblname: foo
: bar
#+resname: foo
: bar
#+srcname: foo
: bar
#+label: foo
: bar

View File

@ -0,0 +1,2 @@
#+tblname: foo
: bar

View File

@ -0,0 +1,2 @@
#+NAME: foo
| foo | bar |

View File

@ -280,7 +280,14 @@ pub(crate) fn indentation_level<'b, 'g, 'r, 's>(
pub(crate) fn get_name<'s>(affiliated_keywords: &Vec<Keyword<'s>>) -> 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)
}