From b7faf399c1420567b017cdc7f900009ded175151 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 27 Feb 2014 17:16:29 +0100 Subject: [PATCH] Fix newline preservation in @example with lines beginning with @ * module/texinfo.scm (read-char-data): Preserve newlines in @example and similar environments in the case when the next line starts with an @. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test. --- module/texinfo.scm | 6 ++++-- test-suite/tests/texinfo.test | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/module/texinfo.scm b/module/texinfo.scm index 91bb46d8d..02fec16a1 100644 --- a/module/texinfo.scm +++ b/module/texinfo.scm @@ -1,6 +1,6 @@ ;;;; (texinfo) -- parsing of texinfo into SXML ;;;; -;;;; Copyright (C) 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +;;;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. ;;;; Copyright (C) 2004, 2009 Andy Wingo ;;;; Copyright (C) 2001,2002 Oleg Kiselyov ;;;; @@ -765,7 +765,9 @@ Examples: (let* ((token (read-command-token port)) (end? (eq? (token-kind token) 'END))) (values - (handle str-handler fragment (if end? "" " ") seed) + (handle str-handler fragment + (if end? "" (if preserve-ws? "\n" " ")) + seed) token))) ((and (not preserve-ws?) (eq? c #\newline)) ;; paragraph-separator ::= #\newline #\newline+ diff --git a/test-suite/tests/texinfo.test b/test-suite/tests/texinfo.test index 2cb4a7187..9c6722f57 100644 --- a/test-suite/tests/texinfo.test +++ b/test-suite/tests/texinfo.test @@ -1,6 +1,6 @@ ;;;; texinfo.test -*- scheme -*- ;;;; -;;;; Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +;;;; Copyright (C) 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. ;;;; Copyright (C) 2001,2002 Oleg Kiselyov ;;;; ;;;; This library is free software; you can redistribute it and/or @@ -232,6 +232,8 @@ (test-body "@example\n foo asdf asd sadf asd \n@end example\n" '((example " foo asdf asd sadf asd "))) + (test-body "@example\n@{\n@}\n@end example\n" + '((example "{\n}"))) (test-body (join-lines "@quotation" "@example"