Creating that green box in Freeway talk?

I want to post an example of code in a Freeway Talk post and place it in the green box I often see. How do I create the green box than contains it?

Thank you.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

There are a several ways to do this.

If you are posting a short snippet (and the key here is that the individual lines in the snippet are themselves short – maybe under 60 characters per line total) then you can simply indent each line of the snippet with four spaces or one tab character. (You cannot enter tab characters in the Web interface to this mailing list, but any e-mail application will let you type them, naturally, so it depends on how you personally interact with this list.) It is also important that there be two blank lines before and after the block of code, just as if you were making fake paragraphs in a mail message by typing return twice. Within the body of your code block, any additional spaces (after the first four), or any tabs after the first will be honored by the formatter. The following is an example of this:

Each of these lines
is preceded by four
    spaces, and the block
is terminated at either end by 
two return characters.

If your code is more complex, or contains longer lines of code that may be ambiguous to the formatter, then you can use the “fenced” code block format. In this case, you type the two returns at either end of the block as before, but then you put a single line containing four or more tildes (~~~~) in a row above and below the block of code. When using this format, it is not necessary to indent each line of code with spaces or tabs. The following is an example of this:

def migrate_xml
  Title.where("xml_filename <> ''").each do |title|
    unless title.xml?
      puts title.list_title
      path = "http://example.org/xml/#{title.xml_filename.gsub(' ', '%20')}.xml"
      begin
        title.sources << Source.create(:file_url => path, :title_id => title.id, :content_format => 'XML')
        title.save
      rescue
        puts 'skipping ' + path
      end
    end
  end
end
migrate_xml

Finally, if your code example is particularly complex, or if you would like to have an extra level of control over its publishing (say you want to remove it from public view after your question is answered) then this Web view of the mailing list supports GitHub Gist and Pastie as an embedded code block option. To use this technique, you visit either of those “paste-bin” sites and create your snippet there. (These services offer a huge library of color-coding options for your code, just as a programmer’s editor would give you on your Mac, and store your code in a safe manner where you may edit it and remove it from public view if that’s important to you.) Each of these services will give you a URL when they’ve accepted your code, and to embed that formatted code snippet in the FreewayTalk site, all you need to do is put that URL all by itself on a line in your message. The FreewayTalk site will convert the URL to an embedded block, and you will get all of the niceties of the parent paste site right in the middle of the page. The following is an example of that:

If you need to reference a Gist or Pastie within a message without getting the formatted layout, just put the link within a paragraph of text, like this: prototype-classname-functions.js · GitHub without leaving it alone in its own block.

Walter

On Feb 24, 2014, at 7:48 AM, qhrider wrote:

I want to post an example of code in a Freeway Talk post and place it in the green box I often see. How do I create the green box than contains it?

Thank you.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi. Thank you for all the information. I want to post a small snippet, so the first solution should work fine. I’ll do a test first. Again, many thanks!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’ll do a test first.

Reply to any post on the online forum and add your code - you can see what it will look like without Submitting it

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the tip…it works!!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options