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

Lua: add module "pandoc.path" #7053

Merged
merged 6 commits into from
Feb 3, 2021
Merged

Lua: add module "pandoc.path" #7053

merged 6 commits into from
Feb 3, 2021

Conversation

tarleb
Copy link
Collaborator

@tarleb tarleb commented Jan 27, 2021

The module allows to work with file paths in a convenient and
platform-independent manner.

@tarleb
Copy link
Collaborator Author

tarleb commented Jan 27, 2021

Documentation for the module can be found here: https://github.com/hslua/hslua-module-path

@tarleb tarleb marked this pull request as draft January 27, 2021 15:03
@tarleb tarleb force-pushed the lua-path-module branch 3 times, most recently from d6eebd8 to 922744b Compare February 1, 2021 11:22
The module allows to work with file paths in a convenient and
platform-independent manner.

Closes: jgm#6001
Closes: jgm#6565
@tarleb tarleb marked this pull request as ready for review February 1, 2021 13:31

### directory (filepath) {#pandoc.path.directory}

Get the directory name; move up one level.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what was meant by "move up one level".


Normalizes a path.

- `//` outside of the drive can be made blank
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what this meant...


Returns:

- list of directories in search path (list of strings)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we say array? Table?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Lua manual section on the table module uses "list" to refer to numerically indexed tables, so the terms seemed fitting to me. Do you think an alternative would be clearer?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay, then. I wasn't sure what the official terminology was.

@@ -0,0 +1,17 @@
local tasty = require 'tasty'
local path = require 'pandoc.path'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't hurt to add a few more tests here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could copy the tests from hslua-module-path, but that seems redundant. Would checking for the existence of all documented functions be a good solution?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these checks. I think it should be ok for us to rely on the module package's test suite to make sure that all functions work as expected. At least as long as we include the module without any changes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed.

@jgm jgm merged commit 6f79042 into jgm:master Feb 3, 2021
@tarleb tarleb deleted the lua-path-module branch February 3, 2021 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants