unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* My Project: Guile Hypertext Preprocessor
@ 2010-08-12  0:12 Luiji Maryo
  2010-08-12  2:57 ` Linas Vepstas
  2010-08-18 16:09 ` Andy Wingo
  0 siblings, 2 replies; 7+ messages in thread
From: Luiji Maryo @ 2010-08-12  0:12 UTC (permalink / raw)
  To: Guile Mailing List

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

Hello,

When looking through http://www.gnu.org/software/guile/ideas.html, I came
across this nifty little idea for a PHP-like hypertext preprocessor that
works with Guile (at least that's how I understood it), and I decided that
I'd implement it, since PHP is starting to get on my nerves (the XML handler
just kills me).

I was also thinking of extending it to a level in which programs and
languages can be run simultaneously:

<?program
   id="g"
  interpreter="/usr/bin/env guile"
?>
<?program
  id="p"
  interpreter="/usr/bin/env perl"
?>
<?g
  (define title "My Title")
  (define user "CoolDude1024")
?>
<html>
<head><title><?g (write title) ?></title></head>
<body>
<h1><?g (write title) ?></h1>
How are you doing today, <?g (write user) ?>?  <?p print "I've written this
in Perl!!!" ?>.
</body>
</html>

I was wondering if anybody had any suggestions on this concept before I get
too far through coding it.
-- 
- Luiji Maryo (a.k.a. Brain Boy)
Visit me at http://brainboyblogger.blogspot.com/.

[-- Attachment #2: Type: text/html, Size: 1817 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: My Project: Guile Hypertext Preprocessor
  2010-08-12  0:12 My Project: Guile Hypertext Preprocessor Luiji Maryo
@ 2010-08-12  2:57 ` Linas Vepstas
  2010-08-12 18:49   ` Luiji Maryo
  2010-08-18 16:09 ` Andy Wingo
  1 sibling, 1 reply; 7+ messages in thread
From: Linas Vepstas @ 2010-08-12  2:57 UTC (permalink / raw)
  To: Luiji Maryo; +Cc: Guile Mailing List

On 11 August 2010 19:12, Luiji Maryo <luiji@users.sourceforge.net> wrote:
> Hello,

> <?g
>   (define title "My Title")
>   (define user "CoolDude1024")
> ?>
> <html>
> <head><title><?g (write title) ?></title></head>
> <body>
> <h1><?g (write title) ?></h1>
> How are you doing today, <?g (write user) ?>

> I was wondering if anybody had any suggestions on this concept before I get
> too far through coding it.

For what its worth, there is an implentation of something like
this inside of gtt, the gnome time tracker.  It uses html so that
users can write customized reports & layouts, while pulling
actual data from the inside of the time-tracker engine.

At one point, gnucash was supposed ot do something similar,
too, for its reports/graphs, but I am not sure what actually
happened there.

I really like the general idea, I think it was under-utilized by
most of the desktop-application apps.

--linas



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: My Project: Guile Hypertext Preprocessor
  2010-08-12  2:57 ` Linas Vepstas
@ 2010-08-12 18:49   ` Luiji Maryo
  2010-08-12 19:17     ` Thien-Thi Nguyen
  2010-08-12 19:44     ` dskr
  0 siblings, 2 replies; 7+ messages in thread
From: Luiji Maryo @ 2010-08-12 18:49 UTC (permalink / raw)
  To: Guile Mailing List

[-- Attachment #1: Type: text/plain, Size: 2543 bytes --]

Hm...I've just realized a few problems with how I've structured this.

For one thing, the Guile and Perl interpreters would not be able to evaluate
just one section of code at a time, because::
 - Guile would output "guile> " every line, which would appear in the
output.
 - Perl would require an EOF in order to run the program, which would also
end with the state being lost, which is unacceptable.

The second problem is that the script would not be able to do cool things
like allow editing HTTP headers like in PHP since the programs could not
properly communicate with MHP (Multi-lingual Hypertext Preprocessor as it is
currently named), thus giving PHP a major advantage.

I have come up with a resolution to both of these problems: languages are
not referenced by interpreter like [interpreter="/usr/bin/env guile"], it
would instead need a plugin-based system so that [language="Guile"] would be
translated by a plugin registered by "/usr/lib/mhp/interpreters/Guile.so".

How would this solve the problem?  Well you see, the interpreter would::
 - Be able to evaluate single lines while retaining state.
 - Be able to communicate with MHP to send messages like
"mhp_set_header('content-type', 'text/plain')".

This would add a lot more power to MHP, but would also require a plugin for
each available language.  I currently see no alternative, but anybody may
feel free to suggest one.

-- Luiji

On Wed, Aug 11, 2010 at 10:57 PM, Linas Vepstas <linasvepstas@gmail.com>wrote:

> On 11 August 2010 19:12, Luiji Maryo <luiji@users.sourceforge.net> wrote:
> > Hello,
>
> > <?g
> >   (define title "My Title")
> >   (define user "CoolDude1024")
> > ?>
> > <html>
> > <head><title><?g (write title) ?></title></head>
> > <body>
> > <h1><?g (write title) ?></h1>
> > How are you doing today, <?g (write user) ?>
>
> > I was wondering if anybody had any suggestions on this concept before I
> get
> > too far through coding it.
>
> For what its worth, there is an implentation of something like
> this inside of gtt, the gnome time tracker.  It uses html so that
> users can write customized reports & layouts, while pulling
> actual data from the inside of the time-tracker engine.
>
> At one point, gnucash was supposed ot do something similar,
> too, for its reports/graphs, but I am not sure what actually
> happened there.
>
> I really like the general idea, I think it was under-utilized by
> most of the desktop-application apps.
>
> --linas
>



-- 
- Luiji Maryo (a.k.a. Brain Boy)
Visit me at http://brainboyblogger.blogspot.com/.

[-- Attachment #2: Type: text/html, Size: 3376 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: My Project: Guile Hypertext Preprocessor
  2010-08-12 18:49   ` Luiji Maryo
@ 2010-08-12 19:17     ` Thien-Thi Nguyen
  2010-08-12 19:44     ` dskr
  1 sibling, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2010-08-12 19:17 UTC (permalink / raw)
  To: Guile Mailing List

() Luiji Maryo <luiji@users.sourceforge.net>
() Thu, 12 Aug 2010 14:49:17 -0400

    - Guile would output "guile> " every line, which would
   appear in the output.

  [workaround]

  I currently see no alternative, but anybody may feel
  free to suggest one.

Another idea is to instruct the interpreter not to output this prompt
at all, or (even better) to structure the REPL dialogue in a manner
most convenient for the controlling (parent) process.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: My Project: Guile Hypertext Preprocessor
  2010-08-12 18:49   ` Luiji Maryo
  2010-08-12 19:17     ` Thien-Thi Nguyen
@ 2010-08-12 19:44     ` dskr
  2010-08-12 20:42       ` Mike Gran
  1 sibling, 1 reply; 7+ messages in thread
From: dskr @ 2010-08-12 19:44 UTC (permalink / raw)
  To: Luiji Maryo; +Cc: Guile Mailing List


Guile is not its REPL. Look at '-s', '-e'. With that resolved, I wonder whether there are still useful HTML pages where the static template is large compared to the language fragment. PHP is a product of its time.

Cheers,
  Dan

On Aug 12, 2010, at 2:49 PM, Luiji Maryo <luiji@users.sourceforge.net> wrote:

> Hm...I've just realized a few problems with how I've structured this.
> 
> For one thing, the Guile and Perl interpreters would not be able to evaluate just one section of code at a time, because::
>  - Guile would output "guile> " every line, which would appear in the ...



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: My Project: Guile Hypertext Preprocessor
  2010-08-12 19:44     ` dskr
@ 2010-08-12 20:42       ` Mike Gran
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Gran @ 2010-08-12 20:42 UTC (permalink / raw)
  To: dskr@mac.com, Luiji Maryo; +Cc: Guile Mailing List

> From: "dskr@mac.com" <dskr@mac.com>
> 
> Guile is not its REPL. Look at '-s', '-e'. With that resolved, 
> I wonder whether there are still useful HTML pages where the
> static template is large compared to the language fragment.
>PHP is a product of its time.

I agree with Dan that the large template with small amounts
of code is not the way that the web is going now.  It really
is about dynamically building webpages from the ground up.

One strategy would be to use run Guile scripts as CGI scripts,
or FastCGI or ModLisp.  There are Guile CGI, FastCGI and ModLisp
parsing routines in Guile-WWW, if I recall correctly.

(http://savannah.nongnu.org/projects/guile-www)

For the actual web-page construction, you might consider 
constructing the webpages as Scheme lists in SXML and then
dynamically converting them to HTML and CSS.  There is some SXML
support in Guile 1.9.x.

Consider this paper: http://sjamaan.ath.cx/docs/scheme/sxslt.pdf 


-Mike



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: My Project: Guile Hypertext Preprocessor
  2010-08-12  0:12 My Project: Guile Hypertext Preprocessor Luiji Maryo
  2010-08-12  2:57 ` Linas Vepstas
@ 2010-08-18 16:09 ` Andy Wingo
  1 sibling, 0 replies; 7+ messages in thread
From: Andy Wingo @ 2010-08-18 16:09 UTC (permalink / raw)
  To: Luiji Maryo; +Cc: Guile Mailing List

Hi,

On Wed 11 Aug 2010 17:12, Luiji Maryo <luiji@users.sourceforge.net> writes:

> When looking through http://www.gnu.org/software/guile/ideas.html, I
> came across this nifty little idea for a PHP-like hypertext
> preprocessor that works with Guile.

I was recently pointed to http://woozle.org/~neale/src/eguile/. What do
you think about it?

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-18 16:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12  0:12 My Project: Guile Hypertext Preprocessor Luiji Maryo
2010-08-12  2:57 ` Linas Vepstas
2010-08-12 18:49   ` Luiji Maryo
2010-08-12 19:17     ` Thien-Thi Nguyen
2010-08-12 19:44     ` dskr
2010-08-12 20:42       ` Mike Gran
2010-08-18 16:09 ` Andy Wingo

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).