Skip to content

Adding elements nonsequentially #27

Open
@etfre

Description

@etfre

It would be nice, especially when using loaded documents, to be able to manipulate a document in some manner beyond appending elements to their parent element. Two possibilities that leap to mind:

  1. Add an index kwarg to the various add methods so that they can be used in lieu of insert. Possibly include a delete method as well.
  2. Subclass the paragraphs and runs properties of the Document and Paragraph classes, respectively. Overwrite the various list methods to appropriately modify the underlying Etree elements. For instance, d.paragraphs[3] = "Hello world" would replace the 4th paragraph with a new hello world paragraph. This could be powerful and flexible, but it also feels hackish. I'm not really sure.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions