5 new importers are ready for testing

2016-11-23 Thread Edward K. Ream
Today I added importers for dart, html/xml, .ini files and org-mode.

Each importer is covered by unit tests, some for the very first time. The 
unit tests are typically substantially more rigorous than previously.

As always, bugs could remain.  Please report any problems immediately.

Converting a new importer is taking 2 to 3 hours.  All new importers are 
simpler than the old importers, some drastically simpler.

The new importers deal almost exclusively with the language being imported, 
not with idiosyncrasies of the underlying infrastructure. This should 
greatly aid the task of future maintainers.

7 importers remain to be converted.  Expect that to take 2 or three more 
days.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


A short test that creates unit-testing tables

2016-11-23 Thread Edward K. Ream
The present generation of unit tests not only verify perfect import, but 
ensure that the outline has expected structure, more or less.

The outline of such tests is:

s = r'''
The input, maybe many lines.
'''
table = ( a list of expected headlines )
try:
c.importCommands.coffeeScriptUnitTest(p,s=s,showTree=True)
if 1: # Verify that the test produces the expected headlines.
  p2 = c.p.firstChild().firstChild()
  for h in table:
  assert p2.h == h, (p2.h, h)
  p2.moveToThreadNext()
finally:
if 1: # clean up
p.deleteAllChildren()

If the test produces a large outline, it would be unbearable to create the 
table by hand.  Instead, I used the following, now in scripts.leo:

@button make-table
'''
Create a table of expected headlines in a unit test.
After running this, copy the table from the console.
'''
g.cls()
# Proper escapes are tricky.
table = [
'"%s",' % p.h.replace('\\', '').replace('"', '\\"')
for p in c.p.subtree()
]
print("table = (\n%s\n)" % '\n'.join(table))

Python's string capabilities are yet another reason to love python. Much 
better than snobol or icon, two old languages that were supposedly geared 
to pattern matching and substitution.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Important: the new xml and html importers *regularize* indentation

2016-11-23 Thread Edward K. Ream
On Wed, Nov 23, 2016 at 2:00 AM, Edward K. Ream  wrote:

> As of 97ee17d, the new importers for xml and html are now functional.  All
> unit tests pass.
>
> These importers embody a major change in attitude.  Please read
> carefully.  All comments welcome.
>

​That was a middle of the night post.​


​On further reflection, I think adding @ignore directives is proper. There
is no need for additional dialogs.

Regularizing whitespace for xml, html is also reasonable.

xml and html are outliers because they have neither *explicit* brackets nor
strict indentation rules.  So, for *these two languages only*, I think it
makes sense to regularize the leading whitespace by brute force, as
xml_i.undent does.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Thanks for Edward K. Ream's hard work

2016-11-23 Thread Kent Tenney
Talk about a win-win!

On Mon, Nov 21, 2016 at 8:35 PM, Edward K. Ream  wrote:

> On Monday, November 21, 2016 at 6:25:10 PM UTC-6, zhaohe wang wrote:
>
> I run "git pull" when opening shell every day!  This is a habit now.
>>
>
> Ha.  Glad to hear it :-)
>
>
>> Thanks for Edward K. Ream's free hard work!
>> Many people use leo-editor, so you develop a good IDE for us.
>> Thanks again!
>>
>
> You're welcome.  It is a great privilege for me to do what I truly love in
> life.
>
> Edward
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Important: the new xml and html importers *regularize* indentation

2016-11-23 Thread Edward K. Ream
As of 97ee17d, the new importers for xml and html are now functional.  All 
unit tests pass.

These importers embody a major change in attitude.  Please read carefully.  
All comments welcome.

The perfect import checks in i.check now compare leading whitespace (lws) 
only for *strict *languages.  Iirc, python and coffeescript are the only 
strict languages.

As a result, *importers are allowed to regularize lws.* The overridden 
xlm_i.undent does just that. It's simple and easy to understand. For the 
first time *ever*, it's easy to explain how indentation works, at least for 
xml and html ;-)

The code generators will properly indent all xml/html tags mentioned in 
@data import_xml_tags or @data import_html_tags. This would be a good to do 
for javascript also.
  
So now @auto can change the imported files *without* inserting @ignore.

*Important*: @auto no longer marks files dirty, so even without @ignore you 
have to actively change the file before it will actually be written to the 
file system. If you do choose to write the file, git will always show you 
what changes were made. If you don't like them, you can just revert the 
file and insert @ignore yourself!

To complete the picture, Leo should raise a *single *dialog warning about 
@auto files that would be  changed if they were saved. That will happen 
soon.

Edward

P.S. I've just posted the code for xml_i.undent at the end #334 
. Hit Ctrl-End :-)

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.