Skip to content

Serve Badges from Read the Docs #2065

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

Closed
ghost opened this issue Mar 11, 2016 · 7 comments
Closed

Serve Badges from Read the Docs #2065

ghost opened this issue Mar 11, 2016 · 7 comments
Labels
Improvement Minor improvement to code

Comments

@ghost
Copy link

ghost commented Mar 11, 2016

My understanding of how badges work in Read the Docs is to serve those badges from shields.io. Given the unreliable nature of shields.io, perhaps it would be better to integrate shields.io into RTD, and serve generated badges from RTD instead of just doing a 302 redirect to shields.io.

@ericholscher
Copy link
Member

Yea, agreed. Just need to figure out a good way to generate the SVG's.

@ericholscher
Copy link
Member

Looks like this page has some basic SVG for it: http://www.desmondrivet.com/blog/technical/pylint-badges

@ericholscher
Copy link
Member

@agjohnson agjohnson added the Improvement Minor improvement to code label Mar 12, 2016
@ericholscher
Copy link
Member

Worked on a basic proof of concept here: #2071 -- needs more work, but will be a starting point. Would be great if anyone with SVG knowledge can clean it up.

@wmayner
Copy link
Contributor

wmayner commented Jul 13, 2017

Is Shields.io really unreliable? My understanding is that it's used by many other services under the hood to serve standardized SVG. They also support passing a maxAge query parameter that will fix #1612.

@jColeChanged
Copy link

jColeChanged commented Aug 17, 2017

From what I understand one of the things that was struggled with was getting the rectangle and the width of the text to scale together without having to first render and then get the text size.

I tried to do an experiment to see if I could work around that by using filters. The experiment managed to get the box to scale to fit the svg text within it, without needing to measure. However, the amount of border space was percentile. So as the length of the text increased the space between the border and the text increased, which doesn't seem like what we want.

I was asked to post the experiment here so the knowledge wasn't lost.

Another problem was that I'm not quite sure how to get the rounded corners with this approach.

<svg width="100%" height="100%">
  <defs>
    <filter x="-0.2" y="-0.2" width="1.4" height="1.4" id="solid">
      <feFlood flood-color="#4c1"/>
      <feComposite in="SourceGraphic" operator="xor"/>
    </filter>
  </defs>
  <text filter="url(#solid)" x="100" y="50" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" text-anchor="middle" font-size="10">
    passing</text>
  <text x="100" y="50" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" text-anchor="middle" font-size="10" fill="#fff">
    passing</text>
  <text x="10" y="51" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" text-anchor="middle" font-size="10" opacity="0.3" fill="#fff">
    passing</text>
</svg>

Edit: Managed to use &nbsp; to deal with sizing concerns, but still stuck on rx when no rect is in play. Going to see if I can make progress on something else.

@humitos
Copy link
Member

humitos commented Dec 28, 2017

I think this issue is no more relevant since RTD is already serving badged under its own domain and the badges are the same for all the project: docs: passing, docs: failing and docs: unknown. So, no project name on it or anything else.

I'm closing this issue. Please, feel free to reopen if you consider that something is missing or more work is needed here.

Docs on this, at http://docs.readthedocs.io/en/latest/badges.html

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

No branches or pull requests

5 participants