Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > redcloth - multiline comments

Reply
Thread Tools

redcloth - multiline comments

 
 
Simon Strandgaard
Guest
Posts: n/a
 
      09-30-2004
Hi,

I am curious to how to do multiline comments with redcloth.

http://hobix.com/textile/

According to above manual it should be possible to use
html tags inside.. but <!-- comment --> doesn't seem to work.

Am I missing something obvious?

--
Simon Strandgaard


 
Reply With Quote
 
 
 
 
Simon Strandgaard
Guest
Posts: n/a
 
      09-30-2004
On Thursday 30 September 2004 19:43, Simon Strandgaard wrote:
> Hi,
>
> I am curious to how to do multiline comments with redcloth.
>
> http://hobix.com/textile/
>
> According to above manual it should be possible to use
> html tags inside.. but <!-- comment --> doesn't seem to work.
>
> Am I missing something obvious?


Ah.. I downloaded the source and found out that I could
write <notextile> comment </notextile>

Att: whytheluckystiff
In the above manual I only see ==notextile==. Maybe the manual should be
fixed?

(thanks for redcloth)

--
Simon Strandgaard


 
Reply With Quote
 
 
 
 
why the lucky stiff
Guest
Posts: n/a
 
      09-30-2004
Simon Strandgaard wrote:

>Att: whytheluckystiff
>In the above manual I only see ==notextile==. Maybe the manual should be
>fixed?
>
>

WondergoodthanksIwill.

_why


 
Reply With Quote
 
Simon Strandgaard
Guest
Posts: n/a
 
      09-30-2004
--Boundary-00=_nkHXB4NMh0US1tZ
Content-Type: Multipart/Mixed;
boundary="Boundary-00=_nkHXB4NMh0US1tZ"


--Boundary-00=_nkHXB4NMh0US1tZ
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thursday 30 September 2004 20:42, why the lucky stiff wrote:
> Simon Strandgaard wrote:
> >Att: whytheluckystiff
> >In the above manual I only see ==notextile==. Maybe the manual should be
> >fixed?

>
> WondergoodthanksIwill.
>
> _why



hmm..

I can see the OFFTAGS regexp contains the 'notextile' name.
however when I use <notextile>sometext</notextile> then the
tags seems to be replaced with empty strings. I cannot understand how the
#glyphs method is being used.

I have attached both my input file and output file, plus rake file.
it seems not to be outputted any <notextile> tag nor <!-- --> tag.
Just search for the <notextile> in the index.textile file.

It seemed to work.. maybe I am doing something wrong?

How do I make html comments?

--
Simon Strandgaard

--Boundary-00=_nkHXB4NMh0US1tZ
Content-Type: text/html;
charset="iso-8859-1";
name="index.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="index.html"

<html><head><title>A New Data Structure</title><style type="text/css">
body {
font-family: monospace;
font-size: 16pt;
font-weight: bold;

margin-left: 2em;
margin-right: 4em;
background-color: rgb(65,48,166);
color: rgb(121,113,223);
}
span.important {
background-color: rgb(255,223,113);
color: rgb(0,0,0);
}
p, li {
text-align: justify;
}
li {
padding-bottom: 10px;
}
</style>
</head><body><h2>A New Data Structure</h2>

<p>By <em>Simon Strandgaard</em>.</p>

<h3>Abstract</h3>

<p>I cannot recall how many times I have reworked AEditors datastructure. I have a zillion specs inside my head, and I have reached the point where im getting tired whenever im trying to draw a new setup on paper. Mostly because of all these specs must be considered at the same time, pulling in opposite directions. This design document is merely to be able to overview all these specs at the same time, and hopefully to <i>capture a better design</i>.</p>

<h3>Whats Wrong With The Old Design?</h3>

<p>Some things sux and other things is missing.</p>

<ol>
<li><em><span class="important">Bad caching</span></em>. With the <code>AEditor 1.x</code> branch I implemented syntax coloring, it required many layers of caching. The current model for this is buggy, for instance in selection mode and one press pageup, then under some conditions I don’t get cleared some cache entries correct. Leaving the buffer with wrong data. Mabye this is because of too simple design. I would like a more <em>automatic cache refreshing</em>. </li>
<li><em><span class="important">Optimized vertical scrolling</span></em>. When I added support for this, I had to re-implement all buffer operations, so they could invoke the optimized code only when necessary and do as little as possible. It would be really nice if the caching system were so lazy that it could determine how to do <em>minimal repaint+blitting automaticly</em>. This way there is half as much code to maintain and test, so this would be a big win (less code == less bugs). </li>
<li><em><span class="important">Robustness</span></em> is bad. Somehow I from time to time get iterator underflow/overflow error, its difficult to tell exactly what the problem seems to be. I guess that I break the integrity in the view/model at some point. But its really difficult to tell where exactly it happens. The shortest procedure I have made that could reproduce the problem were 3-6 operations.. but still not easy to tell what goes wrong. Recently I have been busy with my study and job, so I havn’t got enough time to really dig into this issue. A more robust data structure which doesn’t allow for invalid data would be nice, so that its <em>easier to hunt down such problems</em>. </li>
<li><em><span class="important">Folding</span></em>. I have implemented arbitrary folding in the <code>AEditor 0.x</code> branch with an akward design that violates the <em><span class="caps">MVC</span></em> pattern (so that multiple views are <em>impossible</em>). I like its concept which is easy on the eyes. However my ideas for this was formed long time before I knew Ruby. Today I also want folding on Heredocs, Literals, Strings, Arrays, Hashes.. Everything that spans over multiple lines. I want to be able to store the folding information along with the file. I want to have multiple view to the same document. Maybe I also want multiple persons to be able to edit the same document simulatanous. I like moderate folding, to much folding feels like bloat, though some people like lots of folding. </li>
<li><em><span class="important">Optimized horizontal scrolling</span></em>. I have never had support for this feature, but it would be nice. It will require substantial changes to the code that decorates the line. Anyway this area will require major changes in order to support line numbering. I can probably recycle the lazy scheme I hope to get developed with the vertical scrolling. This has low priority. </li>
<li><em><span class="important">2 Pass lexing</span></em>. Right now im doing full syntax coloring in one pass. I suspect that more speed can be gained dividing this great task into a relative small first pass and a bigger second pass, so that the editor can become more responsive. Though I find it hard to see how I can break my current lexers into smaller tasks. I am wondering if there are other editors that also has 2 pass lexing? </li>
<li><em><span class="important">Multiple views</span></em>. So far I have decided only consider setups with only one view in order to make things so simple that I could understand them myself. It is common that modern editors supports multiple views of the same buffer. This raises some issues about how to manage the undo/redo? Especially how to do intersection between multiple undo-lists. Recently there has been lots of talk about Collaborative Editing, which also is about intelligent merge of the undo-list. Should AEditor go this direction? It probably will require some experimentation with undo-lists. </li>
<li><em><span class="important">i18n</span></em>. The old <code>AEditor 1.x</code> branch were originally designed for unicode but at some point I forgot about encoding (again). I could probably modify the code so it can render unicode, but maybe it will take too many resources. This time I better do it right from the start. </li>
<li><em><span class="important">prevent explosion of objects</span></em>. The number of active objects are huge, because I have multiple levels of caching. Some places I use Array of pairs, which really waste memory. But this problem is difficult to fix, because I then would loose the future-ability of supporting a mix of <em>wide-chars</em> and <em>normal-chars</em>. Maybe I should do <code>Marshal.dump</code> on those buffers which isn’t active, so that only the current active buffers takes up resources? I must be careful that the switch to buffer operation, doesn’t become too annoying. </li>
<li><em><span class="important">live templates</span></em>. Some editors are beginning to ship with this feature. You insert a template, and then fills out the empty fields. Very similar to inserting a wizard directly inside the buffer. By hitting <em>tab</em> you can move to next field. By hitting <em>shift+tab</em> you can move to previous field. This is quite complex because such template can span multiple lines. Very handy but also very complex to support.</li>
</ol>

<p>As you can imagine above issues are difficult to fit into the same design.</p>

<h3>Open Questions</h3>

<p>Im interested in finding a solution to these issues, but im unsure how to best approach it. Should I write lots of text where I do analysis? Should I make proof of concept code? How many iterations can I expect it will take? How should I break it down so that I am sure that I won’t forget things? Maybe I have forgotten some important issues. Please remind me.</p>

<h3>New Features</h3>

<p>There are some features that I never had any experience with, these may suprise me, see 6, 7 and 10.</p>

<h3>Automatic Structure</h3>

<p>In the list of problems I mention some issues regarding caching and automatic blitting, see 1, 2, 5. These are very related to eachother, and can probably be solved together. With multiple views it necessary that the model notifies all views about changes, so 7 also has aspects in this area.</p>

<h3>Advanced Editing</h3>

<p>Both 4, 8 and 10, requires custom editing strategies. <span class="caps">BTW</span>. I could as well add support for variable shiftwidth/tabstop, because the edit caretaker probably will require substantial modification.</p>

h2. How To Write

seems like the favourite layouts are:
# what the system is for.
# workflow.
# inputs.
# outputs.
# description of each component from lowest to highest. This chapter always start with a diagram of the layers in the system it also shows the inter-layer connections between components.


<h2>Rethinking The Caching Scheme</h2>

<p>I want things to happen automatic, in a way so I don’t have to think about what im doing, so I don’t have to write bunches of flawed code to clear <em>some</em> of the right entries in the cache. What im doing now requires lots of effort to figure out what entries to clear, and requires lots of typing too. There must be a more comfordable/robust way to do this, where everything occurs automatic. The places where I make changes to the model, must somehow be kept track of. Same thing when I scroll sideways then I must set some dirtyflags, that these lines must be repainted, but no need for applying the lexer again.</p>

<p>Here is a some random questions:</p>

<ol>
<li>What operations sets which dirtyflags?</li>
<li>How many levels of caching do I need?</li>
<li>What data should each cache layer keep track of?</li>
<li>How should the automatic behavior be?</li>
<li>How does an operation trigger this automatic behavior?</li>
</ol></body></html>
--Boundary-00=_nkHXB4NMh0US1tZ
Content-Type: text/plain;
charset="iso-8859-1";
name="index.textile"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="index.textile"

h2. A New Data Structure

By _Simon Strandgaard_.

h3. Abstract

I cannot recall how many times I have reworked AEditors datastructure.
I have a zillion specs inside my head, and I have reached the
point where im getting tired whenever im trying to draw a new
setup on paper. Mostly because of all these specs must be
considered at the same time, pulling in opposite directions.
This design document is merely to be able to overview all these
specs at the same time, and hopefully to __capture a better design__.

h3. Whats Wrong With The Old Design?

Some things sux and other things is missing.

# _%(important)Bad caching%_. With the @AEditor 1.x@ branch I implemented
syntax coloring, it required many layers of caching.
The current model for this is buggy, for instance in
selection mode and one press pageup, then under some conditions
I don't get cleared some cache entries correct. Leaving the
buffer with wrong data. Mabye this is because of too simple
design. I would like a more _automatic cache refreshing_.

# _%(important)Optimized vertical scrolling%_. When I added support for this,
I had to re-implement all buffer operations, so they could invoke
the optimized code only when necessary and do as little as possible.
It would be really nice if the caching system were so lazy that it
could determine how to do _minimal repaint+blitting automaticly_.
This way there is half as much code to maintain and test, so this
would be a big win (less code == less bugs).

# _%(important)Robustness%_ is bad. Somehow I from time to time get
iterator underflow/overflow error, its difficult to tell exactly
what the problem seems to be. I guess that I break the integrity
in the view/model at some point. But its really difficult to
tell where exactly it happens. The shortest procedure I have made
that could reproduce the problem were 3-6 operations.. but still
not easy to tell what goes wrong. Recently I have been busy
with my study and job, so I havn't got enough time to really dig
into this issue. A more robust data structure which doesn't allow
for invalid data would be nice, so that its _easier to hunt down
such problems_.

# _%(important)Folding%_. I have implemented arbitrary folding in
the @AEditor 0.x@ branch with an akward design that
violates the _MVC_ pattern (so that multiple views are _impossible_).
I like its concept which is easy on the eyes. However my ideas for
this was formed long time before I knew Ruby. Today I also want
folding on Heredocs, Literals, Strings, Arrays, Hashes..
Everything that spans over multiple lines. I want to be able
to store the folding information along with the file. I want
to have multiple view to the same document. Maybe I also want
multiple persons to be able to edit the same document simulatanous.
I like moderate folding, to much folding feels like bloat,
though some people like lots of folding.

# _%(important)Optimized horizontal scrolling%_. I have never had support
for this feature, but it would be nice. It will require substantial
changes to the code that decorates the line. Anyway this area
will require major changes in order to support line numbering.
I can probably recycle the lazy scheme I hope to get developed
with the vertical scrolling. This has low priority.

# _%(important)2 Pass lexing%_. Right now im doing full syntax coloring in one
pass. I suspect that more speed can be gained dividing this great
task into a relative small first pass and a bigger second pass,
so that the editor can become more responsive. Though I find it
hard to see how I can break my current lexers into smaller tasks.
I am wondering if there are other editors that also has 2 pass
lexing?

# _%(important)Multiple views%_. So far I have decided only consider setups
with only one view in order to make things so simple that I could
understand them myself. It is common that modern editors supports
multiple views of the same buffer. This raises some issues about
how to manage the undo/redo? Especially how to do intersection
between multiple undo-lists. Recently there has been lots of
talk about Collaborative Editing, which also is about intelligent
merge of the undo-list. Should AEditor go this direction?
It probably will require some experimentation with undo-lists.

# _%(important)i18n%_. The old @AEditor 1.x@ branch were originally designed
for unicode but at some point I forgot about encoding (again).
I could probably modify the code so it can render unicode, but
maybe it will take too many resources. This time I better do it
right from the start.

# _%(important)prevent explosion of objects%_. The number of active objects are
huge, because I have multiple levels of caching. Some places I
use Array of pairs, which really waste memory. But this problem
is difficult to fix, because I then would loose the future-ability
of supporting a mix of _wide-chars_ and _normal-chars_. Maybe I
should do @Marshal.dump@ on those buffers which isn't active, so
that only the current active buffers takes up resources?
I must be careful that the switch to buffer operation, doesn't
become too annoying.

# _%(important)live templates%_. Some editors are beginning to ship with this
feature. You insert a template, and then fills out the empty
fields. Very similar to inserting a wizard directly inside the
buffer. By hitting _tab_ you can move to next field. By hitting
_shift+tab_ you can move to previous field. This is quite complex
because such template can span multiple lines. Very handy but
also very complex to support.


As you can imagine above issues are difficult to fit into the
same design.

h3. Open Questions

Im interested in finding a solution to these issues, but im unsure
how to best approach it. Should I write lots of text where I do
analysis? Should I make proof of concept code? How many iterations
can I expect it will take? How should I break it down so that I
am sure that I won't forget things? Maybe I have forgotten some
important issues. Please remind me.

h3. New Features

There are some features that I never had any experience with, these
may suprise me, see 6, 7 and 10.

h3. Automatic Structure

In the list of problems I mention some issues regarding caching and
automatic blitting, see 1, 2, 5. These are very related to eachother,
and can probably be solved together. With multiple views it necessary
that the model notifies all views about changes, so 7 also has
aspects in this area.

h3. Advanced Editing

Both 4, 8 and 10, requires custom editing strategies. BTW. I could
as well add support for variable shiftwidth/tabstop, because the
edit caretaker probably will require substantial modification.


<notextile>
h2. How To Write

seems like the favourite layouts are:
# what the system is for.
# workflow.
# inputs.
# outputs.
# description of each component from lowest to highest.
This chapter always start with a diagram of the layers in
the system it also shows the inter-layer connections between
components.
</notextile>


h2. Rethinking The Caching Scheme

I want things to happen automatic, in a way so I don't have to
think about what im doing, so I don't have to write bunches
of flawed code to clear _some_ of the right entries in the cache.
What im doing now requires lots of effort to figure out what
entries to clear, and requires lots of typing too. There must
be a more comfordable/robust way to do this, where everything
occurs automatic. The places where I make changes to the model,
must somehow be kept track of. Same thing when I scroll
sideways then I must set some dirtyflags, that these lines
must be repainted, but no need for applying the lexer again.

Here is a some random questions:

# What operations sets which dirtyflags?
# How many levels of caching do I need?
# What data should each cache layer keep track of?
# How should the automatic behavior be?
# How does an operation trigger this automatic behavior?









--Boundary-00=_nkHXB4NMh0US1tZ
Content-Type: text/plain;
charset="iso-8859-1";
name="Rakefile"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="Rakefile"

task :default => ['index.html']

rule '.html' => ['.md'] do |t|
sh "bluecloth #{t.source} > #{t.name}"
end

rule '.html' => ['.textile'] do |t|
require 'redcloth'
rc = RedCloth.new(IO.read(t.source))
rc.fold_lines = true
body = "<body>"+rc.to_html+"</body>"
title = "<title>A New Data Structure</title>"
css = <<CSS
<style type="text/css">
body {
font-family: monospace;
font-size: 16pt;
font-weight: bold;

margin-left: 2em;
margin-right: 4em;
background-color: rgb(65,48,166);
color: rgb(121,113,223);
}
span.important {
background-color: rgb(255,223,113);
color: rgb(0,0,0);
}
p, li {
text-align: justify;
}
li {
padding-bottom: 10px;
}
</style>
CSS
head = "<head>" + title + css + "</head>"
str = "<html>" + head + body + "</html>"
File.open(t.name, 'w+') {|f| f.write str }
p 'redcloth is done'
end

task :upload do
sh "scp -r *.html http://www.velocityreviews.com/forums/(E-Mail Removed):/var/www/gforge-projects/aeditor/buffer2/."
end
--Boundary-00=_nkHXB4NMh0US1tZ--
--Boundary-00=_nkHXB4NMh0US1tZ--


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Flex source for parsing files with multiline comments Uwe Ziegenhagen C++ 5 01-27-2010 01:09 AM
Comments in Redcloth Trans Ruby 4 12-11-2007 12:58 PM
Re: Case Sensitive, Multiline Comments Philippe C. Martin Python 0 05-26-2005 08:09 PM
how to define a variable to hold a multiline text input in perl from html multiline textbox dale zhang Perl Misc 8 11-30-2004 06:53 AM
Re: Stripping multiline C comments without using Lex Stephane CHAZELAS C Programming 3 02-05-2004 01:42 PM



Advertisments