Hi Max,

That looks exactly like what I need, thanks!  You've given me a very
clear explanation of what I didn't get.

Thanks!
mmr

On Jan 23, 1:04 pm, Max <[email protected]> wrote:
> I added some basic haml stuff and uploaded a sample upload
> application.  Same blog link as before, near the bottom.
>
> Only question I don't think has been answered so far is the button
> part -- but unless it's simply submitting a form, you'll have to be
> more specific than "stuff" ;)
>
> On Jan 23, 12:26 pm, Max <[email protected]> wrote:
>
>
>
> > Hah, I guess I didn't read the full original post!  My bad.
>
> > On Jan 23, 12:09 pm, Max <[email protected]> wrote:
>
> > > Hi mmr,
>
> > >http://blog.maxaller.name/2010/01/a-brief-introduction-to-ruby-sinatr...
> > > is what I just cooked up.  Took longer than I expected ;) It's fairly
> > > sparse, and I don't feel like it offers a whole lot that's not 
> > > onhttp://www.sinatrarb.com/intro.htmlorhttp://www.sinatrarb.com/faq.html
> > > (sometimes even linking those pages).  Since you probably have more
> > > questions, I think I can come up with a more helpful post if you go
> > > ahead and email those to me.  Alternatively, you can ask here, too.
>
> > > Other resources:
> > > HTML and CSS reference:http://www.w3schools.com/
> > > Official HAML docs:http://haml-lang.com/docs.html
>
> > > One thing I learned from the tutorial I wrote -- don't use @ variables
> > > called @response in Sinatra!  heh.
>
> > > On Jan 23, 10:48 am, mmr <[email protected]> wrote:
>
> > > > @Rhett,
>
> > > > Thanks for the explanation for both my first and second points
> > > > (usually, I find that newsgroup discussions only address the first
> > > > point in any given list, for whatever reason).
>
> > > > I see your point viz assembly vs html.  I guess I'll have to grab a
> > > > book about it, or something.  I understand that there are tables and
> > > > formatting beyond h1 now.  Have they gotten rid of blinking text from
> > > > the standard?  Has whoever invented that monstrosity been handled like
> > > > the guy who invented Comic Sans? (http://www.achewood.com/index.php?
> > > > date=07052007, warning, nsfw language)
>
> > > > Kidding aside, I do realize that I won't be able to just copy and
> > > > paste some stuff off of web pages in order to get what I want, and
> > > > that I will have to start learning things.  I am definitely looking
> > > > forward to Max's tutorial, so that I can learn these things in a haml
> > > > context.
>
> > > > And thanks for the points about variable passing; I didn't understand
> > > > their documentation at all, so that's a big help to me.
>
> > > > Thanks!
> > > > mmr
>
> > > > On Jan 23, 10:30 am, Rhett Sutphin <[email protected]> wrote:
>
> > > > > Hi mmr,
>
> > > > > On Jan 23, 2010, at 11:35 AM, mmr wrote:
>
> > > > > > When I read between the lines in the haml tutorial, it's all about
> > > > > > unlearning bad habits obtained from using other frameworks, notably
> > > > > > erb.  So, I come to you with no habits.  Why send me off to learn 
> > > > > > some
> > > > > > bad ones before I can get the good ones?  (and should I have to 
> > > > > > learn
> > > > > > Assembly before I learn C++?)
>
> > > > > You shouldn't learn bad habits first, but it is impossible to do web 
> > > > > programming without understanding HTML and CSS.  Haml and Sass (and 
> > > > > Compass) make it cleaner and nicer to produce HTML and CSS, but 
> > > > > eventually the user/browser is going to get HTML and CSS.  Without an 
> > > > > understanding of how they work, you won't be able to fix any problems 
> > > > > you encounter.
>
> > > > > I'm aware that this sounds just like the sort of argument an assembly 
> > > > > die-hard might make in reference to C++.  There are at least two 
> > > > > flaws in that analogy:
>
> > > > > * In general, someone telling you to learn assembly is assuming that 
> > > > > you're writing software for one platform. HTML/CSS is like a machine 
> > > > > instruction set that is supported on different processors but 
> > > > > interpreted slightly differently by each.
>
> > > > > * C++ puts an abstraction (OO) on top of machine language.  Haml does 
> > > > > not do the same thing for HTML -- it provides a nicer syntax and 
> > > > > templating only.  This means that understanding HTML will help you 
> > > > > understand Haml in a way that understanding assembly does not help 
> > > > > you understand C++.  The CSS-Sass relationship is like HTML-Haml.
>
> > > > > All that said, it's true that Haml is mostly advertised as an 
> > > > > alternative to other things (because that's how it started).  Since 
> > > > > more frameworks have out-of-the-box support for it, more people are 
> > > > > going to encounter it as their first HTML templating language, so we 
> > > > > probably need documentation along those lines.
>
> > > > > > For instance, I have no idea what a 'partial' is, and the
> > > > > > documentations just states that making one is easy without telling 
> > > > > > me
> > > > > > what it is.
>
> > > > > > I'd really appreciate just a cookbook-style set of 'here's some 
> > > > > > really
> > > > > > simple haml, here's what you get'.
>
> > > > > > And, because I'm using Sinatra, double bonus points for using 
> > > > > > Sinatra
> > > > > > as the server.
>
> > > > > > One task that I have yet to solve is how to pass parameters to a 
> > > > > > haml
> > > > > > page.  For instance, suppose I've stored the username in a session,
> > > > > > and I want to display the username on the page.  I can either create
> > > > > > that page using Sinatra and write the text as part of a 'puts'
> > > > > > statement, but I'd hoped for a way to say to haml, 'replace this
> > > > > > variable string here with this particular string here'.  I can see 
> > > > > > no
> > > > > > way to do that, and I looked for several hours.  Can that task be
> > > > > > done?
>
> > > > > This is covered in the Sinatra documentation, though it is not as 
> > > > > clear as it might be.  (It's under the section "Accessing Variables 
> > > > > in Templates" inhttp://www.sinatrarb.com/intro.html.)  The key thing 
> > > > > is that instance variables you set in your sinatra handler are 
> > > > > available when your haml template is evaluated.  Their example uses 
> > > > > an inline template, but you can do it with a separate template, too.  
> > > > > Here's their example translated to use a separate template:
>
> > > > > # In the application
> > > > > get '/:id' do
> > > > >   @foo = Foo.find(params[:id])
> > > > >   haml :bar
> > > > > end
>
> > > > > # In views/bar.haml
> > > > > %h1= @foo.name
>
> > > > > Let's say you have a Foo with id=4 and name='Quux'.  When you 
> > > > > requesthttp://yourapp/4, the rendered HTML will be:
>
> > > > > <h1>Quux</h1>
>
> > > > > HTH,
> > > > > Rhett
>
> > > > > > Thanks!
>
> > > > > > On Jan 22, 6:49 pm, Michael Narciso <[email protected]> wrote:
> > > > > >> Take a look at this 
> > > > > >> script:http://github.com/narkeeso/haml-sass-file-watcher
>
> > > > > >> I've branched from the original author and added some very basic 
> > > > > >> features.
>
> > > > > >> This will look for changes and saves in files with the extension 
> > > > > >> .haml
> > > > > >> and .sass then convert them to .html and .css
>
> > > > > >> The nice thing about using something like a watcher is that you 
> > > > > >> can see
> > > > > >> where you made mistakes. haml and sass are pretty good about 
> > > > > >> telling
> > > > > >> what is wrong with your file or syntax. It's great for learning.
>
> > > > > >> I do think that you should refresh your HTML/CSS knowledge before 
> > > > > >> diving
> > > > > >> into something like haml or sass though.
>
> > > > > >> mmr wrote:
> > > > > >>> So I should have probably been more clear.
>
> > > > > >>> The last time I coded html was in 1996.  I do not remember it,
> > > > > >>> certainly not well enough to make forms or the like.
>
> > > > > >>> Given my total lack of knowledge, how would I go about doing those
> > > > > >>> pretty straightforward tasks in haml?  I've found tutorials for 
> > > > > >>> things
> > > > > >>> with %p and the like, but I'm needing something a bit more 
> > > > > >>> in-depth.
>
> > > > > >>> Thanks!
>
> > > > > >>> On Jan 22, 5:41 pm, Chris Eppstein<[email protected]>  wrote:
>
> > > > > >>>> Non-ruby folks will probably prefer the html-like attribute 
> > > > > >>>> syntax:
>
> > > > > >>>> %form(action="myaction" method="post")
>
> > > > > >>>> %input(type="text" name="foo" value="bar" maxlength="100")
>
> > > > > >>>> Chris
>
> > > > > >>>> On Fri, Jan 22, 2010 at 5:15 PM, Amy L<[email protected]>  
> > > > > >>>> wrote:
>
> > > > > >>>>> Hi mmr,
>
> > > > > >>>>> If you know HTML then picking up Haml is a no-brainer. Let's 
> > > > > >>>>> say you want a
> > > > > >>>>> form and you're not using the form helper, instead of writing:
>
> > > > > >>>>> <form action="..." method="post">
>
> > > > > >>>>> You write
>
> > > > > >>>>> %form{:action =>  '...', :method =>  'post'}
>
> > > > > >>>>> For the stuff you would put inside the<form>  tags just indent 
> > > > > >>>>> by 2 spaces
> > > > > >>>>> in Haml. That's pretty much it.
>
> > > > > >>>>> So you want a text field? Sure:
>
> > > > > >>>>> %input{:type =>  'text', :name =>  '...', :value =>  '...', 
> > > > > >>>>> :maxlength =>
> > > > > >>>>> '...'}
>
> > > > > >>>>> That's it.
>
> > > > > >>>>> On Fri, Jan 22, 2010 at 3:43 PM, mmr<[email protected]>  wrote:
>
> > > > > >>>>>> Hi all,
>
> > > > > >>>>>> I'm putting together a web system basically as described here:
>
> > > > > >>>>>>http://stackoverflow.com/questions/2112267/should-i-be-using-rails-or...
>
> > > > > >>>>>> I've decided to go with sinatra, mainly because I don't need 
> > > > > >>>>>> the db
> > > > > >>>>>> functionality of rails as that's already covered by a java 
> > > > > >>>>>> environment
> > > > > >>>>>> that I have definitely working and debugged.
>
> > > > > >>>>>> However, when I read the tutorials for haml and sass, they all
> > > > > >>>>>> reference erb and css.  I have no knowledge of erb or css, so 
> > > > > >>>>>> those
> > > > > >>>>>> tutorials are useless to me.
>
> > > > > >>>>>> I've found this tutorial on making a login page (my next task):
>
> > > > > >>>>>>http://visionmasterdesigns.com/tutorial-create-a-login-system-in-ruby...
>
> > > > > >>>>>> But that's in erb and it's specifically for rails on top of 
> > > > > >>>>>> mysql,
> > > > > >>>>>> which, again, I'm not doing.
>
> > > > > >>>>>> Is there an equivalent tutorial for a simple login page?  I'm 
> > > > > >>>>>> talking
> > > > > >>>>>> just "here's a box in which to put text, and here's how to 
> > > > > >>>>>> access that
> > > > > >>>>>> text in your ruby file", nothing particularly complicated.
>
> > > > > >>>>>> Overall, a very useful listing for me would be how to:
> > > > > >>>>>> 1) write normal text (as in,<br>This is my text!  Isn't it 
> > > > > >>>>>> awesome!
> > > > > >>>>>> <br>
> > > > > >>>>>> 2) write a link...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to