-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add title to footer #11
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
There is one issue with extracting the title for adoc files. Otherwise this is good.
end | ||
-- add white spaces between title and slide number | ||
local white_space_fill = string.rep(" ", width - title_len - #footer_nrs) | ||
local footer_text = presentation_title .. white_space_fill .. footer_nrs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always wanted to have this, but I was too lazy. Nice!
H.extract_title = function(slide) | ||
local title = "" | ||
for _, line in pairs(vim.split(slide, "\n")) do | ||
-- if line is nonempty set it as title | ||
if line:match("%S") then | ||
title = line | ||
break | ||
end | ||
end | ||
-- strip any trailing whitespace | ||
title = title:gsub("%s+$", "") | ||
-- strip any starting * or # for org and md | ||
title = title:gsub("^%*+%s*", "") | ||
title = title:gsub("^#+%s*", "") | ||
return title | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit hacky but extracts the title from the first line of the first slide.
It also left aligns the title and right aligns the slide nr.