unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Stephen Compall" <s11@member.fsf.org>
Subject: Re: string parsing/preparation for latex
Date: Tue, 8 Nov 2005 10:56:08 -0600	[thread overview]
Message-ID: <UEMAILH4gIH9BHUzZ9D0009de89@uemail.evansville.edu> (raw)
In-Reply-To: <20051108155212.1f7f04c7@faust>

David Pirotte writes: 
> but that is not possible, because the string (here simulated) 
> is a user typed in string  (through a gtk interface 
> programmed in guile-gnome) upon which I have no control. 
> I precisly wish to parse it to create a .tex file later 
> processed by latex ...

If you expect users to type in strings as Scheme expressions, I would
think you'd have no problem expecting them to know that backslashes have
to be escaped.

In other words, I think you're confusing reading strings, in the sense
of the `read' function for Scheme expressions, and reading raw character
data *into* strings, which is the usual practice when grabbing GUI form
fields, unless of course the form field is supposed to contain a Scheme
expression.

guile> (use-modules (ice-9 rdelim))
guile> (texu/prep-str-for-tex (read-line))
;; % \ { } ~ $ & # ^ _
=> ";; \\% \\\\ \\{ \\} \\~ \\$ \\& \\# \\^ \\_"
guile> (begin (display (texu/prep-str-for-tex (read-line))) (newline))
;; % \ { } ~ $ & # ^ _
-| ;; \% \\ \{ \} \~ \$ \& \# \^ \_

Where guile> is a prompt, => means a return value, -| means printed
line, all else is typed.

--
Stephen Compall
http://scompall.nocandysoftware.com/blog



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


  parent reply	other threads:[~2005-11-08 16:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-07 13:53 string parsing/preparation for latex David Pirotte
2005-11-07 15:49 ` Jose Roberto B. de A. Monteiro
2005-11-08 14:52   ` David Pirotte
2005-11-08 16:35     ` Jose Roberto B. de A. Monteiro
2005-11-08 16:56     ` Stephen Compall [this message]
2005-11-08  0:34 ` Jon Wilson
2005-11-08 14:26   ` David Pirotte
2005-11-08 20:42     ` Jon Wilson
2005-11-08 21:08       ` klaus schilling
2005-11-09 13:24         ` Jon Wilson
2005-11-14  3:17           ` Stephen Compall
2005-11-15  1:50             ` Jon Wilson
2005-11-16  2:52               ` Stephen Compall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=UEMAILH4gIH9BHUzZ9D0009de89@uemail.evansville.edu \
    --to=s11@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).