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

Display git version & date to introduction section #551

Merged
merged 3 commits into from
Jul 28, 2021

Conversation

justahero
Copy link
Contributor

@justahero justahero commented Jul 28, 2021

This change is to know which specific commit of the book is published on the official site: https://defmt.ferrous-systems.com/

Note the sed command is written to work on OSX (the extra .bak parameter) and Unix systems, for some details check this SO discussion

  • add mdbook preprocessor to replace the version placeholder string with the used git version & date
  • add short section in the introduction to display version

Reference:

This is to learn which specific commit of the book is published on the official site: https://defmt.ferrous-systems.com/

* add mdbook preprocessor to replace the version placeholder string with
  the git version and date
* add short section in the introduction to display version

**Note** the `sed` command is written to be compatibly on OSX (the extra `.bak` command) and Unix systems, for some details check this SO discussion: https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux
@jonas-schievink
Copy link
Contributor

The deploy preview still shows the placeholder, did it not work?

@justahero
Copy link
Contributor Author

Yes, it seems the sed command failed in the preprocessor. Will check again and update accordingly.

Instead of find and replace the version via `sed`, the git version &
date are added to an empty `version.md` file that is included in the
introduction section of the book.
@justahero
Copy link
Contributor Author

The preview now displays used git hash and commit date.

@jonas-schievink
Copy link
Contributor

cool!

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 28, 2021

Build succeeded:

@bors bors bot merged commit ed79843 into main Jul 28, 2021
@bors bors bot deleted the feature/display-git-version-in-mdbook branch July 28, 2021 12:22
@Urhengulas
Copy link
Member

That's neat! 🎉

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.

3 participants