https://github.com/anenadic/extract-exercises

https://github.com/anenadic/extract-exercises

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: anenadic
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 18.6 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

extract-exercises

Python code provided by Toby Hodges from The Carpentries ⭐ (and slightly modified by myself) to extract exercises for lessons in the Carpentries Workbench format from episode text. The code writes the result to stdout.

Original code by Toby:

```python from sys import argv, stdout

episode_files = argv[:]

for episode in episode_files: title = '' exercise = False with open(episode, 'r') as infh: for line in infh.readlines(): if line.startswith('title: '): _, title = line.split(': ') stdout.write(f'# {title}') elif line.strip().endswith('::: challenge'): exercise = True else: if line.strip().endswith(':::') or line.strip().endswith('::: solution'): exercise = False elif exercise: stdout.write(line) ```

Execution

Copy the Python script into the episodes folder of the lesson and then run it as:

$ python3 extract_exercises.py *.md > exercises.md

to get one big file with all exercises from all the episodes.

Alternatively, you can write a small bash script like the one below to extract episodes into separate files:

bash for file in *.md; do if [ -f "$file" ]; then echo "Converting $file" python3 extract_exercises.py $file > exercises-$file fi done

Owner

  • Name: Aleksandra Nenadic
  • Login: anenadic
  • Kind: user
  • Location: Manchester, UK
  • Company: Software Sustainability Institute

GitHub Events

Total
  • Watch event: 1
  • Push event: 5
Last Year
  • Watch event: 1
  • Push event: 5

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 13
  • Total Committers: 1
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 13
  • Committers: 1
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Aleksandra Nenadic a****c@m****k 13
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels