Skip to content

An extension for Numbas providing functions to create a link to download a randomly generated text or CSV file

License

Notifications You must be signed in to change notification settings

numbas/numbas-extension-download-a-text-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Download text file

This extension provides a function download_link(filename,content,link_text), which creates an HTML link tag with the given link tag. When the student clicks on the link, a file with the given filename and content is downloaded.

There's a demo question showing how to use this extension.

download_link(filename,content,link_text)

Creates an HTML link tag which downloads a file with the given filename and text content. If you don't give link_text, the link reads "Download filename".

csv(data,headers)

Format a set of data as a CSV file.

  • If data is a list of lists, The second argument headers is an optional list of strings to use as column headers.
  • If data is a list of dictionaries, the output contains a column for each distinct key in those dictionaries.
  • If data is a dictionary, it's assumed to map headers to columns of data.

About

An extension for Numbas providing functions to create a link to download a randomly generated text or CSV file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages