[twdev] Re: post-processing tiddlywiki generated html

2011-06-27 Thread cd...@peermore.com
On Jun 25, 11:33 am, chris.d...@gmail.com wrote:
 So there's no block to handle. So the first part of purpleater is to
 create blocks.

I've made some adjustments that improve the situation for me.
Basically what it does is look inside any current block resulting from
the first split to see if there are any br and if so, it splits
again and does some jiggery pokery. This works out okay with my typing
style (I don't use linefeeds within paragraphs and I generally have
two linefeeds between what I consider blocks.

This won't work for everyone because a fair few people do use
linefeeds inside paragraphs as well as not wanting double \n between
blocks.

This is the new version of the block creation:

var wholething = $('#text-html.section');
var el = jQuery(div/);
var chunks = $('#text-html.section').html().split('brbr');
$.map(chunks, function(chunk, i) {
if (!chunk.match(/^(?:h|ul|ol|dl|block)/)) {
chunk = $(p/).html(chunk).appendTo(el);
} else {
if (chunk.indexOf('br')  0) {
var innerChunks = chunk.split('br');
el.append(innerChunks.shift());
$.map(innerChunks, function(inner, i) {
inner = $(p/).html(inner).appendTo(el);
});
} else {
el.append(chunk);
}
}
});
wholething.empty();
el.children().appendTo(wholething);

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.



[twdev] Re: post-processing tiddlywiki generated html

2011-06-27 Thread PMario
Hi Chris,
Should your code handle tiddler transclusions too?
It doesn't.

testcase:
[[tiddler 1]]
paragraph 1
{{{monospaced text}}}

pargraph 2

[[tiddler 2]]
some text

tiddler tiddler 1

some more text
-m

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.



Re: [twdev] Re: post-processing tiddlywiki generated html

2011-06-27 Thread chris . dent

On Mon, 27 Jun 2011, PMario wrote:


Hi Chris,
Should your code handle tiddler transclusions too?


I'm not sure I understand you. This page:

  http://cdent.tiddlyspace.com/HelloThere

uses transclusions:

  http://cdent.tiddlyspace.com/HelloThere.txt

and the purple-ness works fine there.

Can you be more specific than It doesn't?

--
Chris Dent   http://burningchrome.com/
[...]

--
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.



[twdev] Re: post-processing tiddlywiki generated html

2011-06-27 Thread PMario
On Jun 27, 8:52 pm, chris.d...@gmail.com wrote:

 Can you be more specific than It doesn't?
Try my testcase

testcase:
[[tiddler 1]]
paragraph 1
{{{monospaced text}}}

pargraph 2

[[tiddler 2]]
some text

tiddler tiddler 1

some more text

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.



Re: [twdev] Re: post-processing tiddlywiki generated html

2011-06-27 Thread chris . dent

On Mon, 27 Jun 2011, PMario wrote:


On Jun 27, 8:52 pm, chris.d...@gmail.com wrote:


Can you be more specific than It doesn't?

Try my testcase


It's hard to tell what your testcase is, because you're using
tiddlywiki markup [[ to indicate what I assume is supposed to
indicate different tiddlers. However, with some guessing I was able to
get something that looks about what you mean:

  http://cdent.tiddlyspace.com/bags/cdent_public/tiddlers/ptest1.html
  http://cdent.tiddlyspace.com/bags/cdent_public/tiddlers/ptest2.html

The results are what I would expect. There seems to be no problem with
transclusions. There's some weirdness with the monospaced text not
getting it's own purple number, but that is because as written it is
part of the paragraph 1.

Compare with:

  http://cdent.tiddlyspace.com/bags/cdent_public/tiddlers/ptest1.a.html
  http://cdent.tiddlyspace.com/bags/cdent_public/tiddlers/ptest2.a.html

Which has output more in line with what I would expect and also
aligned with what I was describing as my natural typing style (i.e.
double linebreaks between blocks).

Note for people following along and not getting anything at all: This
stuff seems to work most reliably in webkit based browsers (safari and
chrome). I do my testing in Safari nightly betas and have not yet done
any work to make it work in other browsers.

--
Chris Dent   http://burningchrome.com/
[...]

--
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To post to this group, send email to tiddlywikidev@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywikidev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.