Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS or HTML solution for dot leaders #770

Open
benjibee opened this issue Jan 22, 2014 · 7 comments
Open

CSS or HTML solution for dot leaders #770

benjibee opened this issue Jan 22, 2014 · 7 comments

Comments

@benjibee
Copy link

Dot leaders are most mostly used in print for restaurant menus or table of content listings. From what I gather, both of these are commonly distributed as PDFs, and very often auto-generated by software such as dompdf.

The W3C has had a draft spec on this function for about a decade, but seem to be dragging their feet about any actual implementation. Though, they do provide some examples of workarounds.

Also, this A List Apart article talks about this very feature using Prince, who actually seem to have gone ahead and made their own function years ago.

Using the following code produces great results for the web, across all browsers and mobile, even for my email template, but not luck so far with dompdf. I'm guessing most of the trouble is with the current float support.

        ul.leaders {
            max-width: 30em;
            padding: 0;
            overflow-x: hidden;
            list-style: none
        }
        ul.leaders li:after {
            float: left;
            width: 0;
            white-space: nowrap;
            content: ". . . . . . . . . . . . . . . . . . . . "
                     ". . . . . . . . . . . . . . . . . . . . "
                     ". . . . . . . . . . . . . . . . . . . . "
                     ". . . . . . . . . . . . . . . . . . . . "
        }
        ul.leaders span:first-child {
            padding-right: 0.33em;
            background: white
        }
        ul.leaders span + span {
            float: right;
            padding-left: 0.33em;
            background: white;
            position: relative;
            z-index: 1
        }
        .seperator:after {
            content: "" !important;
        }

Below are two examples of the different results of this code:

Web screenshot of dot leaders per W3C example

Screenshot of dot leaders per W3C example in Chrome

*Screenshot of same code, rendered by dompdf

Screenshot of same code, rendered by dompdf

Any recommendations on how this could be achieved would be very much appreciated!

@benjibee
Copy link
Author

Any chance of this being implemented? Still haven't found a workable solution!

@bsweeney
Copy link
Member

I think we'll definitely implement this. We just need to get to a point where we can ramp back up development. As you may have noticed things have been a little slow lately.

@benjibee
Copy link
Author

Thanks for getting back, and sorry for being a bother. I would love to help out with development but sadly this is beyond my skills.

If you need any testing done for implementing this, please let me know!

@bsweeney
Copy link
Member

I know it's hard to wait; we appreciate everyone's patience. You'll get a heads-up via the issue when we start working on it.

@BillTheGoat
Copy link

This can be done using an alternative css model. Tested in v0.7.0. Try:

<ul class="leaders">
<li><span class="title">title</span><span class="nums">#</span></li>
<ul>
ul.leaders{list-style: none;width:100%;display:block;}

ul.leaders li { 
display:block;
clear:both;
}

ul.leaders li span.title {
    display: inline-block;
        position: absolute;
    background-color:#fff !important;
        left: 50pt;
    padding: 0 .4em 0 0;
    margin: 0;
}
ul.leaders li span.nums {
    text-align:right;
    overflow:hidden;
    display: inline-block;
        position: absolute;
        right: 50pt;
    background-color:#fff !important;
    padding: 0 0 0 .4em;
    margin: 0;
}

ul.leaders li:after {
    content: "  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  ";
    display: inline-block;
    white-space:pre;
    overflow: hidden;
}

I just can't actually get white-space:pre to work.

@bsweeney bsweeney added this to the 0.7.2 milestone Nov 14, 2016
@bsweeney bsweeney modified the milestone: 0.8.1 May 21, 2017
@willemstuursma
Copy link

Would also be very interested in support for leaders.

@benjibee
Copy link
Author

It's been about four years, and I don't even work at the company where I built this app anymore, and I may never need to do this again. That being said… I'm still curious about this being implemented 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants