QuantEcon / quantecon-book-theme

A Jupyter Book Theme for QuantEcon Book Style Projects
BSD 3-Clause "New" or "Revised" License
41 stars 21 forks source link

Adding author names in title of the main page #239

Closed AakashGfude closed 11 months ago

AakashGfude commented 11 months ago
Screen Shot 2023-12-11 at 1 57 09 pm

Author names from the description need to be removed from individual repos.

fixes https://github.com/QuantEcon/quantecon-book-theme/issues/233

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (e65778b) 73.18% compared to head (d81a464) 73.07%. Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #239 +/- ## ========================================== - Coverage 73.18% 73.07% -0.11% ========================================== Files 2 2 Lines 261 260 -1 ========================================== - Hits 191 190 -1 Misses 70 70 ``` | [Flag](https://app.codecov.io/gh/QuantEcon/quantecon-book-theme/pull/239/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=QuantEcon) | Coverage Δ | | |---|---|---| | [pytests](https://app.codecov.io/gh/QuantEcon/quantecon-book-theme/pull/239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=QuantEcon) | `73.07% <100.00%> (-0.11%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=QuantEcon#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mmcky commented 11 months ago

@jstac we are adding the ability to create hyperlinked names as well but let us know what you think of style.

I think:

What do you think about the relative text size?

AakashGfude commented 11 months ago

@mmcky author names with links, i have kept it blue purposefully to indicate its clickable. https://github.com/QuantEcon/quantecon-book-theme/assets/6542997/d8e53230-30e7-4b9f-834f-46bfb5d46ab1

The config variable for this is:

authors:
        - name: Thomas J. Sargent
          url: http://www.tomsargent.com/
        - name: John Stachurski
          url: https://johnstachurski.net/
AakashGfude commented 11 months ago

Note that this link feature extends to author names displayed in sub-pages as well. But will revert to previous non-clickable titles if the authors config is not provided.

AakashGfude commented 11 months ago

@mmcky have added the feature now to:

  1. if number of elements (names) ==2 use and
  2. if number of elements (names) > 2 then use name1, name2, and name3
  3. and nothing for number of elements (names) < 2
AakashGfude commented 11 months ago
mmcky commented 11 months ago

thanks @AakashGfude -- great work.

mmcky commented 11 months ago

@AakashGfude would we be able to add font size as a parameter in the config then we can adjust if needed.

AakashGfude commented 11 months ago

@AakashGfude I think the remaining items are:

* [ ]  check if no author information is provided then the element is not added to the HTML

@mmcky this should be handled already. If no author dict is provided, then we take the author names from the old author key (But it doesn't have hyperlinks). If even that is not available, then the element should be empty.

Let me know if this is not working. I will test it again too.

mmcky commented 11 months ago

Thanks @AakashGfude that's great.

AakashGfude commented 11 months ago

@mmcky I have created a config for font size. called author_font_size. Looking for name ideas. Should we just use it for the main toc page. or the rest of the pages as well? Rest of the page have different header size to front toc page, so the same font size might for authors might not have the same look.

The property has default value of 18px. We can set pixels, by giving a number. FOr example:

html_theme_options:
        author_font_size: 20

would set 20px.

mmcky commented 11 months ago

Should we just use it for the main toc page. or the rest of the pages as well?

I think this should be just for main page as it is likely to be bigger than other pages. I think the other pages is OK as it is (matching font size to text around it).

I suspect the other pages are using the author information in _config.yml. Is that right? We should add a note to the documentation perhaps.

If yes, maybe the theme author setting should be

mainpage_author mainpage_author_fontsize

What do you think about that?

thanks @AakashGfude

AakashGfude commented 11 months ago

@mmcky, I made the other pages also use authors with hyperlinks, cause I suspected readers would want that clickable as well? And not having to go to main toc to get the link? What do you think? The font size one I agree.

mmcky commented 11 months ago

@mmcky, I made the other pages also use authors with hyperlinks, cause I suspected readers would want that clickable as well? And not having to go to main toc to get the link? What do you think?

@AakashGfude -- Roger that. That makes sense and also becomes a single source of truth. So the way it works is if Author is specified in _config.yml then that will get used, but if author is specified in html_theme_options that will take priority?

Let's keep the relationship in font size on the other pages (to the surrounding text) and only allow font size changes for the mainpage. ✅

AakashGfude commented 11 months ago

So the way it works is if Author is specified in _config.yml then that will get used, but if author is specified in html_theme_options that will take priority?

That's right @mmcky.

Let's keep the relationship in font size on the other pages (to the surrounding text) and only allow font size changes for the mainpage. ✅

Done!

Great. I will merge and make a release.