diff options
author | Ludovic Court`es | 2007-03-28 08:44:53 +0000 |
---|---|---|
committer | Ludovic Court`es | 2007-03-28 08:44:53 +0000 |
commit | 3c3f0cdecb1b037447bb4cb222ac5a34a8634a09 (patch) | |
tree | e3c1469479e1c1f3bf967b29f14246577e7d57bb | |
parent | 69ec14620bc8b2780fca8ec1c3f4cde5204d6f84 (diff) | |
parent | 13fa68c13373e4f34d74935e3c6650d637d40541 (diff) | |
download | skribilo-3c3f0cdecb1b037447bb4cb222ac5a34a8634a09.tar.gz skribilo-3c3f0cdecb1b037447bb4cb222ac5a34a8634a09.tar.lz skribilo-3c3f0cdecb1b037447bb4cb222ac5a34a8634a09.zip |
`diff' package: Use actual markups and writers.
* src/guile/skribilo/package/diff.scm: Use `output' and `writer'.
(deletion, insertion, replacement, unchanged): Return a specific markup
object. Add the corresponding writers for the `base' engine.
git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-68
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | src/guile/skribilo/package/diff.scm | 51 |
2 files changed, 64 insertions, 5 deletions
@@ -2,6 +2,24 @@ # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2 # +2007-03-28 08:44:53 GMT Ludovic Court`es <ludovic.courtes@laas.fr> patch-68 + + Summary: + `diff' package: Use actual markups and writers. + Revision: + skribilo--devo--1.2--patch-68 + + * src/guile/skribilo/package/diff.scm: Use `output' and `writer'. + (deletion, insertion, replacement, unchanged): Return a specific markup + object. Add the corresponding writers for the `base' engine. + + modified files: + ChangeLog src/guile/skribilo/package/diff.scm + + new patches: + lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-27 + + 2007-03-16 17:11:30 GMT Ludovic Court`es <ludovic.courtes@laas.fr> patch-67 Summary: diff --git a/src/guile/skribilo/package/diff.scm b/src/guile/skribilo/package/diff.scm index 116a6bd..15fdcf2 100644 --- a/src/guile/skribilo/package/diff.scm +++ b/src/guile/skribilo/package/diff.scm @@ -26,8 +26,10 @@ :use-module (skribilo ast) :use-module (skribilo lib) + :use-module (skribilo engine) + :use-module (skribilo writer) + :autoload (skribilo output) (output) :autoload (skribilo reader) (*document-reader*) - :autoload (skribilo engine) (*current-engine*) :autoload (skribilo module) (make-run-time-module) :autoload (skribilo resolve) (resolve!) :autoload (skribilo evaluator) (evaluate-ast-from-port) @@ -58,16 +60,28 @@ ;;; (define-markup (deletion :rest args) - (color :fg "red" (symbol "middot"))) + (new markup + (markup 'diff:deletion) + (ident (gensym "diff:deletion")) + (body args))) (define-markup (insertion :rest args) - (color :fg "green" args)) + (new markup + (markup 'diff:insertion) + (ident (gensym "diff:insertion")) + (body args))) (define-markup (replacement :rest args) - (color :fg "orange" args)) + (new markup + (markup 'diff:replacement) + (ident (gensym "diff:replacement")) + (body args))) (define-markup (unchanged :rest args) - args) + (new markup + (markup 'diff:unchanged) + (ident (gensym "diff:unchanged")) + (body args))) ;;; @@ -323,6 +337,33 @@ (resolve! ast2 engine env) (make-diff-document ast1 ast2))) + + +;;; +;;; Default writers. +;;; + +(markup-writer 'diff:deletion (find-engine 'base) + :action (lambda (n e) + ;;(color :fg "red" (symbol "middot")) + + ;; Output nothing by default so that the document remains + ;; readable. + #f)) + +(markup-writer 'diff:insertion (find-engine 'base) + :action (lambda (n e) + (output (color :fg "green" (markup-body n)) e))) + +(markup-writer 'diff:replacement (find-engine 'base) + :action (lambda (n e) + (output (color :fg "orange" (markup-body n)) e))) + +(markup-writer 'diff:unchanged (find-engine 'base) + :action (lambda (n e) + (output (markup-body n) e))) + + ;;; diff.scm ends here ;;; arch-tag: 69ad10fa-5688-4835-8956-439e44e26847 |