lsms-worldbank / adodownr

⏬ Create Quarto package documentation website for Stata packages
Other
6 stars 1 forks source link

Extract package name from another source #27

Closed arthur-shaw closed 9 months ago

arthur-shaw commented 9 months ago

adodown no longer has a name field in the pkg file. The name needs to be extracted from elsewhere. See this conversation.

arthur-shaw commented 9 months ago

@kbjarkefur , let's continue the conversation here to brainstorm the best place to capture the package name.

kbjarkefur commented 9 months ago

Here is my suggestions in order of preference.

  1. Capture the package name form the file name <packagename>.pkg. This file should always be named like that, and ad_publish checks that the file name matches the name in title in the file. My preference since it adds the least requirements to the file.

  2. We can have a commented-out field in the pkg file with name. In a pkg file, a line with a * is considered a comment. For example, net describe skips that when rendering the output. I took advantage of that when coming up with title headers that can be used in adodown. So the lines *** title etc is no convention that means anything else than it is a comment to Stata. For adodown I needed section headers to be able to programmatically read and update the file. This means we can absolutely do this in the pkg file. The first top rows are considered comments, and we can get the package name from *** name labeller.

*** name labeller
*** title
d 'LABELLER': module to manage variable and value labels during data cleaning and preparation

Let me know what you think.

arthur-shaw commented 9 months ago

I agree. Let's pluck the name from the file name (i.e., <packagename>.pkg).