-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for labels attribute (#13)
* Add support for labels attributes * Include full generated sdk * Fix missing labels * Build fixes * Fmt * Add `revision.labels` * Add missing labels to tests * Add test to check for empty labels * Use commas instead of semicolons (AsciiDoc has no standard for this) * Oops missed a semicolon * Schema updates --------- Co-authored-by: augustuswm <[email protected]>
- Loading branch information
1 parent
629e7b5
commit 648c224
Showing
14 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
rfd-model/migrations/2024-02-28_add_labels_to_rfd_revision/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE rfd_revision DROP COLUMN labels; |
1 change: 1 addition & 0 deletions
1
rfd-model/migrations/2024-02-28_add_labels_to_rfd_revision/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE rfd_revision ADD COLUMN labels VARCHAR; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,14 @@ impl<'a> RfdAttributes for RfdAsciidoc<'a> { | |
}) | ||
}) | ||
} | ||
|
||
fn get_labels(&self) -> Option<&str> { | ||
self.attr("labels") | ||
} | ||
|
||
fn update_labels(&mut self, value: &str) { | ||
self.set_attr("labels", value) | ||
} | ||
} | ||
|
||
#[async_trait] | ||
|
@@ -570,6 +578,7 @@ sdf | |
:revremark: State: {state} | ||
:docdatetime: 2019-01-04 19:26:06 UTC | ||
:localdatetime: 2019-01-04 19:26:06 UTC | ||
:labels: label1, label2 | ||
= RFD 123 Place | ||
FirstName LastName <[email protected]> | ||
|
@@ -626,4 +635,31 @@ in velit. | |
|
||
assert_eq!(expected, pdf); | ||
} | ||
|
||
#[test] | ||
fn test_get_asciidoc_labels() { | ||
let rfd = RfdAsciidoc::new(Cow::Borrowed(test_rfd_content())); | ||
let labels = rfd.get_labels().unwrap(); | ||
let expected = "label1, label2".to_string(); | ||
assert_eq!(expected, labels); | ||
} | ||
|
||
#[test] | ||
fn test_get_asciidoc_empty_labels() { | ||
let content = r#"sdfsdf | ||
= RFD 43 Identity and Access Management (IAM) | ||
No labels here | ||
"#; | ||
let rfd = RfdContent::new_asciidoc(content); | ||
assert!(rfd.get_labels().is_none()); | ||
} | ||
|
||
#[test] | ||
fn test_update_asciidoc_labels() { | ||
let mut rfd = RfdAsciidoc::new(Cow::Borrowed(test_rfd_content())); | ||
rfd.update_labels("newlabel1, newlabel2"); | ||
let labels = rfd.get_labels().unwrap(); | ||
let expected = "newlabel1, newlabel2".to_string(); | ||
assert_eq!(expected, labels); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters