Extend new_tag() to support content specification

Bug #2044599 reported by Chris Papademetrious
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Committed
Undecided
Unassigned

Bug Description

In the Perl XML::Twig library, the new() element creation method at

https://www.xmltwig.org/xmltwig/twig_dev.html#METHODS_XML_Twig_Elt_new

supports three arguments:

* The tag name of the new element to create
* A hash of initial attribute values
* An array of initial content objects

The new_tag() method in Beautiful Soup supports initial attribute values but not initial content objects. This might be a straightforward extension of the UI, by allowing one or more string and/or Tag/BeautifulSoup objects to be specified after the tag name:

my_title = soup.new_tag('title', my_title_string_var)

Changed in beautifulsoup:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.