Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Guillaume Ayoub
    @liZe
    -weasy-string-set, c’est le nom préfixé de string-set, c’est pareil que string-set
    Et hidden=True fait très exactement la même chose que display: none 😁 https://github.com/Kozea/WeasyPrint/blob/master/weasyprint/css/html5_ua.css#L16
    (Si jamais vous avez envie d’en savoir plus sur les préfixes, et sur pourquoi on ne les utilise plus : https://developer.mozilla.org/fr/docs/Glossary/Vendor_Prefix)
    christian lambert
    @skirando_gitlab
    Pour le string-set, j'ai trouvé cela dans la page suivante : https://www.cssportal.com/css-properties/string-set.php. String_set ne se trouve pas dans le developer.mozilla.org/fr/docs
    Guillaume Ayoub
    @liZe
    Hum… De toute évidence, la phrase de CSS Portal est fausse, puisque la propriété est bien dans la spécification Generated Content
    Et il y a pas mal de propriétés spéciales pour le print qui ne sont pas sur MDN 😒
    christian lambert
    @skirando_gitlab
    j'ai regardé les turn-around proposés et je n'en trouve pas qui réponde vraiment à mon besoin . J'ai essayé de créer une variable dans le html <style>
    --catnum : {{catnum}}
    </style>
    J'utilise la variable dans le css @page {
    @bottom-right {
    content: string(heading) " page " counter(page) "categorie : " string(var(--catnum)) ;
    position: absolute;
    z-index: -1;mais cela ne marche pas
    Guillaume Ayoub
    @liZe
    La solution la plus simple est sans doute d’utiliser la solution que vous vouliez utiliser avant, mais d’utiliser autre chose que display: None pour cacher l’élément
    Avec un position: absolute; top: -1000px ou quelque chose équivalent, ça devrait fonctionner
    christian lambert
    @skirando_gitlab
    Je ne suis un profane de HTML/CSS et je ne vois pas comment je peux "cacher" une variable dans la page HTML qui ne sera mise dans le document et que l'on peut récupérer dans le css.
    Votre proposition consiste à le mettre en dehors du champ d'impression ?
    Guillaume Ayoub
    @liZe
    Oui, c’est ça
    christian lambert
    @skirando_gitlab
    j'essaie
    Guillaume Ayoub
    @liZe
    Ce n’est pas très élégant, mais c’est sans doute le plus simple en attendant d’avoir une correction pour le bug
    christian lambert
    @skirando_gitlab
    si je le mets dans un div entête du body, il génère une page supplémentaire <div class="catnum"> {{catnum}} </div< et .catnum{
    position : absolute;
    top: -1000px;
    string-set: heading2 content();
    } et @page {
    @bottom-right {
    content: string(heading) " page " counter(page) "categorie : " string(heading2) ;
    position: absolute;
    z-index: -1;
    }
    }
    Guillaume Ayoub
    @liZe
    Il me faudrait le document entier pour comprendre le problème, c’est compliqué avec juste un petit bout de code :/
    christian lambert
    @skirando_gitlab
    En fait cela marche, il restait un caractère parasite dans le css qui faisait qu'il n'était pas pris en compte. Merci beaucoup pour votre aide
    C. Lambert
    Guillaume Ayoub
    @liZe
    Parfait ! :)
    Bonne journée !
    Guillaume Ayoub
    @liZe
    WeasyPrint v54.0 has been released: https://www.courtbouillon.org/blog/00020-footnotes
    Release notes are available here: https://github.com/Kozea/WeasyPrint/releases/tag/v54.0
    Simon
    @simon:delire.party
    [m]
    Hi all. I’m starting a new (small) python project but it’s been years since I’ve done that. What are you favorite tools for basic tasks these days? Things like dependency management (poetry?), testing (pytest?), …
    Guillaume Ayoub
    @liZe
    Hi @simon:delire.party
    Here’s what we use for our new projects:
    • a pyproject.toml using Flit for dependencies management (you can use flit init)
    • a simple python -m venv to create the virtual environment, and venv/bin/pip install -e . to install the package
    • pytest for tests
    Guillaume Ayoub
    @liZe
    I personally like poetry, even if I don’t find it really useful for my use cases, and I personally don’t like pipenv that’s a bit bloated for my taste
    Simon Sapin
    @simon:delire.party
    [m]
    thanks!
    dmoonfire
    @dmoonfire:matrix.org
    [m]
    Since I'm cross language, I end up using asdf or Nix instead for my projects.
    Marko Sandalj
    @msandalj:matrix.org
    [m]

    Hi everyone,

    For the past couple of days I have been trying to implement weasyprint into my Django application and the setup was quit (w)easy and I was soon able to print pdfs but since my pages are full of math equations we use MathJax to convert them to SVGs but once I send markup to backend for printing I get empty spaces instead of equations. I have now spent countless hours trying to figure out how to fix that. That lead me to this Github thread (Kozea/WeasyPrint#59) where I learned that there is this thing called Pandoc that should, with Weasyprint, be able to do what I need but after another session of reading and researching I still don't understand how to get everything to work. And that brings me here, is there anyone who also tried to print HTML with math equations and if yes how have you done it? If no, is there anyone who can try and help me set this up, if its even possible to do it.

    Note that I'm junior developer and some things are still hard to grasp for me.

    Marko Sandalj
    @msandalj:matrix.org
    [m]

    :point_up: Edit: Hi everyone,

    For the past couple of days I have been trying to implement weasyprint into my Django application and the setup was quite (w)easy and I was soon able to print pdfs but since my pages are full of math equations we use MathJax to convert them to SVGs but once I send markup to backend for printing I get empty spaces instead of equations. I have now spent countless hours trying to figure out how to fix that. That lead me to this Github thread (Kozea/WeasyPrint#59) where I learned that there is this thing called Pandoc that should, with Weasyprint, be able to do what I need but after another session of reading and researching I still don't understand how to get everything to work. And that brings me here, is there anyone who also tried to print HTML with math equations and if yes how have you done it? If no, is there anyone who can try and help me set this up, if its even possible to do it.

    Note that I'm junior developer and some things are still hard to grasp for me.

    Guillaume Ayoub
    @liZe
    @msandalj:matrix.org Hi!
    Maybe there’s a solution to get MathJax’ SVG output working with WeasyPrint
    Could you please provide a simple HTML sample that gives an empty space instead of the math formula?
    Marko Sandalj
    @msandalj:matrix.org
    [m]
    Here it is, I stripped everything unnecessary from the file so its more readable
    It is still quite messy since SVGs are inlined
    I'm passing that HTML as a string to the weasyprint html function
    Guillaume Ayoub
    @liZe
    The problem probably comes from a current limitation of WeasyPrint
    CSS is not really applied to SVG when the stylesheet is in the HTML and the SVG is embedded
    It would work if the properties were set on the SVG tags, or (maybe?) if the CSS was embedded in the SVG tag
    Marko Sandalj
    @msandalj:matrix.org
    [m]
    Hmmm, equations should show even if you remove whole style tag. As far as I understand the only thing necessary for equations is the last SVG tag (id="MJX-SVG-global-cache")
    Guillaume Ayoub
    @liZe
    It’s a bit late here and I’m going to sleep, but I’ll spend some time to read your example
    Marko Sandalj
    @msandalj:matrix.org
    [m]
    Of course, thank you!
    Guillaume Ayoub
    @liZe
    See you later!
    Guillaume Ayoub
    @liZe
    Capture d’écran de 2022-01-26 10-11-03.png
    The problem is that formulas reference elements that are in another svg
    Guillaume Ayoub
    @liZe
    Currently, WeasyPrint renders SVG tags independently, and each SVG is separated from the other ones
    I had to copy the defs tag at the end of the HTML into each svg tag to get this rendering
    We should definitely have a better implementation, we know that, there’s no need to open a new issue 😀