Yuya Nishihara
91d309a93c
templater: extract little helper that parses text and expands aliases
...
The caller doesn't have to care about alias expansion.
2023-03-13 11:45:17 +09:00
Yuya Nishihara
82604eda02
cli: extract complete_newline() to text_util module
...
I'll add more text formatting functions there.
2023-03-10 16:07:55 +09:00
Yuya Nishihara
6af265a388
templater: move Box::new() wrapping to language.wrap_() functions
...
Now all callers do wrap_<type>(Box::new(...)), so its responsibility can be
moved to the callee without extra boxing.
2023-03-08 16:14:24 +09:00
Yuya Nishihara
96f4d8798c
templater: remove redundant TemplateProperty wrapping from method chaining
...
TemplateFunction takes a property and a function to apply to the property
value. That's exactly what a method call does.
2023-03-08 16:14:24 +09:00
Yuya Nishihara
4984e611f4
templater: add "parent_commit_ids" keyword
...
A list type isn't so useful without a map operation, but List<CommitId>
is at least printable. Maybe we can experiment with it to craft a map
operation.
If a map operation is introduced, this keyword might be replaced with
"parents.map(|commit| commit.commit_id)", where parents is of List<Commit>
type, and the .map() method will probably return List<Template>.
2023-03-07 11:33:15 +09:00
Yuya Nishihara
558aa15e6e
templater: remove Template::has_content() superseded by FormatRecorder
2023-03-04 12:10:53 +09:00
Ilya Grigoriev
00b18bcd18
templater: Upper and lowercase ids and strings
2023-02-21 22:50:27 -08:00
Yuya Nishihara
da3c1d2286
templater: extract helpers to build expression of specific types
2023-02-20 18:20:41 +09:00
Yuya Nishihara
c2e0ebca12
templater: implement .into_template() helper on formattable property
...
So that I can blindly write property.into_template() to convert any property
type to template.
2023-02-20 18:20:41 +09:00
Yuya Nishihara
854a3e64fa
templater: split IntoTemplate trait
...
The next commit will implement .into_template() on Box<dyn TemplateProperty>,
so I want a trait for this particular method.
2023-02-20 18:20:41 +09:00
Yuya Nishihara
a3efb74cfc
commit_templater: make commit/change_id typed again
...
This basically undoes d6c6cdb45c
"templater: store type-erased version of
commit/change id." Since they are looked up differently, they should preserve
the original types.
2023-02-20 13:41:44 +09:00
Yuya Nishihara
4f9e75c7d1
templater: use macro to implement property kind wrappers
2023-02-19 16:18:39 +09:00
Yuya Nishihara
aaae90a599
commit_templater: turn property structs into functions
2023-02-19 16:18:39 +09:00
Yuya Nishihara
cf1b609de2
commit_templater: rename 'repo lifetime for clarity
...
FWIW, I'm thinking of making the repo parameter generic over Arc<ReadonlyRepo>
and &MutableRepo. It will allow us cache a parsed commit_summary template.
2023-02-19 16:18:39 +09:00
Yuya Nishihara
c5ddd14c13
commit_templater: extract runtime objects from templater.rs
...
This should reduce future merge conflicts around use statements.
2023-02-19 16:18:39 +09:00
Yuya Nishihara
c396b4cecf
commit_templater: extract parsing functions from template_parser.rs
...
parse_commit_template() is renamed to commit_templater::parse().
2023-02-19 16:18:39 +09:00