background preloader

Autres

Facebook Twitter

Introducing copytext.py: your words are data too | NPR Visuals. Most of our work lives outside of NPR's content management system. This has many upsides, but it complicates the editing process. We can hardly expect every veteran journalist to put aside their beat in order to learn how to do their writing inside HTML, CSS, Javascript, and Python—to say nothing of version control. That's why we made copytext, a library that allows us to give editorial control back to our reporters and editors, without sacrificing our capacity to iterate quickly. How it works Copytext takes a Excel xlsx file as an input and creates from it a single Python object which we can use in our templates.

Here is some example data: And here is how you would load it with copytext: copy = copytext.Copy('examples/test_copy.xlsx') This object can then be treated sort of like a JSON object. . # Get a sheet by name sheet = copy['content'] # Get a row by index row = sheet[1] # Get a cell by column index cell = row[1] print cell >> "Across-The-Top Header" Into your templates. Enterprise API Management | Digital Strategy | App Services | Apigee. Home. Scintilla and SciTE. ProgrammableWeb - Mashups, APIs, and the Web as Platform.