kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 131 forks source link

Wrap content & prevent newline #82

Closed itskingori closed 11 years ago

itskingori commented 11 years ago

Is it possible to wrap content at lets say ... 80 characters and avoid the \n (newline) character inserted by YAML.

This would avoid having looooooong lines.

Any ideas/pointers?

kolber commented 11 years ago

I think the best, most simple solution would be to turn on text-wrapping in your text editor. It would be very difficult to handle this in Stacey itself.

itskingori commented 11 years ago

I have.

I use Sublime Text 2 and have the text wrapped at 80 characters.

However ... at each actual new line \n is added as opposed to a new line added at the end of the paragraph/block

Have a look at this ... three_trailing_newlines_in_literals

I also tried this ...

Examples are from the Ruby cookbook that you mention somewhere.

I don't think the issue is Stacey though as you can see from the link, after YAML is done ... the result has the \n after every actual line.

The result of course is that people will have to write long lines like this ...

Unless there's something obvious I'm missing.

Oh, and the 80 character thing was just an example ... didn't actually intend for Stacey to do it.

kolber commented 11 years ago

Ah, I see what you're saying. This change introduces Github-style line breaks, thus introducing your problem. :P

I find less technical users tend to find the default Markdown linebreak handling confusing. Which was the reason for the change in the first place.

itskingori commented 11 years ago

@kolber So, I forked Stacey and implemented this itsmrwave/stacey@cc176d2d43e3ddf312535e9d50af2993f5d1d69e

In summary ... I;

Now, this is the part I'm not too comfortable with ... I thought I didn't have to require_once the config file since its included in the Stacey index.php file but I think without this Config::$md_gfm_style_linebreaks is not in scope and has no value etc etc

However, looking at the app/parsers/template-parser.inc.php you are able to access Config::$templates_folder ... being the creator and all, you would be able to determine if this was the right approach or I was just being lazy :-) ... if the latter, maybe you could point me in the right direction?

And thanks for the tip, saved me a lot of time.

Ps: If this 'hack' is inline with your vision going forward I could submit a pull request later

itskingori commented 11 years ago

This was my fix, submitted as pull #85 if its ok.