jwfoley / ingredients Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
HTML/CSS lets you hide specified elements when printing the page, so take advantage of that to hide the reset buttons etc. https://stackoverflow.com/questions/355313/how-do-i-hide-an-element-when-printing-a-web-page
The individual_ingredient
branch has a rough attempt to create adjustable inline ingredients. However, each one requires its own HTML form
; I considered just making one big form for the whole thing but then the reset buttons won't work. And when the entire form
is inline, it gets displayed as line breaks. I think I need to redesign all of this as a postprocessor rather than a preprocessor, so the lines are already formatted into HTML elements before I parse them, and then everything will be correctly nested - or at least instead of trying to cheat and scan for line breaks between elements, I can just look up to the parent.
Currently generate_ingredient_table
takes an unparsed lxml.etree.Element
with the ingredient text and parses that text, then returns a new Element with the appropriate table/form. Those steps could be separate functions, perhaps with the parsed ingredients stored in a better format than a list of lists (at least the inner ones ought to be tuples! maybe a namedtuple
), which would also allow the higher-level Ingredients.run
to intercept the parsed ingredients in order to accumulate a table of all ingredients used in all steps.
I implemented automatic total calculation, if all the ingredients in a table have the same unit, but I was too lazy to add local or global settings to suppress that feature if undesired.
I tried using markdown.markdown()
to format the text inside an ingredient name, but it didn't work because it creates HTML tags like <strong>
, which is then (correctly) interpreted by lxml
as a child element rather than just plain text and I haven't allowed for that. I think this also means additional HTML tags inside the <ingredients>
element would break it too. I haven't tried it in the current simple implementation of the direction list but that might not break as badly since it's not using <lxml>
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.