5.4.1. Weaver Control

The python function 'get_weaver()' refers to the current weaver. You can use it to call methods directly on the weaver. For example:
  @weaver = get_weaver()
  @weaver.write('Antidis')
  @weaver.begin_bold()
  @weaver.write('establishmentarianism')
  @weaver.end_bold()
   is a long word. Note the space on this line!
which comes out as Antidisestablishmentarianism is a long word. Note the space on this line!

You can also set the weaver. Suppose you have a weaver mynotes_weaver, then you can write:

  @old_weaver = get_weaver()
  @set_weaver(mynotes_weaver)
  This is woven into notes.
  @set_weaver(old_weaver)

To make this more convenient, the set_weaver function returns the current weaver so you can write:

  @old_weaver = set_weaver(mynotes_weaver)
  This is woven into notes.
  @set_weaver(old_weaver)

Even more convenient, you can push and pop weavers onto a stack using

  @push_weaver(mynotes_weaver)
  This is woven into notes.
  @pop_weaver()

The current weaver is lexically scoped.