Re: lyx2lyx/* small woes

2023-08-19 Thread Scott Kostyshak
On Sat, Aug 19, 2023 at 09:55:13PM -0400, Scott Kostyshak wrote:
> On Sat, Aug 19, 2023 at 09:05:34PM +0100, José Matos wrote:
> > On Sat, 2023-08-19 at 12:40 -0400, Scott Kostyshak wrote:
> > > On Sat, Aug 19, 2023 at 05:05:36PM +0100, José Matos wrote:
> > > 
> > > The changes look simple so I would say go ahead for master branch.
> > > There is still no freeze for it anyway.
> > > 
> > > Scott
> > 
> > Could you do it, please?
> 
> Yes, in master at 65f8c080.

Hash correction: 677dc3b7.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: lyx2lyx/* small woes

2023-08-19 Thread Scott Kostyshak
On Sat, Aug 19, 2023 at 09:05:34PM +0100, José Matos wrote:
> On Sat, 2023-08-19 at 12:40 -0400, Scott Kostyshak wrote:
> > On Sat, Aug 19, 2023 at 05:05:36PM +0100, José Matos wrote:
> > 
> > The changes look simple so I would say go ahead for master branch.
> > There is still no freeze for it anyway.
> > 
> > Scott
> 
> Could you do it, please?

Yes, in master at 65f8c080.

> The ssh server from our server is old and I am unable to connect even
> by enabling legacy mode. I tried this several times in the last two
> years with the help of Riki and I have never succeeded.
> 
> More and more other services have been increasing the requirements for
> security and so the LyX server is the only where I have problems. :-(

Ah I forgot about that. Sorry for the annoyance.

> On a related note to this issue:
> 
> 1) There is another batch of easy fixes that deal with the removal of
> variables that are defined but never used. There are several examples
> like this on the lyx2lyx directory.

I guess the hard part is figuring out whether they are not used because
of a typo?
 
> 2) FWIW at some point, after the release of 2.4, I would like to
> modernize the python code in order to remove the compatibility with
> python 2.
> 
> That compatibility is not only moot as it is a nuisance. One of the
> easiest examples is the need that we have now to prefix all text
> strings with u (for unicode).
> 
> The same applies to use typing to annotate functions and take advantage
> of static analysers to ensure the correctness of code.
> 
> The questions is to decide what is the best timing for this operation.
> Could it be after 2.4.1 release?

I don't have a feeling for which is best.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Is loading inputenc with two encodings a bug?

2023-08-19 Thread Udicoudco
On Sun, Aug 20, 2023 at 12:52 AM Udicoudco  wrote:
>
>
> Should the second input encoding be changed from latin9 to utf8,
> now that utf8 is the default encoding?
>
or are we separating traditional and unicode encoding
entirely?
> > --
> > lyx-devel mailing list
> > lyx-devel@lists.lyx.org
> > http://lists.lyx.org/mailman/listinfo/lyx-devel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Is loading inputenc with two encodings a bug?

2023-08-19 Thread Udicoudco
On Sat, Dec 17, 2022 at 10:44 AM Jürgen Spitzmüller  wrote:
>
> Am Freitag, dem 16.12.2022 um 10:32 -0500 schrieb Scott Kostyshak:
> > Attached is a .lyx file that produces the following code when
> > exported
> > with LaTeX (pdflatex):
> >
> >   \usepackage[latin9,cp1255]{inputenc}
> >
> > Ulrike Fisher points out the following [1]:
> >
> >   \usepackage[latin9,cp1255]{inputenc} doesn't make any sense, your
> >   files can't have two encodings at the same time.
> >
> > Should I make a trac ticket for this?
>
> Yes. Of course a file can have multiple encodings, and encodings can be
> switch via \inputencoding with a file. The inputenc package, however,
> only expects one option. It sets the latter to the inputencoding at at
> package loading time, which is cp1255 here.

Should the second input encoding be changed from latin9 to utf8,
now that utf8 is the default encoding?

I mean the encoding used in the command \inputencoding,
not the option of the package.

> --
> lyx-devel mailing list
> lyx-devel@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: lyx2lyx/* small woes

2023-08-19 Thread José Matos
On Sat, 2023-08-19 at 12:40 -0400, Scott Kostyshak wrote:
> On Sat, Aug 19, 2023 at 05:05:36PM +0100, José Matos wrote:
> 
> The changes look simple so I would say go ahead for master branch.
> There is still no freeze for it anyway.
> 
> Scott

Could you do it, please?

The ssh server from our server is old and I am unable to connect even
by enabling legacy mode. I tried this several times in the last two
years with the help of Riki and I have never succeeded.

More and more other services have been increasing the requirements for
security and so the LyX server is the only where I have problems. :-(


On a related note to this issue:

1) There is another batch of easy fixes that deal with the removal of
variables that are defined but never used. There are several examples
like this on the lyx2lyx directory.


2) FWIW at some point, after the release of 2.4, I would like to
modernize the python code in order to remove the compatibility with
python 2.

That compatibility is not only moot as it is a nuisance. One of the
easiest examples is the need that we have now to prefix all text
strings with u (for unicode).

The same applies to use typing to annotate functions and take advantage
of static analysers to ensure the correctness of code.

The questions is to decide what is the best timing for this operation.
Could it be after 2.4.1 release?

Best regards,
-- 
José Abílio
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: lyx2lyx/* small woes

2023-08-19 Thread Scott Kostyshak
On Sat, Aug 19, 2023 at 05:05:36PM +0100, José Matos wrote:

The changes look simple so I would say go ahead for master branch. There is 
still no freeze for it anyway.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


lyx2lyx/* small woes

2023-08-19 Thread José Matos
Hi,  
I noticed "en passant" (French) that there are some small glitches in the `lyx2lyx directory:

In `lyx2lyx/lyx2lyx_tools.py`:

Functions `length_in_bp` and `revert_flex_inset` have an error in a (almost) never used path. The reason why this was never triggered is because this is part of the code where we try all the best efforts to recover from an ill-formed LyX file.

The problem is that the functions call the `document` variable to issue an warning if the file does not follow the usual structure. The simple fix is to add that variable (as the first for the functions) and to add them at all the places where the functions are called.

For reference this code was introduced by Georg (Baum) more than 8 years ago and it was never reported. So the issue is not urgent in any meaningful way. :-)

In `lyx2lyx/lyx_2_0.py`, in the function `revert_nameref`, there is a call to the document variable. The same as all the above.

In `lyx2lyx/lyx_2_4.py`, in the `class fontmapping`. Similar to the above but now for error.

At the same file in the function `revert_timeinfo` in the line 1427 there is a variable being called `dte`, looking to the inverse function I suspect that `dte`  us supposed to be `date.today()` (or similar). @Jürgen could you please see this issue since this seems to be your code from 2018? :-)

I took the change to fix other bugs that are more immediate. The patch follows attached. In particular the part from the code from lyx_1_2.py was committed by me in December of 2004. :-o


I will be unavailable until almost the end of August and thus I wanted to raise this. When I return I can look into this, following the recipe given above. Again I want to stress that this is mostly for correctness sake since in practice the code will not be even run for any well formed LyX file.

Best regards,
```
-- 
José Abílio

```

diff --git a/lib/lyx2lyx/lyx_1_2.py b/lib/lyx2lyx/lyx_1_2.py
index ae082a73fc..e091b3b1e9 100644
--- a/lib/lyx2lyx/lyx_1_2.py
+++ b/lib/lyx2lyx/lyx_1_2.py
@@ -745,8 +745,8 @@ def update_longtables(document):
 for j in range(rows):
 i = find_token(body, ' end:
-document.warning("Can't find end of inset at line " + str(nb))
+document.warning("Can't find end of inset at line " + str(ne))
 ns += 1
 continue
   if document.body[ne + 1] == "":
diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py
index 69b2abac83..5e330ed79e 100644
--- a/lib/lyx2lyx/lyx_2_3.py
+++ b/lib/lyx2lyx/lyx_2_3.py
@@ -1427,7 +1427,7 @@ def revert_multibib(document):
 }
 
 if multibib not in units.keys():
-document.warning("Unknown multibib value `%s'!" % nultibib)
+document.warning("Unknown multibib value `%s'!" % multibib)
 return
 unit = units[multibib]
 btunit = False
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Contribution License

2023-08-19 Thread d3vf4n
I hereby licence all my contributions to LyX under the GNU General Public 
Licence version 2 or later.


Daniel.
--
Enviat amb Tutanota.
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel