This sounds like a fussier version of what Donald Knuth was doing with literate programming.
Which, incidentally, is a really enjoyable way to work.