;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor) ;;;;;; ;;; Text to string projection (def class* projection/text-to-string (projection) ()) ;;;;;; ;;; Text to string projection constructors (def (function e) make-projection/text-to-string () (make-instance 'projection/text-to-string)) ;;;;;; ;;; Text to string printer (def method project-document (text-document (projection projection/text-to-string)) (bind ((mapping (make-mapping)) ;; TODO: fill mapping (string (with-output-to-string (stream) (iter (for document-element :in-sequence (elements-of (content-of text-document))) (iter (for paragraph-element :in-sequence (elements-of document-element)) (write-string (content-of paragraph-element) stream)) (terpri stream))))) (make-document string :selection (map-reference-forward mapping (selection-of text-document)) :source (make-source text-document projection mapping))))