Skip to content

Get raw values, without HTML tags #64

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

Closed
ZsharE opened this issue Nov 3, 2021 · 7 comments
Closed

Get raw values, without HTML tags #64

ZsharE opened this issue Nov 3, 2021 · 7 comments

Comments

@ZsharE
Copy link

ZsharE commented Nov 3, 2021

Hi,

Is there any way to get the plain data value, without the HTML tag ?
Right know the {{ page.meta.git_revision_date_localized }} and {{ page.meta.git_creation_date_localized }} renders in a span tag.

<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-iso_date">2021-11-3</span>

There should be an option to be able to use only the date value.

I need this to be able to create custom meta tags for: article:published_time & article:modified_time properties like this:

<meta property="article:published_time" content="{{ page.meta.git_creation_date_localized }}">
<meta property="article:modified_time" content="{{ page.meta.git_revision_date_localized }}">

Thanks

@timvink
Copy link
Owner

timvink commented Nov 3, 2021

Hi @ZsharE. Good point, I agree the raw date strings should be available for developers. Currently the span is hardcoded:

# Wrap in <span> for styling
for date_type, date_string in date_formats.items():
date_formats[date_type] = (
'<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-%s">%s</span>'
% (date_type, date_string)
)

I made some quick and dirty edits and exposed more date variants in page.meta (ff73362). Just released in 0.10.1. You can find the list of new available tags at https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/howto/override-a-theme/#custom-themes

@ZsharE
Copy link
Author

ZsharE commented Nov 3, 2021

Hi @timvink ,

Thanks for the quick release, but there's a little problem:

is_first_commit should be True.

Right now, the revision_date = creation_date.

@ZsharE ZsharE changed the title Get plain values, without HTML tags Get raw values, without HTML tags Nov 4, 2021
@ZsharE
Copy link
Author

ZsharE commented Nov 8, 2021

Hi @timvink , any update about this issue ?

@timvink
Copy link
Owner

timvink commented Nov 8, 2021

It's on my list but have had other stuff on my plate. Will prob look at it next Wednesday.

@ThomasArdal
Copy link

@timvink Sounds great. Let us know if we can help with anything. Test, etc.

@timvink
Copy link
Owner

timvink commented Nov 10, 2021

Should be fixed now. I also spent a bit more time refactoring the code as 0.10.1 introduced extra overhead due to extra git log operations.

Releases notes: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/releases/tag/v0.10.2

@ZsharE
Copy link
Author

ZsharE commented Nov 11, 2021

Everything works great now, thanks !

@ZsharE ZsharE closed this as completed Nov 11, 2021
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

No branches or pull requests

3 participants