Skip to content

Perl POD with file variables line not marked up.#1133

Closed
kiwiroy wants to merge 2 commits intogithub:masterfrom
kiwiroy:pod-file-variables
Closed

Perl POD with file variables line not marked up.#1133
kiwiroy wants to merge 2 commits intogithub:masterfrom
kiwiroy:pod-file-variables

Conversation

@kiwiroy
Copy link
Copy Markdown
Contributor

@kiwiroy kiwiroy commented Nov 28, 2017

I was pointed here by @cmrberry for an issue I am having regarding POD markup.

When a Perl syntax file with POD contains a line specifying file variables for emacs
the whole file is returned verbatim.

On GitHub this appears thus:

My workaround is to use the alternate syntax

The change to README.pod should not cause the test to fail but does.

The shell script checks the behaviour of lib/github/commands/pod2html which
appears to markup the POD correctly.

./test/fixtures/file-variables.sh 
ok 1
ok 2

@kiwiroy
Copy link
Copy Markdown
Contributor Author

kiwiroy commented Nov 28, 2017

Ah, I see Linguist specifically detect strategies.

The use case that has brought this to my attention is I have a README.pod which is a symlink to a Perl file.

9406690 add "Perl" to the list of languages and the tests pass again, but I have a feeling that there might be unintended consequences elsewhere.

@cmrberry cmrberry requested a review from kivikakk November 28, 2017 22:31
@kivikakk
Copy link
Copy Markdown
Contributor

Indeed, we've had some complications with POD recently in linguist: github-linguist/linguist#3863, github-linguist/linguist#3832, github-linguist/linguist#3735. I'll investigate to see if this PR brings up any of those issues again, otherwise hopefully it'll be good to go.

@kivikakk
Copy link
Copy Markdown
Contributor

kivikakk commented Dec 1, 2017

Unfortunately it does cause the same problem we saw before — see this example of https://github.com/sitaramc/gitolite/blob/5c2fe87019dadbecb1883bedd075cd07b07b2078/src/gitolite:

Before After
screen shot 2017-12-01 at 3 29 35 pm screen shot 2017-12-01 at 3 29 43 pm

In short, this causes all Perl files to be rendered as POD, so we'll need a solution that avoids this. It will probably require a solution in Linguist so it doesn't classify a .pod file as Perl if the modeline is present.

@kiwiroy
Copy link
Copy Markdown
Contributor Author

kiwiroy commented Dec 1, 2017

@kivikakk thank you for looking into this. When looking through the linked issues I had the feeling that this was not going to successfully resolve without recreating the issues there.

I feel like there needs to be another Linguist::Strategy for symlink files that are attempting to change the interpretation of a file. In this case README.pod -> script/name where as a human we decide to change the interpreter we use based on the file name/extension (i.e. perldoc instead of perl).

@kivikakk
Copy link
Copy Markdown
Contributor

kivikakk commented Dec 4, 2017

I think this shouldn't be too hard; in general we don't display the content of a symlink if you view it directly — we only extend this privilege to READMEs shown inline with a tree. I'll have a poke around.

@kivikakk
Copy link
Copy Markdown
Contributor

PRs up at #1139 and github-linguist/linguist#3946 to work this out. Thanks for your report and PR here!

@kivikakk
Copy link
Copy Markdown
Contributor

This issue has (finally) been fixed!

@kiwiroy
Copy link
Copy Markdown
Contributor Author

kiwiroy commented Jan 31, 2018

Indeed it is. Thanks @kivikakk

@kiwiroy kiwiroy deleted the pod-file-variables branch February 8, 2018 01:12
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.

2 participants