Found a better way I think. One of the problems with my solution is I now 
have to double handle "hr" in the CSS rules.

I can create my own HTML tag, but that requires changes, may not be exactly 
compatible and will definitely require a change to the base TW (I think). 
See here the solution from Timothy Perez:
http://stackoverflow.com/questions/2802687/is-there-a-way-to-create-your-own-html-tag-in-html5

So after a little research (thanks Google!) I found a list of ALL html tags 
(http://www.w3schools.com/tags/), and located ones that are not really used 
at all but they all require closing tags, which seems to cause some fatal 
issues with the display. It's a shame 'cos I would have loved to use *<s> *(cue 
Superman theme). 

Then I found <area> which solves the issue!

For the css display issues (extra spacing between elements) I found that 
when a <area> tag preceded a <ul>, <ol> or <blockquote> tag there was 
whatever formatting from the <ul>, <ol>, <blockquote> plus the formatting 
for <area>. It doesn't seem as visible an issue with headers for instance 
as they already require a bit of separation and the margin-bottom:0.5em I 
put on <area> doesn't seem to much. Because these three are usually inline 
paragraph text and follow a ":" in the copy. I added the following to 
address this:

ul, ol, blockquote{margin-top:0;}


There may be more tags, but I can add them as I find them. 

Now I don't have any issues resolve across the TW and I have a quality 
solution for my paragraph spacing.

Solution is now:

   1. In the TW html, find:
   name: "lineBreak",
   match: "\\n|<br ?/?>",
   handler: function(w)
   {
   createTiddlyElement(w.output,"br");
   }
   and change:
   *createTiddlyElement(w.output,"**br**");
   *to:
   *createTiddlyElement(w.output,"*area*");*
   2. Apply some CSS to the "area" tag:
   area{display:block;border-style:none;margin:0 0 0.5em 0;padding:0; }
   3. Apply some CSS to the ul, ol and blockquote tags to over-ride their 
   defaults. The "~" ensures that the format change only happens where <area> 
   directly precedes the <ul> tag etc. :
   area ~ ul, area ~ ol, area ~ blockquote{margin-top:0;}

On Wednesday, June 12, 2013 5:25:23 PM UTC+10, Jeremy Ruston wrote:
>
> Hi cflow
>
> Firstly, that's an ingenious solution: as you probably discovered you 
> can't usefully style the <br> element with CSS, but <hr> makes a lot of 
> sense as a substitute.
>
> Secondly, to answer your original question, the reason that it's not easy 
> to change the TiddlyWiki wikifier to emit <p>'s instead of <br>'s is just 
> to do with the way that the code is written: at the point where the parsing 
> code encounters the newline it no longer knows the location of the previous 
> one. It would be possible to fix this by rewriting the wikifier, but back 
> in 2007/8 we concluded that this couldn't be done without breaking 
> backwards compatibility.
>
> TiddlyWiki5 does parse paragraphs properly as <p> tags, but is also not 
> backwards compatible with classic TW syntax.
>
> Best wishes
>
> Jeremy
>
>
>
>
> On Wed, Jun 12, 2013 at 2:13 AM, cflow <[email protected]<javascript:>
> > wrote:
>
>> Had a quick look and this piece of code seemed to do the replace:
>>
>>  name: "lineBreak",
>> match: "\\n|<br ?/?>",
>> handler: function(w)
>>  {
>> createTiddlyElement(w.output,"br");
>> }
>>
>> Looks like the specific feature searched on is the "\\n" which would be 
>> the newline character to find, so the start/end of paragraph search I 
>> thought was happening, is not :(
>>  
>> So I changed:
>>
>> *createTiddlyElement(w.output,"**br**"); *
>>
>> to:
>>
>> *createTiddlyElement(w.output,"*hr*");*
>>
>> *
>> *
>> Then applied some CSS to the ".viewer hr" as it is specifically where I 
>> want the "hr" tag formatting:
>>
>> .viewer 
>> hr{border-style:none;padding-bottom:0.25em;color:#fff;background-color:transparent;}
>>
>>  
>> which gave me the desired result of space between paragraphs.
>>
>> If I want to add a horizontal rule, which I rarely do, I use can use the 
>> following:
>>
>> .hrule hr{border-bottom:1px solid red;padding-bottom:0.25em; }
>>
>> with inline use of the class:
>>
>> {{hrule{
>>
>> ----
>>
>> }}}
>>
>>  
>>
>> I still would prefer a better solution, but this workaround gets me the 
>> visible result. I haven't seen any issues so far... ;)
>>
>> On Wednesday, June 12, 2013 10:15:18 AM UTC+10, cflow wrote:
>>>
>>> Hi Jeremy, 
>>>
>>> Was this ever resolved?
>>> It seems like if it can place <br> in the correct positions then its 
>>> smart enough to find the start of paragraphs and the end of paragraphs 
>>> already. I have read a few of the group pages and anything I can find 
>>> online but it isn't part of the latest TiddlyWiki version.
>>>
>>> If its smart enough to find the start and end of paragraphs to place the 
>>> <br> surely it is a minor mod to add the <p> at the start and </p> to the 
>>> end?
>>>
>>> What am I missing? If someone can point me to the code that does the 
>>> search for the start/end of paragraphs I will have a crack :)
>>>
>>>
>>> On Monday, May 21, 2007 9:29:27 AM UTC+10, Jeremy Ruston wrote:
>>>>
>>>> > Though I guess they'd prefer us donating directly via PayPal
>>>> > (http://tiddlywiki.com/#**Donations<http://tiddlywiki.com/#Donations>) 
>>>> rather than waiting until, someday,
>>>> > we can come up with 750 quid for "perishable goods"... ;)
>>>>
>>>> You're really very kind, and quite right this is a bit of a humdinger.
>>>> Martin's implementations of the Mediawiki and Socialtext formatters do
>>>> handle <P> tags correctly thouugh (although I believe there are still
>>>> some issues in certain edge cases). So I think we're in good shape to
>>>> solve this; the problem when we do will no doubt be backwards
>>>> compatibility....
>>>>
>>>> Cheers
>>>>
>>>> Jeremy
>>>>
>>>> >
>>>> >
>>>> > -- F.
>>>> >
>>>> > >
>>>> >
>>>>
>>>>
>>>> -- 
>>>> Jeremy Ruston
>>>> mailto:[email protected]
>>>> http://www.tiddlywiki.com
>>>>
>>>>
>
>
> -- 
> Jeremy Ruston
> mailto:[email protected] <javascript:>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to