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

Link to macro syntax page from spec syntax page #3352

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

dmnks
Copy link
Contributor

@dmnks dmnks commented Oct 2, 2024

We speak about (built-in) macros and their expansion in various parts of the spec page but never care to actually mention to the reader that there's a dedicated page on macro syntax. Add a bunch of links where appropriate, and since one of those places mentions %dnl, also add %dnl to the macro page (this used to be there, just got missed in the reformatting commit 015c829).

Fixes: #3331

@dmnks dmnks requested a review from a team as a code owner October 2, 2024 10:45
@dmnks dmnks requested review from pmatilai and removed request for a team October 2, 2024 10:45
@dmnks
Copy link
Contributor Author

dmnks commented Oct 2, 2024

Now that I look at the placement of the %dnl description again, I wonder if it really belongs to that particular table. Maybe "Spec specific macros" would be a better fit?

@pmatilai
Copy link
Member

pmatilai commented Oct 3, 2024

Uh, how on earth we didn't have %dnl documented in the macro docs? 😳 It certainly belongs in that table, it's not spec-specific although that's where the most typical usage may be.

Putting this into the "Comments" section seems strange. We should have (however brief) section about macros in the syntax, probably as the very first subsection as they're so fundamental to the spec. Maybe something like

### Macros

Each line in the spec is macro-expanded before further processing. The macro syntax and the built-in macros are 
described in <insert link>. Typically there are vast amounts of other macros available for helping with
common packaging tasks.

@dmnks
Copy link
Contributor Author

dmnks commented Oct 3, 2024

Ack, I was too lazy and just added plain links but of course, it felt weird because then how do you decide which mentions of "macros" you turn into links... 😅 So yup, having a small, dedicated intro would be much better. I'll fix it up.

@dmnks
Copy link
Contributor Author

dmnks commented Oct 8, 2024

Thanks, I've used your suggestion 😄 Should be fixed now.

@ffesti
Copy link
Contributor

ffesti commented Oct 8, 2024

"discard to next line" sounds weird to me. How about "discard rest of the line"?

@dmnks
Copy link
Contributor Author

dmnks commented Oct 8, 2024

The descriptions comes from the original commit that added %dnl where it says in the commit message:

... literally discards everything until the next newline (or end of string).

That said, unless there's a technical to reason to word it like that, I agree it'd sound more natural to just say "discard rest of the line".

Copy link
Contributor Author

@dmnks dmnks left a comment

Choose a reason for hiding this comment

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

Oh yup, thanks! (re: fixup commits)

@dmnks
Copy link
Contributor Author

dmnks commented Oct 8, 2024

OK, one theory as to whether it was worded like that: If you have a multiline macro with the line continuation mark at end of line, you technically have a single logical line, but two (text) lines:

%comment see\
%dnl comment\
this

rpm --eval "%comment" prints this:

see
this

@dmnks
Copy link
Contributor Author

dmnks commented Oct 8, 2024

Maybe I'm reading too much into it, though, but it does seem like a somewhat important distinction 😄

@dmnks
Copy link
Contributor Author

dmnks commented Oct 8, 2024

All that theorizing aside, typically when we mention "line" we mean the textual line, and I'm yet to see a language whose syntax interprets such line continuation markers in comments, so yep... I'm reading too much into it 😄

@pmatilai
Copy link
Member

pmatilai commented Oct 9, 2024

The "discard to next line" is a very deliberate wording, because that's what the acronym stands for, and how M4's dnl is described: https://www.gnu.org/software/m4/manual/html_node/Dnl.html, and M4 dnl is what we want people to associate this with 😄

@pmatilai
Copy link
Member

pmatilai commented Oct 9, 2024

I think it's fine as-is, just squash the two spelling fixes to the second commit.

@dmnks
Copy link
Contributor Author

dmnks commented Oct 9, 2024

The "discard to next line" is a very deliberate wording, because that's what the acronym stands for, and how M4's dnl is described: https://www.gnu.org/software/m4/manual/html_node/Dnl.html, and M4 dnl is what we want people to associate this with 😄

Right, I had a feeling this must be deliberate 😄 Thanks for confirming.

This was lost in translation, since commit
015c829, so add it back.
Macros play a rather big role in spec parsing, yet we were missing a
word about there being a separate page, how come!

Fixes: rpm-software-management#3331
@dmnks
Copy link
Contributor Author

dmnks commented Oct 9, 2024

OK, we've had enough of bike shedding on this one, I think, merging now.

@dmnks dmnks merged commit 0e17cb8 into rpm-software-management:master Oct 9, 2024
1 check 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.

Macro syntax and Spec syntax doc. pages should be interlinked
3 participants