From stephen at concord.org Wed Mar 21 15:06:28 2007 From: stephen at concord.org (Stephen Bannasch) Date: Wed, 21 Mar 2007 15:06:28 -0400 Subject: using '_.' to indicate table headers doesn't work in SRC v1.160 Message-ID: I'm using" superredcloth (1.160) Using '_.' to indicate table headers doesn't work: $ irb irb(main):001:0> require 'superredcloth' => true irb(main):005:0> SuperRedCloth.new("|_. name |_. age |_. sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |\n").to_html => "\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
_. name _. age _. sex
joan 24 f
archie 29 m
bella 45 f
" irb(main):006:0> SuperRedCloth.new("|name |age |sex |\n| joan | 24 | f |\n| archie | 29 | m |\n| bella | 45 | f |\n").to_html => "\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
name age sex
joan 24 f
archie 29 m
bella 45 f
" -- - Stephen Bannasch Concord Consortium, http://www.concord.org From timocratic at gmail.com Sat Mar 24 12:27:02 2007 From: timocratic at gmail.com (Tim Connor) Date: Sat, 24 Mar 2007 09:27:02 -0700 Subject: Stability and usability of SuperRedCloth - particularly break handling Message-ID: <5906dd440703240927m48ddd30bp27f115b7a6beae5c@mail.gmail.com> I was just wondering if I should upgrade to using SRC, as it sounds like it is going to be what becomes RedCloth 4. Reading the wiki and the announcements it's supposedly under very active development, nearing release, and the breaking options are next on the list. Since there hadn't been an update in a little while, I was curious where it stands now. The break handling in RedCloth 3 seems a little unusable currently, so I was looking at my upgrade options. Tim From stephen at concord.org Sat Mar 24 12:30:37 2007 From: stephen at concord.org (Stephen Bannasch) Date: Sat, 24 Mar 2007 12:30:37 -0400 Subject: Patch for superredcloth to enable textile table headers Message-ID: SuperRedCloth v1.160 and svn rev 163 don't work the textile commands that specify table headers instead of table data. Here's a simple test: require 'superredcloth' w = "|_. a|_. b|_. c|\n|1|2|3|" h = SuperRedCloth.new(w).to_html puts h
_. a _. b _. c
1 2 3
I have a patch for svn rev 163 that fixes this and adds two tests (one for a very simple table, and a second with that same simple table with headers). The first test works now, the second works also with the patch. It was fun learning a bit about ragel. What's the best way to contribute it? I added it as a patch to my redcloth ticket about the problem: http://code.whytheluckystiff.net/redcloth/ticket/9 Here's what the patches look like as a svn diff: $ svn diff Index: test/table.yml =================================================================== --- test/table.yml (revision 163) +++ test/table.yml (working copy) @@ -1,4 +1,39 @@ +--- in: | + |a|b|c| + |1|2|3| +out: |- + + + + + + + + + + + +
abc
123
+--- +in: | + |_. a|_. b|_. c| + |1|2|3| +out: |- + + + + + + + + + + + +
abc
123
+--- +in: | {background:#ddd}. |S|Target|Complete|App|Milestone| |!/i/g.gif!|11/18/04|11/18/04|070|XML spec complete| |!/i/g.gif!|11/29/04|11/29/04|011|XML spec complete (KH is on schedule)| Index: ext/superredcloth_scan/superredcloth_scan.rl =================================================================== --- ext/superredcloth_scan/superredcloth_scan.rl (revision 163) +++ ext/superredcloth_scan/superredcloth_scan.rl (working copy) @@ -37,9 +37,9 @@ # tables para = ( default+ ) -- CRLF ; btext = para ( CRLF{2} )? ; - tddef = ( S A C :> dotspace ) ; + tddef = ( S A C D :> dotspace ) ; td = ( tddef? btext >A %T :> "|" >{PASS(table, text, td);} ) >X ; - trdef = ( A C :> dotspace ) ; + trdef = ( A C D :> dotspace ) ; tr = ( trdef? "|" %{INLINE(table, tr_open);} td+ ) >X %{INLINE(table, tr_close);} ; trows = ( tr (CRLF >X tr)* ) ; tdef = ( "table" >X A C :> dotspace CRLF ) ; Index: ext/superredcloth_scan/superredcloth_common.rl =================================================================== --- ext/superredcloth_scan/superredcloth_common.rl (revision 163) +++ ext/superredcloth_scan/superredcloth_common.rl (working copy) @@ -29,10 +29,12 @@ C_STYL = ( "{" [^}]+ >A %{ STORE(style) } "}" ) ; S_CSPN = ( "\\" [0-9]+ >A %{ STORE(colspan) } ) ; S_RSPN = ( "/" [0-9]+ >A %{ STORE(rowspan) } ) ; + D_HEADER = "_" %{ ASET(th, true) } ; A = ( ( A_HLGN | A_VLGN )* ) ; A2 = ( A_LIMIT? ) ; S = ( S_CSPN | S_RSPN )* ; C = ( C_CLAS | C_STYL | C_LNGE )* ; + D = ( D_HEADER ) ; N_CONT = "_" %{ ASET(start, continue) }; N_NUM = digit+ >A %{ STORE(start) }; N = ( N_CONT | N_NUM )? ; Index: lib/superredcloth.rb =================================================================== --- lib/superredcloth.rb (revision 163) +++ lib/superredcloth.rb (working copy) @@ -46,7 +46,8 @@ "

" + txt + "

" end def td opts - "\t\t\t#{opts[:text]}\n" + tdtype = opts[:th] ? 'th' : 'td' + "\t\t\t<#{tdtype}#{pba(opts)}>#{opts[:text]}\n" end def tr_open opts "\t\t\n" [~/dev/rails/why/superredcloth]$ svn up At revision 163. [~/dev/rails/why/superredcloth]$ ruby test_table.rb
_. a _. b _. c
1 2 3
-- - Stephen Bannasch Concord Consortium, http://www.concord.org From michael.guymon at gmail.com Sat Mar 24 18:20:26 2007 From: michael.guymon at gmail.com (Michael) Date: Sat, 24 Mar 2007 18:20:26 -0400 Subject: ignored blocks in redcloth Message-ID: <5f90c3790703241520t33890af0g79c8aad5bfcccb88@mail.gmail.com> Hello Redclothians, In Redcloth, is there syntax to add something to a wiki block that is not parsed by redcloth? for example: $permission$ h2. title * blah * blah where $permission$ is ignored by redcloth, so it doesnt affect the rendering of wiki syntax -> html, but appears when you edit a page (perk for me would to also have it not appear in the rendered html). Why would anyone want this? Well, I am trying setup Instiki for my association of slackers. Rather than have 2 wikis, one internal and one external, I decided to create a plugin for Instiki to handle page permissions. This is done through a series of filters combined with basic auth, so Redcloth nor Instiki is directly changed. My problem is having a $permission$ block in redcloth screws with the rendering around it. Using the example wiki block above, "h2.title" will not render to "

Test:

" in html, but appears as "h2. title" because the $permission$ angers Redcloth. thanks, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/redcloth-upwards/attachments/20070324/a738da6d/attachment.html From stephen at concord.org Mon Mar 26 14:27:09 2007 From: stephen at concord.org (Stephen Bannasch) Date: Mon, 26 Mar 2007 14:27:09 -0400 Subject: Patch for superredcloth to enable textile table headers In-Reply-To: References: Message-ID: I updated my patch for table_headers here: http://code.whytheluckystiff.net/redcloth/ticket/9 I fixed a problem where it was breaking other functionality and and added more table tests. I copied some of the table tests in textism.yml to table.yml so I could test and work on just the table tests more easily. I didn't changed textism.yml. There are now 8 tests in table.yml and only the last one still fails for just two reasons: 1. styles aren't having a ';' added if needed at the end of a style list 2. '|.|' aren't being converted to   Is #2 a feature of textile? I added a test for an empty table cell and it seems to work fine. This test passes: in: |- |a|b|c| | |2|3| out: |-
a b c
2 3
-- - Stephen Bannasch Concord Consortium, http://www.concord.org