spontaneous 0.2.0.alpha2 → 0.2.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -40
- data/Rakefile +29 -41
- data/Readme.markdown +21 -8
- data/application/css/add_alias_dialogue.css.scss +79 -0
- data/application/css/{v2.scss → core.css.scss} +537 -550
- data/application/css/{definitions.scss → definitions.css.scss} +121 -33
- data/application/css/dialogue.css.scss +409 -0
- data/application/css/{editing.scss → editing.css.scss} +25 -262
- data/application/css/font.css.scss +8 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_222222_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_228ef1_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ef8c08_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffd27a_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffffff_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/ui-lightness.css.scss +565 -0
- data/application/css/{login.scss → login.css.scss} +4 -4
- data/application/css/meta.css.scss +331 -0
- data/application/css/{popover.scss → popover.css.scss} +9 -8
- data/application/css/{schema_error.scss → schema_error.css.scss} +4 -4
- data/application/css/spontaneous.css +5 -0
- data/application/css/unsupported.css.scss +42 -0
- data/application/js/add_alias_dialogue.js +72 -10
- data/application/js/ajax.js +50 -16
- data/application/js/compatibility.js +19 -15
- data/application/js/content.js +39 -36
- data/application/js/content_area.js +53 -5
- data/application/js/dialogue.js +17 -0
- data/application/js/dom.js +1 -1
- data/application/js/edit_panel.js +23 -8
- data/application/js/extensions.js +7 -2
- data/application/js/field_preview.js +2 -1
- data/application/js/field_types/date_field.js +11 -8
- data/application/js/field_types/file_field.js +188 -9
- data/application/js/field_types/image_field.js +46 -29
- data/application/js/field_types/markdown_field.js +57 -14
- data/application/js/field_types/select_field.js +72 -0
- data/application/js/field_types/string_field.js +8 -0
- data/application/js/field_types/webvideo_field.js +8 -0
- data/application/js/init.js +1 -7
- data/application/js/location.js +41 -13
- data/application/js/login.js +3 -0
- data/application/js/meta_view/user_admin.js +543 -0
- data/application/js/meta_view.js +1 -0
- data/application/js/metadata.js +20 -0
- data/application/js/page.js +17 -3
- data/application/js/page_browser.js +40 -30
- data/application/js/page_entry.js +4 -0
- data/application/js/panel/root_menu.js +66 -0
- data/application/js/popover.js +2 -2
- data/application/js/preview.js +1 -1
- data/application/js/publish.js +138 -30
- data/application/js/services.js +43 -0
- data/application/js/sharded_upload.js +2 -2
- data/application/js/spontaneous.js +64 -5
- data/application/js/state.js +20 -9
- data/application/js/top_bar.js +273 -150
- data/application/js/types.js +20 -15
- data/application/js/upload.js +1 -2
- data/application/js/user.js +18 -4
- data/application/js/vendor/date.js +104 -0
- data/application/js/vendor/jquery-ui-1.8.18.custom.min.js +356 -0
- data/application/js/views/box_view.js +15 -8
- data/application/js/views/page_piece_view.js +11 -8
- data/application/js/views/page_view.js +21 -3
- data/application/js/views/piece_view.js +19 -10
- data/application/js/views.js +3 -0
- data/application/static/chromelogo-200x52-45c7cbc93be080bea342df5fcda2ef8b.png +0 -0
- data/application/static/dot-texture-9eea29e4ac7ad9a772285252078ec127.png +0 -0
- data/application/static/editing-textarea-resize-s-b5af62365eb7e19ea4beccf7242d508e.png +0 -0
- data/application/static/editing-texture-1-42b06a3439752490988f30f2a06d5e7c.png +0 -0
- data/application/static/font/fontawesome-webfont-5c5c21100a346972a82c34c5e96ffcfe.ttf +0 -0
- data/application/static/loop_alt1-white-7894b458528e92216196cae26b4c2c96.svg +12 -0
- data/application/static/spontaneous-states-e91ec89db525c62da0105b97cdd781ce.png +0 -0
- data/application/views/index.erb +2 -2
- data/application/views/login.erb +4 -8
- data/application/views/schema_modification_error.html.erb +1 -4
- data/application/views/unsupported.erb +9 -7
- data/bin/spot +1 -1
- data/db/migrations/20110209152710_users_and_groups.rb +10 -10
- data/db/migrations/20120305112647_site_modification_time.rb +11 -0
- data/db/migrations/20120418153903_add_ownership_of_content.rb +14 -0
- data/db/migrations/20120423175416_add_pending_modifications.rb +21 -0
- data/db/migrations/20120525164947_add_field_versions.rb +27 -0
- data/lib/sequel/plugins/scoped_table_name.rb +10 -1
- data/lib/spontaneous/asset/file.rb +25 -0
- data/lib/spontaneous/asset/source.rb +28 -0
- data/lib/spontaneous/asset.rb +75 -0
- data/lib/spontaneous/box.rb +6 -4
- data/lib/spontaneous/capistrano/deploy.rb +47 -0
- data/lib/spontaneous/capistrano/sync.rb +81 -0
- data/lib/spontaneous/capistrano.rb +13 -0
- data/lib/spontaneous/change.rb +60 -68
- data/lib/spontaneous/cli/assets.rb +29 -0
- data/lib/spontaneous/cli/base.rb +0 -48
- data/lib/spontaneous/cli/console.rb +1 -1
- data/lib/spontaneous/cli/server.rb +6 -4
- data/lib/spontaneous/cli/site.rb +28 -17
- data/lib/spontaneous/cli/user.rb +107 -0
- data/lib/spontaneous/cli.rb +100 -4
- data/lib/spontaneous/collections/entry_set.rb +2 -2
- data/lib/spontaneous/collections/field_set.rb +48 -22
- data/lib/spontaneous/collections/prototype_set.rb +20 -13
- data/lib/spontaneous/constants.rb +3 -0
- data/lib/spontaneous/content.rb +22 -5
- data/lib/spontaneous/errors.rb +3 -3
- data/lib/spontaneous/extensions/array.rb +12 -0
- data/lib/spontaneous/extensions/enumerable.rb +30 -0
- data/lib/spontaneous/extensions/nil.rb +3 -1
- data/lib/spontaneous/extensions/string.rb +16 -0
- data/lib/spontaneous/field_types/date_field.rb +45 -2
- data/lib/spontaneous/field_types/field.rb +42 -9
- data/lib/spontaneous/field_types/file_field.rb +68 -0
- data/lib/spontaneous/field_types/image_field.rb +63 -0
- data/lib/spontaneous/field_types/select_field.rb +109 -0
- data/lib/spontaneous/field_types/string_field.rb +6 -1
- data/lib/spontaneous/field_types/webvideo_field.rb +85 -27
- data/lib/spontaneous/field_types.rb +1 -1
- data/lib/spontaneous/field_version.rb +8 -0
- data/lib/spontaneous/generators/page.rb +1 -1
- data/lib/spontaneous/generators/site/Capfile.tt +1 -4
- data/lib/spontaneous/generators/site/Gemfile.tt +13 -6
- data/lib/spontaneous/generators/site/config/deploy.rb.tt +28 -0
- data/lib/spontaneous/generators/site/config/environments/production.rb.tt +7 -2
- data/lib/spontaneous/generators/site.rb +1 -0
- data/lib/spontaneous/json.rb +34 -11
- data/lib/spontaneous/layout.rb +22 -0
- data/lib/spontaneous/media/file.rb +4 -0
- data/lib/spontaneous/output/assets/compression.rb +58 -0
- data/lib/spontaneous/output/assets.rb +32 -0
- data/lib/spontaneous/output/context.rb +179 -0
- data/lib/spontaneous/output/format/html.rb +5 -0
- data/lib/spontaneous/output/format/plain.rb +5 -0
- data/lib/spontaneous/output/format.rb +180 -0
- data/lib/spontaneous/output/helpers/classes_helper.rb +18 -0
- data/lib/spontaneous/{render/helpers/html_helper.rb → output/helpers/conditional_comment_helper.rb} +3 -12
- data/lib/spontaneous/output/helpers/script_helper.rb +73 -0
- data/lib/spontaneous/output/helpers/stylesheet_helper.rb +61 -0
- data/lib/spontaneous/output/helpers.rb +28 -0
- data/lib/spontaneous/output/template/engine.rb +59 -0
- data/lib/spontaneous/output/template/renderer.rb +153 -0
- data/lib/spontaneous/output/template.rb +21 -0
- data/lib/spontaneous/output.rb +163 -0
- data/lib/spontaneous/page.rb +2 -1
- data/lib/spontaneous/paths.rb +6 -1
- data/lib/spontaneous/permissions/access_key.rb +5 -5
- data/lib/spontaneous/permissions/user.rb +81 -35
- data/lib/spontaneous/permissions/user_level.rb +26 -22
- data/lib/spontaneous/plugins/aliases.rb +76 -12
- data/lib/spontaneous/plugins/allowed_types.rb +60 -18
- data/lib/spontaneous/plugins/application/paths.rb +0 -28
- data/lib/spontaneous/plugins/application/system.rb +35 -0
- data/lib/spontaneous/plugins/boxes.rb +4 -0
- data/lib/spontaneous/plugins/content_groups.rb +16 -0
- data/lib/spontaneous/plugins/entries.rb +50 -30
- data/lib/spontaneous/plugins/fields.rb +15 -0
- data/lib/spontaneous/plugins/layouts.rb +8 -2
- data/lib/spontaneous/plugins/modifications.rb +228 -0
- data/lib/spontaneous/plugins/page/formats.rb +67 -42
- data/lib/spontaneous/plugins/page/request.rb +10 -0
- data/lib/spontaneous/plugins/page/site_timestamps.rb +28 -0
- data/lib/spontaneous/plugins/paths.rb +15 -3
- data/lib/spontaneous/plugins/publishing.rb +124 -45
- data/lib/spontaneous/plugins/render.rb +13 -8
- data/lib/spontaneous/plugins/schema_hierarchy.rb +18 -6
- data/lib/spontaneous/plugins/site/helpers.rb +53 -0
- data/lib/spontaneous/plugins/site/hooks.rb +50 -0
- data/lib/spontaneous/plugins/site/map.rb +1 -1
- data/lib/spontaneous/plugins/site/paths.rb +13 -0
- data/lib/spontaneous/plugins/site/publishing.rb +6 -2
- data/lib/spontaneous/plugins/site/{revisions.rb → state.rb} +5 -1
- data/lib/spontaneous/plugins/site/storage.rb +4 -0
- data/lib/spontaneous/plugins/site/url.rb +15 -0
- data/lib/spontaneous/plugins/site_map.rb +13 -3
- data/lib/spontaneous/plugins/styles.rb +5 -1
- data/lib/spontaneous/plugins/visibility.rb +39 -12
- data/lib/spontaneous/prototypes/box_prototype.rb +4 -0
- data/lib/spontaneous/prototypes/field_prototype.rb +15 -10
- data/lib/spontaneous/publishing/event_client.rb +46 -0
- data/lib/spontaneous/publishing/immediate.rb +81 -44
- data/lib/spontaneous/publishing/simultaneous.rb +23 -6
- data/lib/spontaneous/publishing.rb +4 -3
- data/lib/spontaneous/rack/around_back.rb +1 -5
- data/lib/spontaneous/rack/around_front.rb +4 -4
- data/lib/spontaneous/rack/around_preview.rb +4 -3
- data/lib/spontaneous/rack/assets.rb +81 -54
- data/lib/spontaneous/rack/authentication.rb +0 -1
- data/lib/spontaneous/rack/back.rb +160 -72
- data/lib/spontaneous/rack/cookie_authentication.rb +2 -2
- data/lib/spontaneous/rack/css.rb +18 -15
- data/lib/spontaneous/rack/event_source.rb +9 -21
- data/lib/spontaneous/rack/fiber_pool.rb +26 -0
- data/lib/spontaneous/rack/front.rb +12 -4
- data/lib/spontaneous/rack/helpers.rb +35 -13
- data/lib/spontaneous/rack/js.rb +41 -0
- data/lib/spontaneous/rack/public.rb +34 -44
- data/lib/spontaneous/rack/sse.rb +18 -0
- data/lib/spontaneous/rack/static.rb +3 -0
- data/lib/spontaneous/rack/user_admin.rb +100 -0
- data/lib/spontaneous/rack/user_helpers.rb +1 -1
- data/lib/spontaneous/rack.rb +6 -2
- data/lib/spontaneous/schema.rb +31 -4
- data/lib/spontaneous/search/index.rb +19 -3
- data/lib/spontaneous/search/results.rb +1 -1
- data/lib/spontaneous/sequel.rb +17 -0
- data/lib/spontaneous/site.rb +11 -4
- data/lib/spontaneous/state.rb +11 -0
- data/lib/spontaneous/storage/cloud.rb +4 -0
- data/lib/spontaneous/storage/local.rb +11 -0
- data/lib/spontaneous/style.rb +2 -2
- data/lib/spontaneous/tasks/database.rake +21 -22
- data/lib/spontaneous/utils/database/mysql_dumper.rb +4 -0
- data/lib/spontaneous/utils/database/postgres_dumper.rb +78 -0
- data/lib/spontaneous/utils/database.rb +6 -3
- data/lib/spontaneous/utils/smart_quotes.rb +499 -0
- data/lib/spontaneous/utils/smush_it.rb +66 -0
- data/lib/spontaneous/utils.rb +3 -1
- data/lib/spontaneous/version.rb +2 -2
- data/lib/spontaneous.rb +25 -29
- data/spontaneous.gemspec +186 -106
- data/test/experimental/test_features.rb +1 -1
- data/test/fixtures/asset_pipeline/application/css/basic.css.scss +4 -0
- data/test/fixtures/asset_pipeline/application/css/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/css/spontaneous.css +7 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/library.css.scss +1 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/js/basic.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/login.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/require.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/spontaneous.js +5 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/library.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/vendor/jquery.js +1 -0
- data/test/fixtures/asset_pipeline/application/static/dot-texture.png +0 -0
- data/test/fixtures/asset_pipeline/application/static/subdir/px.gif +0 -0
- data/test/fixtures/assets/public1/css/a.scss +1 -0
- data/test/fixtures/assets/public1/js/a.js +1 -0
- data/test/fixtures/assets/public1/js/m.coffee +1 -0
- data/test/fixtures/assets/public2/css/b.scss +1 -0
- data/test/fixtures/assets/public2/css/c.css +1 -0
- data/test/fixtures/assets/public2/js/b.js +1 -0
- data/test/fixtures/assets/public2/js/c.js +1 -0
- data/test/fixtures/assets/public2/js/n.coffee +1 -0
- data/test/fixtures/back/config/user_levels.yml +3 -0
- data/test/fixtures/back/public/js/coffeescript.coffee +1 -0
- data/test/fixtures/back/templates/layouts/standard.css.cut +1 -0
- data/test/fixtures/back/templates/layouts/standard.js.cut +1 -0
- data/test/fixtures/example_application/config/database.yml +4 -4
- data/test/fixtures/helpers/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/helpers/templates/layouts/standard.mobile.cut +1 -0
- data/test/fixtures/images/vimlogo.pdf +0 -0
- data/test/fixtures/outputs/templates/layouts/standard.atom.cut +1 -0
- data/test/fixtures/permissions/config/user_levels.yml +6 -3
- data/test/fixtures/serialisation/class_hash.yaml.erb +1 -0
- data/test/fixtures/serialisation/root_hash.yaml.erb +2 -2
- data/test/fixtures/templates/extended/grandparent.html.cut +7 -7
- data/test/fixtures/templates/extended/main.html.cut +5 -5
- data/test/fixtures/templates/extended/parent.html.cut +8 -8
- data/test/fixtures/templates/extended/partial_with_locals.html.cut +1 -1
- data/test/fixtures/templates/extended/with_includes.html.cut +6 -6
- data/test/fixtures/templates/extended/with_includes_and_locals.html.cut +6 -7
- data/test/fixtures/templates/layouts/entries.html.cut +4 -4
- data/test/fixtures/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/templates/layouts/variables.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.rtf.cut +1 -0
- data/test/fixtures/templates/template_class/complex_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/complex_template.pdf.cut +2 -2
- data/test/fixtures/templates/template_class/default_template_style.html.cut +1 -1
- data/test/fixtures/templates/template_class/images_with_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.pdf.cut +2 -2
- data/test/fixtures/user_manager/config/user_levels.yml +9 -0
- data/test/functional/test_application.rb +7 -7
- data/test/functional/test_back.rb +352 -97
- data/test/functional/test_front.rb +71 -20
- data/test/functional/test_user_manager.rb +284 -0
- data/test/javascript/env.js +13505 -0
- data/test/javascript/test_markdown.rb +43 -3
- data/test/support/custom_matchers.rb +3 -2
- data/test/test_helper.rb +50 -9
- data/test/test_javascript.rb +13 -13
- data/test/ui_helper.rb +1 -1
- data/test/unit/test_alias.rb +79 -8
- data/test/unit/test_asset_bundler.rb +220 -0
- data/test/unit/test_assets.rb +213 -0
- data/test/unit/test_async.rb +55 -0
- data/test/unit/test_authentication.rb +52 -39
- data/test/unit/test_boxes.rb +20 -15
- data/test/unit/test_changesets.rb +261 -0
- data/test/unit/test_content.rb +73 -33
- data/test/unit/test_content_inheritance.rb +18 -18
- data/test/unit/test_extensions.rb +26 -0
- data/test/unit/test_fields.rb +303 -16
- data/test/unit/test_formats.rb +267 -34
- data/test/unit/test_helpers.rb +79 -2
- data/test/unit/test_images.rb +10 -0
- data/test/unit/test_layouts.rb +21 -13
- data/test/unit/test_modifications.rb +648 -0
- data/test/unit/test_page.rb +6 -2
- data/test/unit/test_permissions.rb +101 -27
- data/test/unit/test_piece.rb +4 -4
- data/test/unit/test_plugins.rb +3 -2
- data/test/unit/test_publishing.rb +332 -0
- data/test/unit/test_render.rb +118 -67
- data/test/unit/test_revisions.rb +546 -0
- data/test/unit/test_schema.rb +83 -1
- data/test/unit/test_search.rb +59 -0
- data/test/unit/test_serialisation.rb +2 -47
- data/test/unit/test_site.rb +217 -108
- data/test/unit/test_storage.rb +26 -0
- data/test/unit/test_structure.rb +2 -2
- data/test/unit/test_styles.rb +90 -75
- data/test/unit/test_table_scoping.rb +21 -17
- data/test/unit/test_templates.rb +75 -69
- data/test/{slow → unit}/test_visibility.rb +78 -22
- metadata +528 -221
- data/application/css/add_alias_dialogue.scss +0 -27
- data/application/css/min/14c2a35812c443001b15d8b12a4780f88c678035.css +0 -1
- data/application/css/min/565d4c25e82148acb01c45c8d675b37a08676d77.css +0 -1
- data/application/css/min/84dbe894ea96eafd321c30823d630817bfc4b03b.css +0 -1
- data/application/css/spontaneous.scss +0 -111
- data/application/css/unsupported.scss +0 -16
- data/application/css/variables.scss +0 -80
- data/application/js/min/2a0c2962537a3181fedfff5c92596ba6d3122dc9.js +0 -3
- data/application/js/min/4cf1c493d3379ecba5287758c61238034c0893f9.js +0 -2
- data/application/js/min/78ac6b99d96750bb6b9f9aad4cb9cd91cd03f391.js +0 -3
- data/application/js/min/b8abf302a824c35385ff517b34111e1710ff3b37.js +0 -2
- data/application/js/min/c8efb9b9f7c3f6613fcebc6be60f605b6570a382.js +0 -90
- data/application/static/diagonal-texture.png +0 -0
- data/application/static/editing-0-noise.png +0 -0
- data/application/static/editing-1-noise.png +0 -0
- data/application/static/editing-texture-1.png +0 -0
- data/application/static/editing-texture.png +0 -0
- data/application/static/editing-toolbar-shadow-bottom.png +0 -0
- data/application/static/editing-toolbar-shadow-top.png +0 -0
- data/application/static/inner-glow.png +0 -0
- data/application/static/item-buttons-highlight.png +0 -0
- data/application/static/item-buttons.png +0 -0
- data/application/static/paper-texture-dark.png +0 -0
- data/application/static/plus_alt.svg +0 -8
- data/application/static/select-arrow-root.png +0 -0
- data/application/static/slot-up-arrow.png +0 -0
- data/application/static/spontaneous.png +0 -0
- data/lib/cutaneous/context_helper.rb +0 -187
- data/lib/cutaneous/preview_context.rb +0 -32
- data/lib/cutaneous/preview_renderer.rb +0 -10
- data/lib/cutaneous/publish_context.rb +0 -10
- data/lib/cutaneous/publish_renderer.rb +0 -14
- data/lib/cutaneous/publish_template.rb +0 -62
- data/lib/cutaneous/publish_token_parser.rb +0 -8
- data/lib/cutaneous/renderer.rb +0 -124
- data/lib/cutaneous/request_context.rb +0 -9
- data/lib/cutaneous/request_renderer.rb +0 -15
- data/lib/cutaneous/request_template.rb +0 -11
- data/lib/cutaneous/request_token_parser.rb +0 -9
- data/lib/cutaneous/token_parser.rb +0 -125
- data/lib/cutaneous.rb +0 -48
- data/lib/spontaneous/render/context_base.rb +0 -143
- data/lib/spontaneous/render/development_renderer.rb +0 -14
- data/lib/spontaneous/render/engine.rb +0 -19
- data/lib/spontaneous/render/format/html.rb +0 -5
- data/lib/spontaneous/render/format.rb +0 -75
- data/lib/spontaneous/render/helpers/script_helper.rb +0 -17
- data/lib/spontaneous/render/helpers/stylesheet_helper.rb +0 -16
- data/lib/spontaneous/render/helpers.rb +0 -14
- data/lib/spontaneous/render/preview_context.rb +0 -8
- data/lib/spontaneous/render/preview_renderer.rb +0 -24
- data/lib/spontaneous/render/publish_context.rb +0 -22
- data/lib/spontaneous/render/published_renderer.rb +0 -53
- data/lib/spontaneous/render/publishing_renderer.rb +0 -16
- data/lib/spontaneous/render/render_cache.rb +0 -26
- data/lib/spontaneous/render/renderer.rb +0 -50
- data/lib/spontaneous/render/request_context.rb +0 -8
- data/lib/spontaneous/render.rb +0 -214
- data/test/experimental/test_cutaneous.rb +0 -309
- data/test/fixtures/application/css/test.less +0 -5
- data/test/slow/test_publishing.rb +0 -1006
- /data/application/css/{developer.scss → developer.css.scss} +0 -0
- /data/application/js/vendor/{jquery-1.7.1.min.js → jquery.js} +0 -0
- /data/application/static/{location-arrow.png → location-arrow-c1c1d3ca472481c61a0a5f8cb289d743.png} +0 -0
- /data/application/static/{missing.png → missing-911ce6dbd9f4602e0f3fbcd7e78846a2.png} +0 -0
- /data/application/static/{orange-down-arrow.png → orange-down-arrow-395ae1929e8662b2ff0977daf12c35bb.png} +0 -0
- /data/application/static/{page-browser-next.png → page-browser-next-ce781a242c23b980b99b9db7abc20b05.png} +0 -0
- /data/application/static/{plus-box.png → plus-box-dcde74a1e496f68298c9b443caa1c5d5.png} +0 -0
- /data/application/static/{select-arrow.png → select-arrow-6e7dd3745b00e934b0d7a3250c46558b.png} +0 -0
- /data/application/static/{slot-down-arrow.png → slot-down-arrow-59ad5f5ee5b52a7ebd00bca4b3104194.png} +0 -0
- /data/application/static/{splash.png → splash-65b493a714df9b8b3ab170103401b53d.png} +0 -0
- /data/application/static/{spot.png → spot-71fab1d2f065034f5fc15e7bea2ad36c.png} +0 -0
- /data/application/static/{spot.svg → spot-8505041082d8d3bbe8d34c29dddb3b7d.svg} +0 -0
- /data/application/static/{texture.png → texture-03f7627e8264b1d607113ab32c593a58.png} +0 -0
data/lib/spontaneous/render.rb
DELETED
@@ -1,214 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
|
4
|
-
module Spontaneous
|
5
|
-
module Render
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def output_path(revision, page, format, extension = nil, template_dynamic = false)
|
9
|
-
output_path_with_root(revision_root(revision), revision, page, format, extension, template_dynamic)
|
10
|
-
end
|
11
|
-
|
12
|
-
def output_path_with_root(root, revision, page, format, extension = nil, template_dynamic = false)
|
13
|
-
ext = ".#{format}"
|
14
|
-
ext += ".#{extension}" if extension && template_dynamic
|
15
|
-
segment = template_dynamic ? "dynamic" : (page.dynamic? ? "protected" : "static")
|
16
|
-
dir = root / segment / page.path
|
17
|
-
path = dir / "/index#{ext}"
|
18
|
-
path
|
19
|
-
end
|
20
|
-
|
21
|
-
def redirect_path(revision, page, format)
|
22
|
-
output_path_with_root(Spontaneous.revision_dir(revision, "/"), revision, page, format)
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
def revision_root(revision)
|
27
|
-
Spontaneous.revision_dir(revision)
|
28
|
-
end
|
29
|
-
|
30
|
-
def cache_templates?
|
31
|
-
@cache_templates ||= Spontaneous.production?
|
32
|
-
end
|
33
|
-
|
34
|
-
def cache_templates=(value)
|
35
|
-
@cache_templates = value
|
36
|
-
end
|
37
|
-
|
38
|
-
def render_pages(revision, pages, format, progress=nil)
|
39
|
-
klass = Format.const_get("#{format.to_s.camelize}")
|
40
|
-
renderer = klass.new(revision, pages, progress)
|
41
|
-
renderer.render
|
42
|
-
end
|
43
|
-
|
44
|
-
def render_page(revision, page, format, progress=nil)
|
45
|
-
render_pages(revision, [page], format, progress)
|
46
|
-
end
|
47
|
-
|
48
|
-
def renderer_class
|
49
|
-
@renderer_class ||= PublishingRenderer
|
50
|
-
end
|
51
|
-
|
52
|
-
def renderer_class=(klass)
|
53
|
-
@renderer_class = klass
|
54
|
-
@renderer = nil
|
55
|
-
end
|
56
|
-
|
57
|
-
def renderer
|
58
|
-
@renderer ||= renderer_class.new(template_root)
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
def with_preview_renderer(&block)
|
63
|
-
with_renderer(PreviewRenderer, &block)
|
64
|
-
end
|
65
|
-
|
66
|
-
def with_publishing_renderer(&block)
|
67
|
-
with_render_cache {
|
68
|
-
with_renderer(PublishingRenderer, &block)
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
def with_published_renderer(&block)
|
73
|
-
with_renderer(PublishedRenderer, &block)
|
74
|
-
end
|
75
|
-
|
76
|
-
def use_development_renderer
|
77
|
-
self.renderer_class = DevelopmentRenderer
|
78
|
-
end
|
79
|
-
|
80
|
-
def use_preview_renderer
|
81
|
-
self.renderer_class = PreviewRenderer
|
82
|
-
end
|
83
|
-
|
84
|
-
def use_publishing_renderer
|
85
|
-
self.renderer_class = PublishingRenderer
|
86
|
-
end
|
87
|
-
|
88
|
-
def use_published_renderer
|
89
|
-
self.renderer_class = PublishedRenderer
|
90
|
-
end
|
91
|
-
|
92
|
-
@@renderer_stack = []
|
93
|
-
|
94
|
-
def with_renderer(new_renderer, &block)
|
95
|
-
@@renderer_stack.push(self.renderer_class)
|
96
|
-
self.renderer_class = new_renderer
|
97
|
-
yield if block_given?
|
98
|
-
ensure
|
99
|
-
self.renderer_class = @@renderer_stack.pop
|
100
|
-
end
|
101
|
-
|
102
|
-
|
103
|
-
def with_render_cache
|
104
|
-
Thread.current[:_render_cache] = {}
|
105
|
-
yield if block_given?
|
106
|
-
ensure
|
107
|
-
Thread.current[:_render_cache] = nil
|
108
|
-
end
|
109
|
-
|
110
|
-
def render_cache
|
111
|
-
Thread.current[:_render_cache]
|
112
|
-
end
|
113
|
-
|
114
|
-
def render_cache_active?
|
115
|
-
!render_cache.nil?
|
116
|
-
end
|
117
|
-
|
118
|
-
def render_cache_key?(key)
|
119
|
-
return false unless render_cache_active?
|
120
|
-
render_cache.key?(key)
|
121
|
-
end
|
122
|
-
|
123
|
-
def render_cache_value(key)
|
124
|
-
return nil unless render_cache_active?
|
125
|
-
render_cache[key]
|
126
|
-
end
|
127
|
-
|
128
|
-
def render_cache_set_value(key, value)
|
129
|
-
return value unless render_cache_active?
|
130
|
-
render_cache[key] = value
|
131
|
-
end
|
132
|
-
|
133
|
-
def template_root
|
134
|
-
@template_root ||= Spontaneous.root / "templates"
|
135
|
-
end
|
136
|
-
|
137
|
-
def template_path(*path)
|
138
|
-
::File.join(template_root, *path)
|
139
|
-
end
|
140
|
-
|
141
|
-
# def template_root=(root)
|
142
|
-
# @template_root = root
|
143
|
-
# @renderer = nil
|
144
|
-
# end
|
145
|
-
|
146
|
-
def extension
|
147
|
-
Spontaneous.template_ext
|
148
|
-
end
|
149
|
-
|
150
|
-
def exists?(root, template, format)
|
151
|
-
File.exists?(template_file(root, template, format))
|
152
|
-
end
|
153
|
-
|
154
|
-
def template_file(root, filename, format)
|
155
|
-
::File.join(root, template_name(filename, format))
|
156
|
-
end
|
157
|
-
|
158
|
-
def template_file_with_root(template_root, filename, format)
|
159
|
-
::File.join(template_root, template_name(filename, format))
|
160
|
-
end
|
161
|
-
|
162
|
-
# converts relative paths into absolute template paths
|
163
|
-
# e.g. layouts/standard -> /example_com/templates/layouts/standard.html.cut
|
164
|
-
# searches through all available template roots
|
165
|
-
def find_template(filename, format)
|
166
|
-
template_name = template_name(filename, format)
|
167
|
-
return template_name if File.file?(template_name)
|
168
|
-
Spontaneous.template_paths.each do |root|
|
169
|
-
path = root / template_name
|
170
|
-
return path if File.file?(path)
|
171
|
-
end
|
172
|
-
nil
|
173
|
-
end
|
174
|
-
|
175
|
-
def template_name(filename, format)
|
176
|
-
"#{filename}.#{format}.#{Spontaneous.template_ext}"
|
177
|
-
end
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
def formats(style)
|
182
|
-
glob = "#{template_path(style.path)}.*.#{extension}"
|
183
|
-
Dir[glob].map do |file|
|
184
|
-
file.split('.')[-2].to_sym
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
def render(content, format=:html, params={}, *args)
|
189
|
-
Content.with_visible do
|
190
|
-
renderer.render_content(content, format || :html, params, *args)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
def render_string(template_string, content, format=:html, params={}, *args)
|
194
|
-
Content.with_visible do
|
195
|
-
renderer.render_string(template_string, content, format || :html, params, *args)
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
autoload :Engine, "spontaneous/render/engine"
|
201
|
-
autoload :ContextBase, "spontaneous/render/context_base"
|
202
|
-
autoload :PreviewContext, "spontaneous/render/preview_context"
|
203
|
-
autoload :PublishContext, "spontaneous/render/publish_context"
|
204
|
-
autoload :RequestContext, "spontaneous/render/request_context"
|
205
|
-
autoload :RenderCache, "spontaneous/render/render_cache"
|
206
|
-
autoload :Renderer, "spontaneous/render/renderer"
|
207
|
-
autoload :PreviewRenderer, "spontaneous/render/preview_renderer"
|
208
|
-
autoload :PublishingRenderer, "spontaneous/render/publishing_renderer"
|
209
|
-
autoload :PublishedRenderer, "spontaneous/render/published_renderer"
|
210
|
-
autoload :DevelopmentRenderer, "spontaneous/render/development_renderer"
|
211
|
-
autoload :Format, "spontaneous/render/format"
|
212
|
-
autoload :Helpers, "spontaneous/render/helpers"
|
213
|
-
end
|
214
|
-
end
|
@@ -1,309 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require File.expand_path('../../test_helper', __FILE__)
|
4
|
-
|
5
|
-
|
6
|
-
class CutaneousTest < MiniTest::Spec
|
7
|
-
PUBLISH_TEMPLATE = (<<-TEMPLATE)
|
8
|
-
Text here {{ preview_tag }}
|
9
|
-
|
10
|
-
|
11
|
-
!{ comment which should be ignored }
|
12
|
-
Text `problem`
|
13
|
-
${ "<div>" }
|
14
|
-
$${ "<div>" }
|
15
|
-
%{
|
16
|
-
a = {:key => title}
|
17
|
-
b = a.map { |k, v| "\#{k}=\#{v}" }
|
18
|
-
}
|
19
|
-
Text \\problem
|
20
|
-
${ b }
|
21
|
-
Text
|
22
|
-
TEMPLATE
|
23
|
-
|
24
|
-
VIEW_TEMPLATE = (<<-TEMPLATE)
|
25
|
-
<title>{{ title }}</title>
|
26
|
-
|
27
|
-
!{ comment }
|
28
|
-
Welome
|
29
|
-
|
30
|
-
{% 2.times do |n| %}
|
31
|
-
{{ names[n] }}
|
32
|
-
{% end %}
|
33
|
-
|
34
|
-
TEMPLATE
|
35
|
-
|
36
|
-
context "publishing parser" do
|
37
|
-
setup do
|
38
|
-
@parser = Cutaneous::PublishTokenParser.new(PUBLISH_TEMPLATE)
|
39
|
-
end
|
40
|
-
|
41
|
-
should "tokenize a single statement" do
|
42
|
-
lexer = Cutaneous::PublishTokenParser.new("%{ a = {:a => \"a\" }}")
|
43
|
-
tokens = lexer.tokens
|
44
|
-
tokens.length.should == 1
|
45
|
-
tokens.first.should == [:statement, 'a = {:a => "a" }']
|
46
|
-
end
|
47
|
-
|
48
|
-
should "tokenize a single expression" do
|
49
|
-
lexer = Cutaneous::PublishTokenParser.new("${ a }")
|
50
|
-
tokens = lexer.tokens
|
51
|
-
tokens.length.should == 1
|
52
|
-
tokens.first.should == [:expression, 'a']
|
53
|
-
end
|
54
|
-
|
55
|
-
should "tokenize plain text" do
|
56
|
-
lexer = Cutaneous::PublishTokenParser.new("Hello there")
|
57
|
-
tokens = lexer.tokens
|
58
|
-
tokens.length.should == 1
|
59
|
-
tokens.first.should == [:text, 'Hello there']
|
60
|
-
end
|
61
|
-
|
62
|
-
should "tokenize a single comment" do
|
63
|
-
lexer = Cutaneous::PublishTokenParser.new("!{ comment }")
|
64
|
-
tokens = lexer.tokens
|
65
|
-
tokens.length.should == 1
|
66
|
-
tokens.first.should == [:comment, ' comment ']
|
67
|
-
end
|
68
|
-
|
69
|
-
should "correctly tokenize tags within a comment" do
|
70
|
-
lexer = Cutaneous::PublishTokenParser.new("!{ %{ a = true } ${ value } !{ nested comment }}")
|
71
|
-
tokens = lexer.tokens
|
72
|
-
tokens.length.should == 1
|
73
|
-
tokens.first.should == [:comment, ' %{ a = true } ${ value } !{ nested comment }']
|
74
|
-
end
|
75
|
-
should "correctly tokenize a complex template string" do
|
76
|
-
@parser.tokens.map { |token| token[0] }.should == [
|
77
|
-
:text,
|
78
|
-
:comment,
|
79
|
-
:text,
|
80
|
-
:expression,
|
81
|
-
:text,
|
82
|
-
:escaped_expression,
|
83
|
-
:text,
|
84
|
-
:statement,
|
85
|
-
:text,
|
86
|
-
:expression,
|
87
|
-
:text
|
88
|
-
]
|
89
|
-
end
|
90
|
-
|
91
|
-
should "correctly post process the expressions" do
|
92
|
-
expressions = @parser.tokens
|
93
|
-
expected = [
|
94
|
-
[:text, "Text here {{ preview_tag }}\n\n\n"],
|
95
|
-
[:comment, " comment which should be ignored "],
|
96
|
-
[:text, "Text \\`problem\\`\n"],
|
97
|
-
[:expression, %("<div>")],
|
98
|
-
[:text, "\n"],
|
99
|
-
[:escaped_expression, %("<div>")],
|
100
|
-
[:text, "\n"],
|
101
|
-
[:statement, "a = {:key => title}\n b = a.map { |k, v| \"\#{k}=\#{v}\" }"],
|
102
|
-
[:text, "Text \\\\problem\n "],
|
103
|
-
[:expression, "b"],
|
104
|
-
[:text, "\nText\n"]
|
105
|
-
]
|
106
|
-
expressions.each_with_index do |s, i|
|
107
|
-
s.should == expected[i]
|
108
|
-
end
|
109
|
-
expressions.should == expected
|
110
|
-
end
|
111
|
-
|
112
|
-
should "correctly generate the template script" do
|
113
|
-
expected = [
|
114
|
-
%(_buf << %Q`Text here {{ preview_tag }}\n\n\n`),
|
115
|
-
%(_buf << %Q`Text \\`problem\\`\n`),
|
116
|
-
%(_buf << _decode_params(("<div>"))),
|
117
|
-
%(_buf << %Q`\n`),
|
118
|
-
%(_buf << escape(_decode_params(("<div>")))),
|
119
|
-
%(_buf << %Q`\n`),
|
120
|
-
"a = {:key => title}\n b = a.map { |k, v| \"\#{k}=\#{v}\" }",
|
121
|
-
%(_buf << %Q`Text \\\\problem\n `),
|
122
|
-
"_buf << _decode_params((b))",
|
123
|
-
%(_buf << %Q`\nText\n`),
|
124
|
-
].join("\n") + "\n"
|
125
|
-
script = @parser.script
|
126
|
-
script.should == expected
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
context "view parser" do
|
131
|
-
setup do
|
132
|
-
end
|
133
|
-
should "tokenize a single statement" do
|
134
|
-
parser = Cutaneous::RequestTokenParser.new("{% a = {:a => \"a\" } %}")
|
135
|
-
tokens = parser.tokens
|
136
|
-
tokens.length.should == 1
|
137
|
-
tokens.first[0].should == :statement
|
138
|
-
tokens.first[1].should == 'a = {:a => "a" }'
|
139
|
-
end
|
140
|
-
|
141
|
-
should "tokenize a single expression" do
|
142
|
-
parser = Cutaneous::RequestTokenParser.new("{{ a }}")
|
143
|
-
tokens = parser.tokens
|
144
|
-
tokens.length.should == 1
|
145
|
-
tokens.first[0].should == :expression
|
146
|
-
tokens.first[1].should == 'a'
|
147
|
-
end
|
148
|
-
|
149
|
-
should "tokenize a single escaped expression" do
|
150
|
-
parser = Cutaneous::RequestTokenParser.new("{$ a $}")
|
151
|
-
tokens = parser.tokens
|
152
|
-
tokens.length.should == 1
|
153
|
-
tokens.first[0].should == :escaped_expression
|
154
|
-
tokens.first[1].should == 'a'
|
155
|
-
end
|
156
|
-
|
157
|
-
should "tokenize plain text" do
|
158
|
-
parser = Cutaneous::RequestTokenParser.new("Hello there")
|
159
|
-
tokens = parser.tokens
|
160
|
-
tokens.length.should == 1
|
161
|
-
tokens.first[0].should == :text
|
162
|
-
tokens.first[1].should == 'Hello there'
|
163
|
-
end
|
164
|
-
|
165
|
-
should "tokenize a single comment" do
|
166
|
-
parser = Cutaneous::RequestTokenParser.new("!{ comment }")
|
167
|
-
tokens = parser.tokens
|
168
|
-
tokens.length.should == 1
|
169
|
-
tokens.first[0].should == :comment
|
170
|
-
tokens.first[1].should == ' comment '
|
171
|
-
end
|
172
|
-
|
173
|
-
should "tokenize a mixed template" do
|
174
|
-
parser = Cutaneous::RequestTokenParser.new("{% a = [1,2].map { |x| x } %}!{ comment }{{ a }}")
|
175
|
-
tokens = parser.tokens
|
176
|
-
tokens.length.should == 3
|
177
|
-
tokens[0][0].should == :statement
|
178
|
-
tokens[1][0].should == :comment
|
179
|
-
tokens[2][0].should == :expression
|
180
|
-
tokens[0][1].should == 'a = [1,2].map { |x| x }'
|
181
|
-
tokens[1][1].should == ' comment '
|
182
|
-
tokens[2][1].should == 'a'
|
183
|
-
end
|
184
|
-
should "tokenize a mixed publish & view template" do
|
185
|
-
parser = Cutaneous::RequestTokenParser.new(PUBLISH_TEMPLATE)
|
186
|
-
tokens = parser.tokens
|
187
|
-
tokens.length.should == 5
|
188
|
-
tokens.map { |t| t[0] }.should == [
|
189
|
-
:text,
|
190
|
-
:expression,
|
191
|
-
:text,
|
192
|
-
:comment,
|
193
|
-
:text
|
194
|
-
]
|
195
|
-
tokens[1][1].should == 'preview_tag'
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
|
200
|
-
context "publish templates" do
|
201
|
-
context "from files" do
|
202
|
-
setup do
|
203
|
-
@tmp = Dir.mktmpdir
|
204
|
-
@template_path = File.join(@tmp, "template.html.cut")
|
205
|
-
File.open(@template_path, "w") do |file|
|
206
|
-
file.write(PUBLISH_TEMPLATE)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
teardown do
|
210
|
-
FileUtils.rm_r(@tmp)
|
211
|
-
end
|
212
|
-
|
213
|
-
should "just be empty if created empty" do
|
214
|
-
template = Cutaneous::PublishTemplate.new
|
215
|
-
template.filename.should be_nil
|
216
|
-
template.script.should be_nil
|
217
|
-
end
|
218
|
-
|
219
|
-
should "convert a string" do
|
220
|
-
template = Cutaneous::PublishTemplate.new
|
221
|
-
template.convert("!{ comment }${ title }", "/path/to/template.html.cut")
|
222
|
-
template.filename.should == "/path/to/template.html.cut"
|
223
|
-
context = Cutaneous::PublishContext.new(nil, :html, {:title => "title"})
|
224
|
-
template.render(context).should == "title"
|
225
|
-
end
|
226
|
-
|
227
|
-
should "parse the file if created with one" do
|
228
|
-
template = Cutaneous::PublishTemplate.new(@template_path)
|
229
|
-
template.filename.should == @template_path
|
230
|
-
template.script.should =~ /^\s*_buf/
|
231
|
-
context = Cutaneous::PublishContext.new(nil, :html, {:title => "title"})
|
232
|
-
# puts template.render(context)
|
233
|
-
template.render(context).should == (<<-HTML)
|
234
|
-
Text here {{ preview_tag }}
|
235
|
-
|
236
|
-
|
237
|
-
Text `problem`
|
238
|
-
<div>
|
239
|
-
<div>
|
240
|
-
Text \\problem
|
241
|
-
key=title
|
242
|
-
Text
|
243
|
-
HTML
|
244
|
-
end
|
245
|
-
|
246
|
-
should "reset if given a different string" do
|
247
|
-
template = Cutaneous::PublishTemplate.new
|
248
|
-
template.convert("${ title }")
|
249
|
-
context = Cutaneous::PublishContext.new(nil, :html, {:title => "title"})
|
250
|
-
template.render(context).should == "title"
|
251
|
-
template.convert("${ title }!")
|
252
|
-
template.render(context).should == "title!"
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
context "view templates" do
|
257
|
-
context "from files" do
|
258
|
-
setup do
|
259
|
-
@tmp = Dir.mktmpdir
|
260
|
-
@template_path = File.join(@tmp, "template.html.cut")
|
261
|
-
File.open(@template_path, "w") do |file|
|
262
|
-
file.write(VIEW_TEMPLATE)
|
263
|
-
end
|
264
|
-
end
|
265
|
-
teardown do
|
266
|
-
FileUtils.rm_r(@tmp)
|
267
|
-
end
|
268
|
-
|
269
|
-
should "just be empty if created empty" do
|
270
|
-
template = Cutaneous::RequestTemplate.new
|
271
|
-
template.filename.should be_nil
|
272
|
-
template.script.should be_nil
|
273
|
-
end
|
274
|
-
|
275
|
-
should "convert a string" do
|
276
|
-
template = Cutaneous::RequestTemplate.new
|
277
|
-
template.convert("!{ comment }{{ title }}", "/path/to/template.html.cut")
|
278
|
-
template.filename.should == "/path/to/template.html.cut"
|
279
|
-
context = Cutaneous::RequestContext.new(nil, :html, {:title => "title"})
|
280
|
-
template.render(context).should == "title"
|
281
|
-
end
|
282
|
-
|
283
|
-
should "parse the file if created with one" do
|
284
|
-
template = Cutaneous::RequestTemplate.new(@template_path)
|
285
|
-
template.filename.should == @template_path
|
286
|
-
template.script.should =~ /^\s*_buf/
|
287
|
-
context = Cutaneous::RequestContext.new(nil, :html, {:title => "title", :names => ["george", "mary"]})
|
288
|
-
# puts template.render(context)
|
289
|
-
template.render(context).should == (<<-HTML)
|
290
|
-
<title>title</title>
|
291
|
-
|
292
|
-
Welome
|
293
|
-
|
294
|
-
george
|
295
|
-
mary
|
296
|
-
HTML
|
297
|
-
end
|
298
|
-
|
299
|
-
should "reset if given a different string" do
|
300
|
-
template = Cutaneous::RequestTemplate.new
|
301
|
-
template.convert("{{ title }}")
|
302
|
-
context = Cutaneous::RequestContext.new(nil, :html, {:title => "title"})
|
303
|
-
template.render(context).should == "title"
|
304
|
-
template.convert("{{ title }}!")
|
305
|
-
template.render(context).should == "title!"
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|