auto-rst error? need more robust?

19 views
Skip to first unread message

HaveF

unread,
May 18, 2013, 4:50:12 AM5/18/13
to Leo-editor-googlegroup
Hi, 

When I use auto-rst import rst file, sometimes, the author write extra characters 
which aren't harm, but the leo says it is a error...like this one:

reading: @auto-rst README

Error: @auto did not import @auto-rst README perfectly
The clean-all-lines command may help fix whitespace problems
first mismatched line: 20 (original) = 20 (imported)

Original file...

  18 u'how the learning experiment went.\n'
  19 u'Step 1: Create the dataset\n'
  20 u'----------------------------\n'
  21 u'From this directory, run\n'
  22 u'python make_dataset.py\n'

Imported file...

  18 u'how the learning experiment went.\n'
  19 u'Step 1: Create the dataset\n'
  20 u'--------------------------\n'
  21 u'From this directory, run\n'
  22 u'python make_dataset.py\n'

inserting @ignore

errors inhibited read @auto D:\OpenCourses\ufldl\ref\pylearn2\pylearn2\scripts\tutorials\grbm_smd\README

reading entire file into @auto node.

reading: @edit README

finished


The problem is the line 20 has two extra '-', when I remove it manually,
the import works.

Do you have a better idea to do this than do it manually?

Thanks!

--
--
Sincerely,

HaveF

Terry Brown

unread,
May 18, 2013, 7:48:34 AM5/18/13
to leo-e...@googlegroups.com
On Sat, 18 May 2013 16:50:12 +0800
HaveF <iamap...@gmail.com> wrote:

> Original file...
>
> 18 u'how the learning experiment went.\n'
> 19 u'Step 1: Create the dataset\n'
> 20 u'----------------------------\n'
> 21 u'From this directory, run\n'
> 22 u'python make_dataset.py\n'

At first I thought that the rst was invalid, but the docs. say
The underline/overline must be at
least as long as the title text.
http://docutils.sourceforge.net/docs/user/rst/quickref.html#section-structure
so I guess it's not. But leo has nowhere to store the length of the
underlining. Also, this is related to the issue where Leo changes the
underline characters used, e.g. = -> - and * -> # etc.

I think the easiest solution is going to be to do the import and just
remove the @ignore afterwards, checking that there are no changes that
matter. Perhaps the wording of the @ignore message could make it
clearer that the import may not have failed, but just needs checking.

Cheers -Terry

HaveF

unread,
May 19, 2013, 1:07:56 AM5/19/13
to leo-e...@googlegroups.com
On Saturday, May 18, 2013 7:48:34 PM UTC+8, Terry wrote:
At first I thought that the rst was invalid, but the docs. say 
  The underline/overline must be at
  least as long as the title text.
http://docutils.sourceforge.net/docs/user/rst/quickref.html#section-structure
so I guess it's not.  But leo has nowhere to store the length of the
underlining.  Also, this is related to the issue where Leo changes the
underline characters used, e.g. = -> - and * -> # etc.
Hi, Terry, thanks for your explanations :-)


I think the easiest solution is going to be to do the import and just
remove the @ignore afterwards, checking that there are no changes that
matter.  Perhaps the wording of the @ignore message could make it
clearer that the import may not have failed, but just needs checking.
But in fact, the @auto-rst load this rst file like @auto, no @ignore node at all.

My import procedure is like this:
1. make a node name:
@auto-rst models.txt
2. right click it, and select "refresh from disk"


And I just find another problem...
If the rst file like this:

MLP
===

It also occurs error:

reading: @auto-rst models.txt

Error: @auto did not import @auto-rst models.txt perfectly


The clean-all-lines command may help fix whitespace problems

first mismatched line: 10 (original) = 10 (imported)

Original file...

   8 u'    :members:\n'
   9 u'MLP\n'
  10 u'===\n'
  11 u'.. automodule:: pylearn2.models.mlp\n'
  12 u'    :members:\n'

Imported file...

   8 u'    :members:\n'
   9 u'MLP\n'
  10 u'====\n'
  11 u'.. automodule:: pylearn2.models.mlp\n'
  12 u'    :members:\n'

inserting @ignore

errors inhibited read @auto D:\OpenCourses\ufldl\ref\pylearn2\doc\library\models.txt

reading entire file into @auto node.

reading: @edit models.txt

finished


It says I need a extra "="...

I have attached this file, for someone has interest to reproduce the error.
models.txt

Edward K. Ream

unread,
May 20, 2013, 3:44:01 PM5/20/13
to leo-editor
On Sat, May 18, 2013 at 6:48 AM, Terry Brown <terry_...@yahoo.com> wrote:

> I think the easiest solution is going to be to do the import and just remove the @ignore afterwards, checking that there are no changes that matter.

I agree.  I'll look into the file that HaveF sent to see if there are other issues.

>  Perhaps the wording of the @ignore message could make it clearer that the import may not have failed, but just needs checking.

Yes.  I've marked this thread as containing a bug, which theoretically means I'll eventually get around to fixing it.  Having said that, the checking logic for imports is insanely complicated, which is far from the same thing as insanely great ;-)  The code is already to complicated to truly understand, and adding more special cases will only make matters worse.  Perhaps a rewrite is in order, but that's not going to be easy.

Edward
Reply all
Reply to author
Forward
0 new messages