Skip to content

Commit

Permalink
slight update of docs to reflect rejiggered new site model
Browse files Browse the repository at this point in the history
  • Loading branch information
mattneub committed Aug 9, 2010
1 parent c0d95f3 commit 5eb2493
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
def firstFilter(adrPageTable)
# support for haml-based template
if adrPageTable[:haml] and (t = adrPageTable.fetch2(:template)) and t.kind_of?(Pathname)
adrPageTable[:directTemplate] = Haml::Engine.new(File.read(t), :attr_wrapper => '"').render
end
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
def pageFilter(adrPageTable)
# adrPageTable[:bodytext] = process(adrPageTable[:bodytext])
# support for haml-based template
if adrPageTable[:haml] and (t = adrPageTable.fetch2(:template)) and t.kind_of?(Pathname)
adrPageTable[:directTemplate] = Haml::Engine.new(File.read(t), :attr_wrapper => '"').render
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ Apple: http://www.apple.com
ERB: http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
Frontier: http://frontier.userland.com
Ruby: http://www.ruby-lang.org/en/
TextMate: http://macromates.com/
TextMate: http://macromates.com/
kramdown: http://kramdown.rubyforge.org/
less: http://lesscss.org/
haml: http://haml-lang.com/
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ Personally, I think RubyFrontier is pretty simple, but that's because I've been

1. **Configure #ftpSite.yaml.** Okay, you're now in the source folder's TextMate project. Immediately, look at `#ftpSite.yaml`. Change the `:folder` entry to be the path to a folder on your hard disk where you want the Web site created when you generate pages.

1. **Test.** Immediately render the `default.txt` [page object](types) that comes in your new RubyFrontier source folder (select the page, and choose RubyFrontier > Publish Page). The rendered Web page should appear in your browser. Make sure it's being saved where you expect it.
1. **Test.** Immediately render the `firstpage.txt` [page object](types) that comes in your new RubyFrontier source folder: select the page, and choose RubyFrontier > Publish Page. The rendered Web page should appear in your browser. Make sure it's being saved where you expect it. Even better, select this page and choose RubyFrontier > Publish Site. Examine the default site to see how some of its features are implemented; these are features you may want to imitate.

1. **Make some page objects.** Create some `.txt` files at the same level as the existing `default.txt`. You can delete `default.txt` now if you wish.
1. **Make some page objects.** Create some `.txt` files at the same level as the existing `firstpage.txt`. You can delete `firstpage.txt` and the other existing pages now if you wish. Or, keep them around until you've understood the features they demonstrate.

1. **Make titles.** Immediately, give every `.txt` page object that you just created a first line `#title` [directive](scalardirectives). Ideally, every page object should have a unique filename and a unique `#title`, though this is not required. So, for example, the first line of this page object is:

#title "How to Create a Web Site with RubyFrontier"

1. **Pick an HTML strategy.** Stop and decide how you want to code HTML for your pages. Are you going to hand-code HTML? That's fine; you can take advantage of TextMate's HTML editing to help you. Or would you prefer to write text and let the text be turned into HTML for you by [Markdown](http://daringfireball.net/projects/markdown/)? That's fine too; TextMate includes Markdown (and [SmartyPants](http://daringfireball.net/projects/smartypants/)), and the default [pageFilter and finalFilter](filters) (scripts in the `#filters` folder) are set up to let you use them. Or perhaps you have some other transformative engine you want to use to generate HTML? Fine, but then it's going to be up to you to create a mechanism for implementing this. If you're using Markdown, you will need either to say `#markdown true` at the top of every page object or (if you want to use it in most pages) to add this line to `#prefs.yaml`:
1. **Pick an HTML strategy.** Stop and decide how you want to code HTML for your pages. Are you going to hand-code HTML? That's fine; you can take advantage of TextMate's HTML editing to help you. Or would you prefer to write text and let the text be turned into HTML for you by [Markdown](http://daringfireball.net/projects/markdown/)? That's fine too; TextMate includes Markdown (and [SmartyPants](http://daringfireball.net/projects/smartypants/)), and the default [pageFilter and finalFilter](filters) (scripts in the `#filters` folder) are set up to let you use them. Or perhaps you'd like to use [kramdown](kramdown) (I recommend this instead of Markdown, now that it has matured)? Or possibly you want to hand-code your HTML, but abbreviate it by using [Haml](haml)? The existing pages in the default site are all set up for you to do any of these, and show you how to get started. (Or perhaps you have some other transformative engine you want to use to generate HTML? Fine, but then it's going to be up to you to create a mechanism for implementing this.)

:markdown: true
1. **Write.** Create some content in each of the pages.

1. **Write.** Create some content in each of the pages.

1. **Make links.** Pages can refer to each other via [links](autoglossary) using their simple filenames or titles. For example, suppose a page object file is called `otherpage.txt`. Then, in pure HTML you can say `<a`&nbsp;`href="otherpage">this kind of thing</a>`; in Markdown you can also say `[this kind of thing](otherpage)`.
1. **Make links.** Pages can refer to each other via [links](autoglossary) using their simple filenames or titles. For example, suppose a page object file is called `otherpage.txt`. Then, in pure HTML you can say `<a`&nbsp;`href="otherpage">this kind of thing</a>`; in Markdown or kramdown you can also say `[this kind of thing](otherpage)`.

1. **Keep testing.** As you work, keep saying RubyFrontier > Publish Page to check that things are going okay. If a link to another page fails, it might be because you've never published it (a page doesn't go into the [autoglossary](autoglossary) until it is published). Totally ignore the look of the page! You'll fix the CSS and the template in later steps. Oh, one more thing: To regenerate *every* page of the site, choose RubyFrontier > Publish Site.

Expand All @@ -38,7 +36,7 @@ Personally, I think RubyFrontier is pretty simple, but that's because I've been

(The value, "normal", must match the name of the stylesheet file.)

1. **Template.** Editing the [template](template) is trickier. It will really help if you have some idea what you want the template to do. You can directly edit the existing `#template.txt` file if you wish. It is already quite powerful to begin with. The `<bodytext>` pseudo-tag is where each page's content is inserted into the template. The preceding and following `pageheader()` and `pagefooter()` calls are generating HTML and bringing a lot of other RubyFrontier features into play, so initially you should keep them too. Anything you write, therefore, needs to be after the `pageheader()` call and before the `pagefooter()` call. You might, for example, wrap the `<bodytext>` pseudo-tag in some kind of table or div structure.
1. **Template.** Editing the [template](template) is trickier. It will really help if you have some idea what you want the template to do. You can directly edit the existing `#template.txt` file if you wish. It is already quite powerful to begin with. The `<p id="bodytext">` tag is where each page's content is inserted into the template. The preceding and following `pageheader()` and `pagefooter()` calls are generating HTML and bringing a lot of other RubyFrontier features into play, so initially you should keep them too. Anything you write, therefore, needs to be after the `pageheader()` call and before the `pagefooter()` call. You might, for example, wrap the `<p id="bodytext">` pseudo-tag in some kind of table or div structure. The template also demonstrates an extremely simple automatic mechanism for generating a link to the next and previous pages at the same level (by means of a macro).

1. **Macros.** Sooner or later you're going to want to write a [macro](macros). In the template or page object, where you want the macro to be evaluated, put:

Expand All @@ -50,7 +48,7 @@ Personally, I think RubyFrontier is pretty simple, but that's because I've been
"Hello, world!"
end

Render the page (RubyFrontier > Publish Page). As you can see, the result of the macro script call, the string "Hello, world!", is substituted for the macro in your template or page object. Now you can proceed to substitute your own functionality in that script.
Render the page (RubyFrontier > Publish Page). As you can see, the result of the macro script call, the string "Hello, world!", is substituted for the macro in your template or page object. Now you can proceed to substitute your own functionality in that script. Examine the existing macro in the site, `nextprevlinks.rb`, and start tracking down how it works; this might ultimately form the basis of some of your own automatic navigation functionality.

At this point your feet are very wet and you're on your own! You have enough structure to start seriously experimenting. Go back and read all that [documentation](start) that you skipped. It should mean a lot more to you now. Also, the source folder for this documentation is included in RubyFrontier's source, so you can study it to see how it works (it's pretty simple).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Just after [macro processing](macros), if there is a [`#filters` folder](directi

This is your chance to modify the page table's `:postmacrotext` entry, which contains the [rendered page object](howsapage), poured into its [template](template) and with [macros](macros) already processed, but with [glossary expansion](autoglossary) not yet performed.

This filter, which did not exist in the original Frontier, is implemented because this turns out to be a good moment for certain transformations. For example, if you're going to use something like [kramdown](http://kramdown.rubyforge.org/), instead of [Markdown](http://daringfireball.net/projects/markdown/) and [SmartyPants](http://daringfireball.net/projects/smartypants/), this is a good moment for it; kramdown transformation needs to occur before glossary expansion (for the same reasons as Markdown), but it behaves badly with unprocessed macros. (Indeed, if Markdown were capable of operating inside `<div>` tags, such as might be wrapped around the page content by the template, I'd run Markdown, and probably SmartyPants, at this point instead of the PageFilter).
This filter, which did not exist in the original Frontier, is implemented because this turns out to be a good moment for certain transformations. For example, if you're going to use something like [kramdown](http://kramdown.rubyforge.org/), instead of [Markdown](http://daringfireball.net/projects/markdown/) and [SmartyPants](http://daringfireball.net/projects/smartypants/), this is a good moment for it; kramdown transformation needs to occur before glossary expansion (for the same reasons as Markdown), but it behaves badly with unprocessed macros. (Indeed, if Markdown were capable of operating inside `<div>` tags, such as might be wrapped around the page content by the template, I'd run Markdown, and probably SmartyPants, at this point instead of the PageFilter.)

### The FinalFilter

Expand Down

0 comments on commit 5eb2493

Please sign in to comment.