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

ConTeXt writer: deal with URL hyphenation #297

Closed
wants to merge 3 commits into from
Closed

ConTeXt writer: deal with URL hyphenation #297

wants to merge 3 commits into from

Conversation

bscottm
Copy link
Contributor

@bscottm bscottm commented Aug 23, 2011

Make ConTeXt's Link formatting aware of URL hypehnation, when it's easy to detect (i.e., when isAbsoluteURL is known to succeed or fail.)

Make ConTeXt's Link formatting aware of URL hypehnation, when it's easy
to detect (i.e., when isAbsoluteURL is known to succeed or fail.)
@jgm
Copy link
Owner

jgm commented Aug 25, 2011

The code looks fine on a quick perusal. (Haven't had a chance to test or look further.)

Can you say a bit about the point of this? What is the current writer getting wrong? What does the context command \hyphenatedurl do? Is it a standard part of context, or a special command that needs to be defined elsewhere in the document?

@bscottm
Copy link
Contributor Author

bscottm commented Aug 25, 2011

The ConTeXT writer itself isn't wrong; it needed a minor enhancement.
\hyphenatedurl does what it says it does -- hyphenates long URLs.
Otherwise, you end up with overfull hboxes and URLs running off the
edge of the page. It "pretties up" the output considerably. For
example, the following citation becomes one very large line, as
opposed to two if the URL is encapsulated within \hypenatedurl:

[2] CENDI, Frequently Asked Questions about Copyright and Computer
Software Issues Affecting the U.S. Government with Special Emphasis on
Open Source Software, 2009. [Online].
http://cendi.gov/publications/09-1FAQ_OpenSourceSoftware_FINAL_110109.pdf.

I ran into this URL hyphenation problem as the result of some hacking
on citeproc-hs, in which URLs are now passed to pandoc as Link
objects. Still waiting for Andrea to review and accept that patch.

Granted, the patch only applies to a simple and easily detectable
case. I can work on a more sophisticated patch that delves deeper into
the Link for more sophisticated cases, if you'd prefer.

-scooter

On Thu, Aug 25, 2011 at 2:38 PM, jgm
reply@reply.github.com
wrote:

The code looks fine on a quick perusal.  (Haven't had a chance to test or look further.)

Can you say a bit about the point of this?  What is the current writer getting wrong?  What does the context command \hyphenatedurl do?  Is it a standard part of context, or a special command that needs to be defined elsewhere in the document?

Reply to this email directly or view it on GitHub:
#297 (comment)

@bscottm
Copy link
Contributor Author

bscottm commented Aug 25, 2011

Actual ConTeXT citation source:

{[}2{]} CENDI, {\em Frequently Asked Questions about Copyright and Computer Software Issues Affecting the U.S. Government with Special Emphasis on Open Source Software}, 2009. {[}Online{]}.
\useURL[urlref4][http://cendi.gov/publications/09-1FAQ_OpenSourceSoftware_FINAL_110109.pdf][][\hyphenatedurl{http://cendi.gov/publications/09-1FAQ_OpenSourceSoftware_FINAL_110109.pdf}]\from[urlref4].

@bscottm
Copy link
Contributor Author

bscottm commented Aug 26, 2011

Ah, I should also add that the URL is not hyphenated when characters are escaped, e.g., '_' is replaced by '\letterunderscore{}'.

Make ConTeXt's Link formatting aware of URL hypehnation in Link objects.
@bscottm
Copy link
Contributor Author

bscottm commented Aug 26, 2011

My commit stream seems to have gotten hosed. Resending pull request.

@bscottm bscottm closed this Aug 26, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants