stencila / dockta

🐳 A Docker image builder for researchers
https://stencila.github.io/dockta/
Apache License 2.0
121 stars 12 forks source link

feat(JATSParser): detect package import statements #52

Open nokome opened 5 years ago

nokome commented 5 years ago

Look for .xml files with <!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) ... elements and detect any package import statements (e.g. Python import, R library, or Node.js require) in any elements matching:

nokome commented 5 years ago

Hah, literally 20 minutes after writing this down discovered this is very similar to what @nuest is doing in https://github.com/jupyter/repo2docker/pull/457/files#diff-6e857ca58d9ac7b40e175db43c40c5d0R287 to detect which Stencila execution contexts to install in repo2docker (although he how out that you only need to look for code specific-use="source")

nuest commented 5 years ago

Good find - and your DOCTYPE check is not a bad idea, just to make sure! In our search we simply look for a manifest.xml file and then take the name of the JATS file from it.