customization of -dump and css

Enrico Segre <[email protected]> Wed, 10 Apr 2013 18:35:57 +0300
Newsgroups gmane.comp.web.elinks.user
Message-ID <[email protected]>
--===============2147252073==
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html style=3D"direction: ltr;">
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUTF=
-8">
    <style type=3D"text/css">body p { margin-bottom: 0cm; margin-top: 0pt=
; } </style>
  </head>
  <body style=3D"direction: ltr;"
    bidimailui-detected-decoding-type=3D"UTF-8" text=3D"#000000"
    bgcolor=3D"#FFFFFF">
    I'm evaluating elinks as a candidate component for a toolchain in
    which I have to translate html to plain text, obeying some
    housestyle rules. [Namely, in the production of ebooks for Project
    Gutenberg]. For instance, I have to render all
    &lt;strong&gt;tags&lt;/strong&gt; into *tags*, to add four blank
    lines before any &lt;h2&gt; and two after, white-space indentations
    in some places, changing &lt;span dir=3D"rtl"&gt;&lt;/span&gt; with
    unicode directionals, and so on.<br>
    <br>
    Elinks provides me a with much better solution than other
    html-to-text tools (I've assessed w3m, links2, lynx, html2text.py,
    netrik), because it honors to some extent the css. However, I have
    some questions about what is supported and what not, and to which
    extent renderings could be customized, if possible without hacking
    the source code.<br>
    <br>
    Some of the transformations I need to do toward the required text
    rendering, could in fact be done by preliminary regexp substitutions
    in the source html, and/or subsequent substitutions in the result.
    However, the toolchain would be a lot more streamlined if I could
    add some lines to my css, and let elinks work. For instance, <br>
    <br>
    =C2=A0=C2=A0=C2=A0 strong:before { content: '*'; }<br>
    =C2=A0=C2=A0=C2=A0 strong:after { content: '*'; }<br>
    <br>
    would take care of what exemplified above.<br>
    <br>
    I'm typically using elinks 0.12pre5 with<br>
    <br>
    =C2=A0=C2=A0=C2=A0 elinks -dump-width 80 -no-numbering -no-references=
 -dump 1
    $1.html &gt; $1.txt<br>
    <br>
    The first batch of questions which comes up is:<br>
    <br>
    -are :strong and :after css selectors honored? [not as I can see;
    could they?]<br>
    <br>
    -are margin, padding and text-indent properties honored in some way,
    by adding an appropriate number of blanks? [ditto]<br>
    <br>
    -why -dump produces a text with 4 blanks at the beginning of each
    line, and can this be changed?<br>
    <br>
    -how can I change the number of blank lines before and after
    &lt;h1&gt;,&lt;h2&gt;,...,?<br>
    <br>
    -when elinks dumps, is it using a particular @media selector?<br>
    <br>
    -Is the unstable snapshot more advanced in any respect relevant to
    me?<br>
    <br>
    Thanks in advance for any hint and for providing this nice piece of
    software.<br>
    <br>
    Enrico<br>
  </body>
</html>

--===============2147252073==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users

--===============2147252073==--