Ethics [ed: George Matthews]

Wonderful! Posting in the new releases thread now.

1 Like

Thanks, Christina! Happy to note that I’ve submitted the resource to the Open Textbook Library, B.C. Open Textbook Collection, OER Commons, and MERLOT. :slight_smile: You should see both the Ethics and Mind books in these collections when searching for philosophy resources!

1 Like

Hi @apurva, I know you’re on vacation right now but I have a question and I want to put it out here before I forget.

I’m working on putting the CSS into custom styles to get the URL in parentheses after hyperlinks for PDFs. But I’d really rather it only put in the URLs for print PDFs, not digital ones. If we have hyperlinks plus the URLs in parentheses in digital PDFs, then that means screen readers will go through the URLs in the digital PDFs as well as find the hyperlinks. Which causes a new issue!

Is there a way to have the custom CSS only apply to print PDF exports?

Alternatively, we could go the route of putting URLs in footnotes, but right now we are using footnotes rather than endnotes because of an accessibility issue in PDF exports with endnotes. Thus, all URLs would be in footnotes at the bottom of each page where there are URLs, which is okay but maybe not ideal.

Seems when we fix one issue we create another! :slight_smile: Complicated, but interesting and important stuff!

Hi Christina, apologies for the late response.

You could add a .print before the CSS rule in the PDF Custom Styles sheet. Looking at the existing rules in the stylesheet, this ought to do the trick. Let me know how this goes, and if needed, I can look into this further.

There are possible alternatives, as you’ve noted, but let’s start with giving the above solution a try first and seeing how we go.

Couldn’t have said it better myself! :smiley:

Excellent, that worked! Thanks @apurva. Now it turns out I need to eliminate the hyperlinks in the references and footnotes where I’ve added hyperlinks to URLs, because what happens is something like this:

Kirk, Chris, Charanya Krishnaswami, Katie Mesner-Hage, Skye Nickalls. 2013. “Reproductive Rights Around the World.” Slate. May 30. http://www.slate.com/articles/news_and_politics/ map_of_the_week/2013/05/abortion_and_birth_control_a_global_map.html (http://www.slate.com/articles/news_and_politics/map_of_the_week/2013/05/ abortion_and_birth_control_a_global_map.html)

Annoying! I’ll go through and delete the hyperlinks from the references lists so this doesn’t happen. And I’ll add this to the growing doc of how to input and format the books into Pressbooks!

Hmmm…now that I think about this more, I have a conundrum.

  1. If I leave the hyperlinks in references like the example above then on print PDFs the link text gets printed twice, which is not ideal.

  2. But if I don’t have hyperlinks in the references, then this isn’t so great from an accessibility perspective. If I do have hyperlinks there, then I can add aria labels (as per this suggestion on the Rebus Forum) and screen readers won’t read out the annoying URL text. If I don’t have hyperlinks, screen readers will read out the annoying URL text.

Gonna have to give this one more thought. Any ideas/suggestions @apurva? In the meantime, I’ve already gone ahead and removed all the hyperlinks in the references in the Ethics and Philosophy of Mind books (there was only one in the latter). It’s not a problem to go back and add them back in with aria labels if that seems the best way to go.

Hmm, that’s not ideal! I’ve come up with a solution that would work, though it does require a bit more manual work than I might have liked.

We can simply add a class in the <a> tag to the links in the References and Further readings list, like so:
<p class="hanging-indent">Bourget, David and David J. Chalmers. 2014. “What Do Philosophers Believe?” <em>Philosophical Studies</em> 170(3): 465-500. <a class="reference" href="https://philpapers.org/rec/BOUWDP">https://philpapers.org/rec/BOUWDP</a></p>

This class will need to be added to any URL that you don’t want repeated/displayed twice in the print PDF. Once you’ve done so for each of the desired URLs, you can adapt the CSS rule you have previously entered which forced the display the full url of hyperlinks in the print PDF. Edit the rule as follows:

.print a:not(.reference)::after {
      content: " (" attr(href) ")";   }

And to ensure that the URLs in the print PDF are not clickable, I would suggest adding a rule like so:

.print a, .reference {
  prince-link: none;
  text-decoration: none;
  color: black;
}

This final rule simply specifies that the URLs/hyperlinks in the print PDF will not be clickable. It does not affect the digital PDF, where any internal or external hyperlinks or URLs will be active. For those using the print PDF on their devices, they can enable the Adobe function to ‘make URLs active.’ (Note: this function may need to be disabled on your end to test that the rules above are working as expected). This rule is also helpful as it preserves the URLs and hyperlinks as active in all the digital formats, including web, though from my understanding of Baldur’s explanation in the Rebus Forum, aria-labels for hyperlinks in the bibliographies/readings sections might still be helpful.

Please let me know if any of this is unclear, or if it doesn’t work out when applied to the books.

Lastly, while I was testing these solutions in the Ethics book, I noticed some instances of code in the Text editor that could be removed, mainly the import-Normal class. You can go ahead and delete this class from the text editor, along with any spare div tags, stray span tags in chapters.

Also: this is a fantastic resource! Thanks for putting it together, and slowly adding to it as we learn more things whilst formatting these books. :smiley:

Fantastic–can’t wait to give this a try! I will let you know how it goes.

And the stray codes…I don’t know how those things get in there but I can clean them up in both of the published books, as well as the Logic book. That may take a little longer for me to get around to, though!

Looking forward to hearing how you get on!

As for the stray codes: what I find helpful is to copy over the text from the text editor into a tool like Word or Google Docs and use the find and replace function to remove all the errant code from the chapter. Then, I paste it back into the text editor in Pressbooks and save my changes. Pressbooks also has a similar search and replace tool, which you can apply for the entire book at once. For me, working in small batches helps me better understand what code is needed (and what isn’t), so I don’t mistakenly delete something that ought to remain.

@metatechne — I’m following up about this media attributions issue with some good news! The Pressbooks team has notified me of a fix that went out last week, where the phrasing of media attribution statements has been changed to reflect licensing conventions. You should see the changes live on the Ethics book now. So there should no longer by any confusion about the license of a particular media element versus the creator being attributed. Let me know what you think of this change!

1 Like

Hi @apurva–I was trying this trick for internal links in the book so they wouldn’t repeat in parentheses:

For example, in the “What is an Open Textbook” section in the Philosophy of Mind book, there is an internal link at the end of the first paragraph, in parentheses. It shows up in the print PDF not as a link URL but as an internal bookmark I think, with just a hashtag symbol and the last part of the URL:

When I try to give that internal link a class="reference" tag it isn’t working to make it avoid printing the bookmark in parentheses. I’m guessing this is because of some way in which internal links are handled differently? I found it surprising because if you go to the “text” view of that section in the PB interface it gives a full URL:

“(please see <a class="reference" href="https://press.rebus.community/intro-to-phil-of-mind/back-matter/licensing-and-attribution-information/">the licensing information for this book</a> for more information).”

This isn’t a big deal or a need for a rush, but it does look a little strange on the print versions I think. Thanks for any thoughts you have about this!

Hi Christina, I’ve taken a look at a new print PDF export, and don’t see the links repeated in parentheses. I think ensuring that the URL in the hyperlink is the full URL, not just partial, like a bookmark, will help. I tested adding the class="reference" tag to the internal link in the ‘How to Use the Book’ section, and found that it worked perfectly to not list out the full URL in the print PDF file (note that in the digital PDF, the text would still be hyperlinked).

Could you possibly look at a new print PDF export and see if you’re still seeing this issue crop up? If so, I can have a look at the specific chapters where you might be noticing the discrepancy.

Hi @apurva–finally getting back to this after a couple of months dealing with lots of work in my other job related to the pandemic. I have a small breather now and am getting back to work on this book series!

I just went back to this issue about internal links showing up strangely on the print PDFs. Even though the full URL is in the hyperlink in the “text” field for the chapters/front matter, what gets printed in the print PDF is as noted above, just an internal bookmark. This is the case for first two front matter sections (What is an Open Textbook, and How to Use this Book), as well as internal links in Chapter 3.

I did go in and try to class-“reference” trick and that works to take the URLs out of the print version altogether. I’m not sure what I did before because now that is working fine! I did that for the internal links in the “What is an open textbook” section.

But in some cases I’d like to keep the internal URLs in there–e.g., in some chapters there are references to other chapters, and if a student just has a print version of one chapter and wants to see the URLs for the others, it would be good if they were in the print version. But again, even though I have the full URL in the chapter code, the print version just has the internal bookmark.

For example, in Chapter 3 there is this in the HTML:

For example, given an opportunity to donate to a charity, deontologists 
(see <a href="https://press.rebus.community/intro-to-phil-ethics/chapter/
kantian-deontology/">Chapter 6</a>) would consider whether there 
is an ethical rule that required them to donate. Utilitarians 
(see <a href="https://press.rebus.community/intro-to-phil-ethics/
chapter/utilitarianism/">Chapter 5</a>) would consider whether a 
donation would produce better consequences if they donated than if they did not. 

But this is what appears in the print PDF for the same sentences:

For example, given an opportunity to donate to a charity, deontologists 
(see Chapter 6 (#chapter-kantian-deontology)) would consider whether 
there is an ethical rule that required them to donate. Utilitarians (see Chapter 5 
(#chapter- utilitarianism)) would consider whether a donation would produce 
better consequences if they donated than if they did not.

And I’m not sure why that would be the case. Any thoughts? Again, this is not a big rush but it’s curious!

Hi Christina, glad you have had a bit of a breather and are able to slowly return to work on this book series! :slight_smile:

Excellent! Nothing has changed in the interim, but I’m glad that this now resolved on your end as well.

As for the internal URLs — I’ll need to reach out to the Pressbooks team to help troubleshoot, as it’s not just a matter of displaying the absolute (full) URL. As you noted, the internal links are converted to bookmarks or anchors. The shorter internal links are preferred for the web version, especially if you’re linking between chapters, but they may be converted to bookmarks for easier navigation in the digital PDF. I’ll pass this along to the Pressbooks team, and let you know if they have more to add and suggestions for how we can display the full URLs.

@christina.hendricks - good news, the Pressbooks team is currently testing out a solution to display the full URL for internal links in the print PDF. We should receive results of this testing process soon, and I’ll let you know as soon as it comes in!

That’s great–thank you for the update!

1 Like

Hi Christina, we’ve made some progress on the internal links issue. The Pressbooks team has made what’s called the data-url attribute available, which ensures the display of complete URLs (even for internal links in the book) in the print PDF file. I’ve modified our existing custom CSS for the PDF as follows from:

.print a:not(.reference)::after {
  content: " (" attr(href) ")";
}

to:

.print a:not(.reference)::after {
  content: " (" attr(data-url) ")";
}

The internal links in the book are showing up as expected, with the full URL instead of an internal bookmark! You can confirm the same in a new PDF export.

However, it looks like all other links in the book are also now being surfaced with a slight hiccup in links contained in figure captions. Some, like the “Buddha statue in Phuket” in Chapter 2 appear in the print PDF with all their relevant URLs, while others, like the “An Hindoo Woman throwing herself on the funeral pyre of her Husband” in Chapter 1 display with empty parentheticals where the URL should appear. I’m not sure why some captions contain the links while others don’t, but for the sake of expediency with this book, will suggest a quick solution:

  • Add the class="reference" to all the links in image captions (in the Text Editor)
  • Save your changes
  • Repeat for all image captions in each chapter

There’s nothing else to modify in the Custom CSS. This will ensure that the print PDF file isn’t inundated with URLs that students may not necessarily need — image source, creator’s website, and license. This text will still be displayed in the print PDF, it just won’t be hyperlinked or have the URL corresponding printed out.

Apologies for this extra step — I tried to find a way to automate/isolate this work in the CSS, but it proved a bit more complex than I had imagined, and I know we’re in a rush on this book.

Let me know if you have any questions. Once this is done, we should be ready to get the book in print!

@clhendricksbc — following up my long-winded email with much better news. We’ve figured out a custom CSS option to eliminate the empty parenthetical after links in captions. So to summarize:

  • URLs will be printed in the print PDF, with the exception of:
    • Links tagged with the class reference
    • Links contained inside image captions

All that’s left before we move into POD is for you to do a final look through of the print PDF.

Thank you, @apurva! This is good news.

I just did a new export of the print PDF, and found some more empty sets of parentheses. I’m not sure if there was something I needed to do to avoid these! They are all external links.

There’s one on the license page (p. 4), where the CC BY license is linked in the digital PDF last line, below):

And in the Acknowledgements, p. 16:

In “About the Contributors,” p. 109 (last line):

Also the iframes for google forms on pp. 110 & 111.

And all throughout pp. 112 & 113 (licensing information), p. 115 (accessibility information), p. 117 (version history).

I’m wondering if I missed something I needed to do to avoid these issues?