Re: How to achieve a simple element with LyXHTML

2022-07-11 Thread Lorenzo Bertini

Il 11/07/22 09:24, Steve Litt ha scritto:

Lorenzo Bertini said on Mon, 11 Jul 2022 04:01:06 +0200



[About the idea of a compilation shellscript, Lorenzo said...]


A solution of this kind could work well, but remove the thing that
makes LyX so convenient: one click compile and show.


I can't speak for Windows, but in Linux I use shellscripts to compile
all my books, and it works perfectly. I just run the shellscript and it
runs lualatex, and watermarks my PDF. It could just as easily run a
postprocessor. If I wanted to make it "one click", I'd just assign it
an icon on my desktop.


I'm on linux too, but what i meant was that sometimes it's nice to only 
have to use the "eyes" button in the top right.




I hear Windows has Powerscript now.


We really need a
robust LyXHTML output, and I don't think it's that far away.

Right now the devs lack the manpower to tackle LyXHTML problems fully,
but I believe it's also a matter of demand. It's nice to see there are
people on lyx-users asking about it.


If manpower's so short and it's moving so slowly, perhaps we should just
fix things post-conversion. I have about 3 hours a week to devote to it,
and I'm pretty conversant with the xml.etree.ElementTree XML parser for
Python. It sounds like you know what should go in an HTML/ePub
document. If we get a couple more people with Python and document
expertise, we could fix this, as long as the LyX->HTML export remains
well-formed XML.

I bet maybe four of us could get this done in 3 months, no C++ required.

SteveT

Steve Litt
Summer 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm


Sorry, but I would much prefer to just work on the code, this seems to 
me not necessarily easier than fixing LyX directly, which would be the 
preferred solution in the long run.


Lorenzo
--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: How to achieve a simple element with LyXHTML

2022-07-11 Thread Steve Litt
Lorenzo Bertini said on Mon, 11 Jul 2022 04:01:06 +0200



[About the idea of a compilation shellscript, Lorenzo said...]

>A solution of this kind could work well, but remove the thing that
>makes LyX so convenient: one click compile and show. 

I can't speak for Windows, but in Linux I use shellscripts to compile
all my books, and it works perfectly. I just run the shellscript and it
runs lualatex, and watermarks my PDF. It could just as easily run a
postprocessor. If I wanted to make it "one click", I'd just assign it
an icon on my desktop. 

I hear Windows has Powerscript now.

> We really need a
>robust LyXHTML output, and I don't think it's that far away.
>
>Right now the devs lack the manpower to tackle LyXHTML problems fully, 
>but I believe it's also a matter of demand. It's nice to see there are 
>people on lyx-users asking about it.

If manpower's so short and it's moving so slowly, perhaps we should just
fix things post-conversion. I have about 3 hours a week to devote to it,
and I'm pretty conversant with the xml.etree.ElementTree XML parser for
Python. It sounds like you know what should go in an HTML/ePub
document. If we get a couple more people with Python and document
expertise, we could fix this, as long as the LyX->HTML export remains
well-formed XML.

I bet maybe four of us could get this done in 3 months, no C++ required.

SteveT

Steve Litt 
Summer 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: How to achieve a simple element with LyXHTML

2022-07-10 Thread Lorenzo Bertini

Il 11/07/22 00:11, Steve Litt ha scritto:

tush via lyx-users said on Sat, 09 Jul 2022 18:59:53 +


I am trying to remove the html attributes assigned by LyXHTML to the
Standard text inserted in the editor.

LyX's default is to render Standard as

This is text inserted in
Standard

together with

p.standard {

text-align: left;

}

appearing in the header.

What I want is to get the simple html code

This is text inserted in Standard
In order to do that I am writing my Style in a layout file. What I
have at the moment is the following:

(I copied the first rows from stdclass.inc)

Style Standard
Category  MainText
MarginStatic
LatexType Paragraph
LatexName dummy
ParIndent MM
ParSkip   0.4
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label

HTMLAttr " "

End


I think this exchange from lyx-devel will provide some explanation:

On 9/6/21 6:36 PM, Lorenzo Bertini wrote:

Hello list!

LyXHTML outputs standard paragraphs with  a ... (as is the
standard for many insets), but i would much prefer 

I know i can change the tag of other insets by going in the local
layout section of Document->Setting, and write something like

InsetLayout Foot
  HTMLTag p
End


but i cant find anything about the standard paragraph. I don't mean
the "sectioning" paragraph, that is mapped to "HTMLTag h5", but the
piece of text you get after pressing RET in LyX.


It's a paragraph layout: Standard. See stdclass.inc.

But yes, at the moment, that is hardcoded. The reason is that the tag
turns up inside other tags and nested 's are invalid. But it probably
should be made customizable.

RikiRemoval of this hardcoded stuff would require a bit of lyxhtml output 
rewrite, which should be under way right now. Unfortunately, I think 
it's just one dev working on it (Thibaut).




After a lot of trial and error, using the last line I eliminated the
"div class="standard"" from the p element but still LyX assigns to it
an id="some number" which I want to eliminate too.

Any idea about it would be very welcome.


If you're referring to the "magicparlabel", it's hardcoded. I was 
thinking about making a patch to remove it, but LyX relies on this 
"magic labels" to do a lot of the referencing (a quick glance at how the 
TOC is done will give you an idea). I am not that knowlodgeable about 
HTML referencing, so this will take some time.




Yeahh, this is one of the reasons I don't use LyX for ePub. Last
time I looked, LyX exports used the deprecated and now with HTML5
eliminated  inside a div specially made to contain
one . What could *possibly* go wrong?

If I had to eliminate these redundant  things, I'd do it
with a postprocessor that corrects LyX' complexifications. It's not
easy, but you can use Python with the "import xml.etree.ElementTree as
ET" library. You'd analyze every DOM element, and for every 
whose only purpose is to encase one , get rid of the div after
reading metadata from that  and any  silliness, applying
the information to attributes of the  itself.

Seriously, LyX has failed to export common sense XMLized HTML for 14
years now, and I doubt they ever will. Best you can hope for is to
either switch to another authoring program, or repair LyX' mistakes
post-export. I think trying to repair this stuff from within your LyX
document is walking the highway to heartache.

Also, the good thing about the XML-parsing Python post-processor
approach is that, as time goes on, you can fix any problems newly
discovered and/or newly added by LyX: You're in control as long as they
continue to export well-formed XML HTML, which of course isn't a
for-sure thing.

SteveT

Steve Litt
Summer 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm


A solution of this kind could work well, but remove the thing that makes 
LyX so convenient: one click compile and show. We really need a robust 
LyXHTML output, and I don't think it's that far away.


Right now the devs lack the manpower to tackle LyXHTML problems fully, 
but I believe it's also a matter of demand. It's nice to see there are 
people on lyx-users asking about it.


Lorenzo
--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: How to achieve a simple element with LyXHTML

2022-07-10 Thread Steve Litt
tush via lyx-users said on Sat, 09 Jul 2022 18:59:53 +

>I am trying to remove the html attributes assigned by LyXHTML to the
>Standard text inserted in the editor.
>
>LyX's default is to render Standard as
>
>This is text inserted in
>Standard
>
>together with
>
>p.standard {
>
>text-align: left;
>
>}
>
>appearing in the header.
>
>What I want is to get the simple html code
>
>This is text inserted in Standard
>In order to do that I am writing my Style in a layout file. What I
>have at the moment is the following:
>
>(I copied the first rows from stdclass.inc)
>
>Style Standard
>   Category  MainText
>   MarginStatic
>   LatexType Paragraph
>   LatexName dummy
>   ParIndent MM
>   ParSkip   0.4
>   Align Block
>   AlignPossible Block, Left, Right, Center
>   LabelType No_Label
>
>HTMLAttr " "
>
>End
>
>After a lot of trial and error, using the last line I eliminated the
>"div class="standard"" from the p element but still LyX assigns to it
>an id="some number" which I want to eliminate too.
>
>Any idea about it would be very welcome.

Yeahh, this is one of the reasons I don't use LyX for ePub. Last
time I looked, LyX exports used the deprecated and now with HTML5
eliminated  inside a div specially made to contain
one . What could *possibly* go wrong?

If I had to eliminate these redundant  things, I'd do it
with a postprocessor that corrects LyX' complexifications. It's not
easy, but you can use Python with the "import xml.etree.ElementTree as
ET" library. You'd analyze every DOM element, and for every 
whose only purpose is to encase one , get rid of the div after
reading metadata from that  and any  silliness, applying
the information to attributes of the  itself.

Seriously, LyX has failed to export common sense XMLized HTML for 14
years now, and I doubt they ever will. Best you can hope for is to
either switch to another authoring program, or repair LyX' mistakes
post-export. I think trying to repair this stuff from within your LyX
document is walking the highway to heartache.

Also, the good thing about the XML-parsing Python post-processor
approach is that, as time goes on, you can fix any problems newly
discovered and/or newly added by LyX: You're in control as long as they
continue to export well-formed XML HTML, which of course isn't a
for-sure thing.

SteveT

Steve Litt 
Summer 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


How to achieve a simple element with LyXHTML

2022-07-09 Thread tush via lyx-users
I am trying to remove the html attributes assigned by LyXHTML to the Standard 
text inserted in the editor.

LyX's default is to render Standard as

This is text inserted in 
Standard

together with

p.standard {

text-align: left;

}

appearing in the header.

What I want is to get the simple html code

This is text inserted in Standard
In order to do that I am writing my Style in a layout file. What I have at the 
moment is the following:

(I copied the first rows from stdclass.inc)

Style Standard
Category  MainText
MarginStatic
LatexType Paragraph
LatexName dummy
ParIndent MM
ParSkip   0.4
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label

HTMLAttr " "

End

After a lot of trial and error, using the last line I eliminated the "div 
class="standard"" from the p element but still LyX assigns to it an id="some 
number" which I want to eliminate too.

Any idea about it would be very welcome.-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users