Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PageControls buttons to use v5.3.2 syntax #8579

Merged
merged 7 commits into from
Sep 10, 2024

Conversation

Leilei332
Copy link
Contributor

@Leilei332 Leilei332 commented Sep 1, 2024

It is strange that PageControls buttons uses list widget to display text and icons.

This PR rewrites PageControls buttons and actions to use newer syntax. Including:

  • Replace some list widget with conditonal shortcut syntax
  • Replace macrocall widget with transclude widget
  • Replace some macros with procedures and Substituted Attribute Values
  • Replace vars widget and some set widget with let widget

Copy link

stackblitz bot commented Sep 1, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

github-actions bot commented Sep 1, 2024

Confirmed: Leilei332 has already signed the Contributor License Agreement (see contributing.md)

@Jermolene
Copy link
Member

Thanks @Leilei332 I think this is a good idea.

@pmario
Copy link
Member

pmario commented Sep 1, 2024

IMO there are some buttons missing: [tag[tags: $:/tags/PageControls]] shows all of them or the right sidebar -> Tools tab

@Leilei332 Leilei332 marked this pull request as ready for review September 2, 2024 10:02
Copy link
Member

@Jermolene Jermolene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Leilei332 these are worthwhile improvements. Just one small point below

core/ui/PageControls/manager.tid Outdated Show resolved Hide resolved
core/ui/PageControls/manager.tid Outdated Show resolved Hide resolved
core/ui/Actions/new-journal.tid Outdated Show resolved Hide resolved
@Jermolene
Copy link
Member

Here I do prefer readability over space. So I would prefer <% if [[filter]] %> -- I think the extras spaces here are much more readable. Especially for <%elseif%><%else%> the differences are hard to see

I recognise that you disagree but we have to decide on a single approach and use it consistently. I don't think that the whitespace makes things more readable, rather the opposite: it means that the brain has to process the two parts separately, rather than seeing them as a single symbol.

The other consideration is consistency with the way that we write widgets: we do not write <$ list filter="">.

A further but minor point is that omitting the whitespace will lead to smaller tiddlers.

I will push an update to make things consistent on that basis.

@pmario
Copy link
Member

pmario commented Sep 2, 2024

In the end it is your decision. So I'll change my code in pending PRs accordingly.

@Jermolene
Copy link
Member

In the end it is your decision. So I'll change my code in pending PRs accordingly.

It is no fun deciding these things, and I try to take other peoples views into account, but sometimes we're face with these binary choices where there is no answer that is going to please everyone.

* Omit whitespace in conditional syntax
* Define tf.get-tags function to avoid duplicated text substitution
* Rewrite advanced search button
@kookma
Copy link
Contributor

kookma commented Sep 4, 2024

This PR rewrites PageControls buttons and actions to use newer syntax. Including:

The code is much readable now! Thank you.

@Jermolene
Copy link
Member

Thanks @Leilei332 @pmario – is this ready to merge now?

@saqimtiaz
Copy link
Member

@Jermolene we should make a considered decision as to when we want to prefix the names of functions with tf..

I can understand the rationale behind doing so for global functions or those that can pollute the variable namespace for user content, however is it really necessary in the context of page control buttons? I find that the prefix reduces the legibility and expressiveness of the code.

@pmario
Copy link
Member

pmario commented Sep 6, 2024

I did start a "discussion" some time ago and did reply there: #7955 (comment)

@Jermolene
Copy link
Member

Thanks @Leilei332 I am inclined to agree with @saqimtiaz that we should only use the tf- prefix for globally visible functions. Could you kindly amend the PR? Many thanks.

@Jermolene
Copy link
Member

Thank you @Leilei332

@Jermolene Jermolene merged commit eaf8558 into TiddlyWiki:master Sep 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants