panvimdoc icon indicating copy to clipboard operation
panvimdoc copied to clipboard

Setting up date / date pattern manually

Open backdround opened this issue 2 years ago • 2 comments
trafficstars

I've noticed that there is an almost empty commit after any changes that aren't related to documentation: image this commit

It bothers me a little (I don't like to produce empty commits), and I see possible solutions:

  • allow a user to set a date manually
  • allow a user to set a date-pattern manually

Hypothetical github-actions' usage with the date:

      - name: Generate date
        id: generate_date
        run: echo "date=$(date +%Y)" >> "$GITHUB_OUTPUT"

      - name: panvimdoc
        uses: kdheepak/panvimdoc@main
        with:
          vimdoc: improved-search.nvim
          date: ${{ steps.generate_date.outputs.date }}

Hypothetical github-actions' usage with the date-pattern:

      - name: panvimdoc
        uses: kdheepak/panvimdoc@main
        with:
          vimdoc: improved-search.nvim
          date-pattern: "%Y"

I think date-pattern seems easier to use.

I would make a PR if you say it makes sense to implement any of the things.

By the way, thank you for the great project!

backdround avatar Oct 31 '23 12:10 backdround

Thanks for opening an issue!

The lua output writer script actually already supports taking date as a metadata.

https://github.com/kdheepak/panvimdoc/blob/7e9a072bde76f9f83f16b73793b61133c3c68b94/scripts/panvimdoc.lua#L199

I just haven't propagated this option to the GitHub action or the panvimdoc.sh command line script. So this issue is good to track that feature.

Additionally, if we exposed the date pattern as well, here's where that pattern would go:

https://github.com/kdheepak/panvimdoc/blob/7e9a072bde76f9f83f16b73793b61133c3c68b94/scripts/panvimdoc.lua#L119

There is also already currently a description: field that you can use that will replace both "For NVIM version" and "Last change: date" with a text description of your choice for reproducible docs (this is what I use for running tests on CI and locally). If this field is empty (which it is by default) it then uses the "For NVIM version" + "Last change: date" string as the description. I think I should better communicate this in the README.

kdheepak avatar Oct 31 '23 14:10 kdheepak

@kdheepak Sorry, I didn't understand what to do.

I don't think that date is very useful, but --title-date-pattern is Is it okey if I delete meta.date and add meta.titledatepattern?

backdround avatar Oct 31 '23 22:10 backdround