Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    christian lambert
    @skirando_gitlab
    Bonjour,
    j'utilise weasyprint et je voudrais mettre un contenu dans le bottom_right d'une page - @page {
    @bottom-right {
    content: string(heading) " page " counter(page) "categorie : " string(heading2) ;
    position: absolute;
    z-index: -1;
    }
    le heading2 provient d'une classe .catnum{ string-set : heading2 content(),} cet élément figure dans ma page html mais je ne veux pas qu'il apparaisse dans la page mais uniquement dans le bas de page.
    christian lambert
    @skirando_gitlab
    dÚs que j'utilise hidden = true dans la page html ou display : None dans le css, l'élément n'apparait plus dans le bas de page. Y a-t-il une solution élégante pour résoudre ce problÚme. Par ailleurs, il est écrit que l'attribut string-set est obsolÚte. Y a-t-il un autre attribut. Merci pour votre éclairage. Cordialement C. Lambert
    Guillaume Ayoub
    @liZe
    Bonjour @skirando_gitlab
    christian lambert
    @skirando_gitlab
    Bonjour
    Guillaume Ayoub
    @liZe
    Pour le problĂšme de display: None qui fait que l’élĂ©ment n’apparaĂźt plus, c’est en effet un bug : Kozea/WeasyPrint#473
    Pour string-set qui est obsolĂšte, je crois que j’ai dĂ©jĂ  entendu cette histoire
 Je ne crois pas que ce soit obsolĂšte, c’est toujours dans le dernier brouillon de la spĂ©cification sans mention particuliĂšre https://drafts.csswg.org/css-content-3/#string-set
    OĂč est-ce qu’il est marquĂ© que la propriĂ©tĂ© est obsolĂšte ?
    christian lambert
    @skirando_gitlab
    dans l'exemple du bug , je ne comprends pas ce qu'est weasy-string-set
    et si on utilise la propriĂ©tĂ© hidden = True dans le html, cela fait la mĂȘme chose
    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