liquid_feedback_frontend

changeset 133:fa55c8ded9fd

add wiki syntax help

add help display module
add links to the wiki editors that link to a help page of the selected wiki syntax.
author Daniel Poelzleithner <poelzi@poelzi.org>
date Tue Oct 05 16:18:39 2010 +0200 (2010-10-05)
parents 90d16ad8d6d2
children de6b80867eb7
files .hgignore app/main/draft/new.lua app/main/help/show.lua app/main/initiative/new.lua locale/help/wikisyntax.en.txt locale/help/wikisyntax_compat.en.txt locale/help/wikisyntax_rocketwiki.en.txt
line diff
     1.1 --- a/.hgignore	Tue Oct 05 14:30:29 2010 +0200
     1.2 +++ b/.hgignore	Tue Oct 05 16:18:39 2010 +0200
     1.3 @@ -1,2 +1,5 @@
     1.4  tmp
     1.5 -.+~
     1.6 \ No newline at end of file
     1.7 +.+~
     1.8 +
     1.9 +syntax: regexp
    1.10 +^locale/help/.*\.html
     2.1 --- a/app/main/draft/new.lua	Tue Oct 05 14:30:29 2010 +0200
     2.2 +++ b/app/main/draft/new.lua	Tue Oct 05 16:18:39 2010 +0200
     2.3 @@ -56,9 +56,39 @@
     2.4          { id = "rocketwiki", name = "RocketWiki" },
     2.5          { id = "compat", name = _"Traditional wiki syntax" }
     2.6        },
     2.7 +      attr = {id = "formatting_engine"},
     2.8        foreign_id = "id",
     2.9        foreign_name = "name"
    2.10      }
    2.11 +    ui.tag{
    2.12 +      tag = "div",
    2.13 +      content = function()
    2.14 +        ui.tag{
    2.15 +          tag = "label",
    2.16 +          attr = { class = "ui_field_label" },
    2.17 +          content = function() slot.put("&nbsp;") end,
    2.18 +        }
    2.19 +        ui.tag{
    2.20 +          content = function()
    2.21 +            ui.link{
    2.22 +              text = _"Syntax help",
    2.23 +              module = "help",
    2.24 +              view = "show",
    2.25 +              id = "wikisyntax",
    2.26 +              attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    2.27 +            }
    2.28 +            slot.put(" ")
    2.29 +            ui.link{
    2.30 +              text = _"(new window)",
    2.31 +              module = "help",
    2.32 +              view = "show",
    2.33 +              id = "wikisyntax",
    2.34 +              attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    2.35 +            }
    2.36 +          end
    2.37 +        }
    2.38 +      end
    2.39 +    }
    2.40      ui.field.text{
    2.41        label = _"Content",
    2.42        name = "content",
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/app/main/help/show.lua	Tue Oct 05 16:18:39 2010 +0200
     3.3 @@ -0,0 +1,39 @@
     3.4 +local id = param.get_id(atom.string)
     3.5 +
     3.6 +if not id then
     3.7 +  id = "index"
     3.8 +else
     3.9 +  -- sanity check. Only allow letters, digits and _-
    3.10 +  id = string.match(id, "[%a%d_-]*")
    3.11 +end
    3.12 +
    3.13 +if not app.html_title.title then
    3.14 +  app.html_title.title = _("Help #{id}", { id = id })
    3.15 +end
    3.16 +
    3.17 +local basepath = request.get_app_basepath() 
    3.18 +local found_help = false
    3.19 +-- we try to load any help file that fits best
    3.20 +for x,lang in ipairs{locale.get("lang"), "en"} do
    3.21 +  for x,htype in ipairs{"_full", ""} do
    3.22 +    local file_name = basepath .. "/locale/help/" .. id .. htype .. "." .. lang .. ".txt.html"
    3.23 +    local file = io.open(file_name)
    3.24 +    if file ~= nil then
    3.25 +      local help_text = file:read("*a")
    3.26 +      if #help_text > 0 then
    3.27 +        found_help = true
    3.28 +        ui.container{
    3.29 +          attr = { class = "wiki" },
    3.30 +          content = function()
    3.31 +            slot.put(help_text)
    3.32 +          end
    3.33 +        }
    3.34 +        break
    3.35 +      end
    3.36 +    end
    3.37 +  end
    3.38 +end
    3.39 +
    3.40 +if not found_help then
    3.41 +  ui.field.text{ value = _("Missing help text: #{id}.#{lang}.txt", { id = id, lang = locale.get("lang") }) }
    3.42 +end
     4.1 --- a/app/main/initiative/new.lua	Tue Oct 05 14:30:29 2010 +0200
     4.2 +++ b/app/main/initiative/new.lua	Tue Oct 05 16:18:39 2010 +0200
     4.3 @@ -128,10 +128,40 @@
     4.4          { id = "rocketwiki", name = "RocketWiki" },
     4.5          { id = "compat", name = _"Traditional wiki syntax" }
     4.6        },
     4.7 +      attr = {id = "formatting_engine"},
     4.8        foreign_id = "id",
     4.9        foreign_name = "name",
    4.10        value = param.get("formatting_engine")
    4.11      }
    4.12 +    ui.tag{
    4.13 +        tag = "div",
    4.14 +        content = function()
    4.15 +          ui.tag{
    4.16 +            tag = "label",
    4.17 +            attr = { class = "ui_field_label" },
    4.18 +            content = function() slot.put("&nbsp;") end,
    4.19 +          }
    4.20 +          ui.tag{
    4.21 +            content = function()
    4.22 +              ui.link{
    4.23 +                text = _"Syntax help",
    4.24 +                module = "help",
    4.25 +                view = "show",
    4.26 +                id = "wikisyntax",
    4.27 +                attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    4.28 +              }
    4.29 +              slot.put(" ")
    4.30 +              ui.link{
    4.31 +                text = _"(new window)",
    4.32 +                module = "help",
    4.33 +                view = "show",
    4.34 +                id = "wikisyntax",
    4.35 +                attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    4.36 +              }
    4.37 +            end
    4.38 +          }
    4.39 +        end
    4.40 +      }
    4.41      ui.field.text{
    4.42        label = _"Draft",
    4.43        name = "draft",
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/locale/help/wikisyntax.en.txt	Tue Oct 05 16:18:39 2010 +0200
     5.3 @@ -0,0 +1,6 @@
     5.4 +==== Wiki Help ====
     5.5 +
     5.6 +You can choose between this different syntaxes:
     5.7 +
     5.8 +[wikisyntax_rocketwiki.html RocketWiki]
     5.9 +[wikisyntax_compat.html Traditional wiki syntax]
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/locale/help/wikisyntax_compat.en.txt	Tue Oct 05 16:18:39 2010 +0200
     6.3 @@ -0,0 +1,5 @@
     6.4 +<- [wikisyntax.html Wiki Help]
     6.5 +
     6.6 +==== CompatWiki ====
     6.7 +
     6.8 +FIXME
     6.9 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/locale/help/wikisyntax_rocketwiki.en.txt	Tue Oct 05 16:18:39 2010 +0200
     7.3 @@ -0,0 +1,72 @@
     7.4 +<- [wikisyntax.html Wiki Help]
     7.5 +
     7.6 +==== RocketWiki ====
     7.7 +- ++Headings++
     7.8 +-- ==== Main Heading (H1) ====
     7.9 +-- === Heading (H2) ===
    7.10 +-- == Sub-Heading (H3) ==
    7.11 +-- = Sub-Sub-Heading (H4) =
    7.12 +- ++Horizontal line++
    7.13 +-- ---
    7.14 +- ++Unnumbered lists++
    7.15 +-- - Toplevel Entry
    7.16 +-- -- Sub Entry
    7.17 +- ++Numbered list++
    7.18 +-- # Toplevel Entry
    7.19 +-- ## Sub Entry
    7.20 +- ++Font style++
    7.21 +-- {{**bold**}}
    7.22 +-- {{//italic//}}
    7.23 +-- {{__underlined__}}
    7.24 +-- {{++big++}}
    7.25 +-- {{%%small%%}}
    7.26 +-- {{||monospaced||}}
    7.27 +-- {{&&no line break&&}}
    7.28 +-- {{$$stylename: use a specific CSS style$$}}
    7.29 +-- {{{{no special interpretation of formatting characters}}}}
    7.30 +- ++Quotes++
    7.31 +-- {{""normal english quotes""}}
    7.32 +-- {{"""single english quotes"""}}
    7.33 +-- {{,,normal german quotes''}}
    7.34 +-- {{,,,single german quotes'''}}
    7.35 +-- {{<<normal french quotes>>}}
    7.36 +-- {{<<<single french quotes>>>}}
    7.37 +- ++Text flow++
    7.38 +-- non-breaking(_)space
    7.39 +-- soft(-)hypen
    7.40 +- ++Special characters++
    7.41 +-- {{{EUR}}} sign
    7.42 +-- German umlauts: {{{Ae} {Oe} {Ue} {ae} {oe} {ue}}}
    7.43 +-- German SZ-ligature: {{{sz} or {ss}}}
    7.44 +-- Mid{{{.}}}dot
    7.45 +-- Ellipsis {{{...}}}
    7.46 +-- Arrows {{{->} {=>} {<->}}} etc. 
    7.47 +-- {{{C} 2009, Registered{R}, Trademark{TM}}}
    7.48 +-- {{360{deg} 0{'} 0{''}}} => 360{deg} 0{'} 0{''}
    7.49 +-- {{{1/4} + {1/2} = {3/4}}} => {1/4} + {1/2} = {3/4}
    7.50 +-- {{10{%o} = 1%}} => 10{%o} = 1%
    7.51 +-- {{(5 {-} 1) {x} 3 {/} 4 {=} 3}} => (5 {-} 1) {x} 3 {/} 4 {=} 3
    7.52 +- ++Dashes++
    7.53 +-- En{{{--}}}Dash
    7.54 +-- Em{{{---}}}Dash
    7.55 +- ++Images++
    7.56 +-- {{[http://example.org/embedded_image.jpg]}}
    7.57 +-- {{[http://example.org/embedded_image.jpeg]}}
    7.58 +-- {{[http://example.org/embedded_image.gif]}}
    7.59 +-- {{[http://example.org/embedded_image.png]}}
    7.60 +-- {{[stylename: http://example.org/image_with_CSS_style.png]}}
    7.61 +-- {{[http://example.org/image.png Image with alternative text]}}
    7.62 +- ++Links++
    7.63 +-- {{[http://example.org/ normal link with text]}}
    7.64 +-- {{[http://example.org/ http://example.org/image_for_link.png]}}
    7.65 +-- {{[http://example.org/ http://example.org/image.png Alternative text]}}
    7.66 +-- {{[http://example.org/image.png! Link to image]}}
    7.67 +- ++DIVs++
    7.68 +-- @@id:
    7.69 +    DIV contents
    7.70 +   @@
    7.71 +- ++CSS styles for multiple paragraphs++
    7.72 +-- $$style:
    7.73 +     ...
    7.74 +   $$
    7.75 +

Impressum / About Us