Nodelet Hack to auto-linkify modules in code sections (well almost)
1 direct reply — Read more / Contribute
|
by LanX
on Jul 22, 2022 at 13:15
|
|
Hi
I just wanted to hack a free nodelet hack (sic) on the fly, which automatically links any used or required module in code-sections to CPAN.
But I don't know what I'm doing wrong, can't make it work yet.
Not sure if it's a JS problem or related to Chrome and security issues (couldn't test in FF yet).
Before scratching all the efforts, I thought it might be reasonable to ask for help.
paste this into the JS Console
function linkCPAN() {
let codes = document.getElementsByClassName('codetext');
// let pattern = '$1<href="http://search.cpan.org/perldoc?$3">$3</
+a>';
let replacer = function (match, p1, p2, p3) {
return p1 + '<href="http://search.cpan.org/perldoc?' + p3 + '"
+>' + p3 + '</a>';
};
for (var i in codes) {
if (!codes.hasOwnProperty(i)) continue;
let text = codes[i];
let inner = text.innerHTML;
inner = inner.replace(/((use|require)\s+)((\w+)(::\w+)*)/g, re
+placer);
console.log(inner);
text.innerHTML = inner;
}
}
and call linkCPAN()
you should see the properly replaced HTML in the console, but nothing happens in the window.
here some input for testing
use strict;
use Data::Dump;
Any ideas?
update
fixed JS has no hashes but objects bug with if (!codes.hasOwnProperty(i)) continue;
|
RFC: Policy regarding abuses of the voting system
10 direct replies — Read more / Contribute
|
by jdporter
on Jun 09, 2022 at 09:38
|
|
|
No new reviews?
1 direct reply — Read more / Contribute
|
by hippo
on May 27, 2022 at 06:49
|
|
It seems that new reviews are not being accepted - is this intentional?
From the top menu, select Reviews, then "Add a Module Review" or "Add a Book Review" and you just get
This node has been deleted.
|
Time of post is missing (at least in not logged-in session)
1 direct reply — Read more / Contribute
|
by Anonymous Monk
on May 10, 2022 at 18:50
|
|
As a reader who has not logged in, the time of post is missing from the view of https://perlmonks.org/?node_id=397425;mode=root-and-node (got "Tough beans" message when the text was a link). That makes it hard to track which thread/post I should read next.
And no, color gradient is not helpful in my case.
Please show the age of post again.
|
Warning: PerlMonksFlair now links to a porn site
4 direct replies — Read more / Contribute
|
by kcott
on Apr 27, 2022 at 17:17
|
|
<p>[id://1049026|PerlMonks Badge]: [http://www.perlmonksflair.com/kcot
+t.jpg]</p>
Overnight, ++Cristoforo advised me: "Someone linked your `perlmonksflair` link to a porn site!".
I immediately removed that paragraph.
I'm reasonably certain that I've seen similar links (e.g. http://www.perlmonksflair.com/<monk_name>.jpg)
on other monks' home nodes; they may also exist on non-PM webpages including, potentially, $work websites.
It looks like the author, gideondsouza, was maintaining this up to, and including, 31-Jul-2017;
that is also the last time he visited PerlMonks.
I suspect ownership of the domain expired and was bought by another party (just guessing, though).
I'll add a link to this post on "perlmonksflair.com : get your perlmonks flair!";
however, given the length and popularity of that thread, my addition may not be particularly prominent.
Perhaps gods, janitors, or other cabal members with appropriate permissions,
might consider adding a large, bold warning to the top of the OP.
|
Is "Tidings: What's New at PerlMonks" Obsolete?
5 direct replies — Read more / Contribute
|
by kcott
on Apr 23, 2022 at 02:13
|
|
G'day All,
Just to be absolutely clear, this is about "Tidings".
The first paragraph of that node begins with:
"Your site maintainers are constantly improving the appearance and functions of PerlMonks to make your experience here the best it can be. To find out what has changed recently, or since the last time you logged in, peruse the headlines below."
Unfortunately, while "constantly improving the appearance and functions of PerlMonks" is certainly true,
reporting such via Tidings is not.
I make a point of checking this node every time I log in (that probably averages more than once a day).
I rarely see any updates; the last was 16-Jul-21.
I don't wish to single out any particular changes, but it seems many occur without notification in this node.
Purely for example, the recent "User Profile Element: CPAN author ID" would seem like a prime example to be notified in Tidings.
I've been a registered user for well over a decade; as such, I'm familiar with some for the foibles of this site.
For newer users, or less frequent visitors, this may appear as stagnation.
Let's avoid that by either using Tidings regularly or retiring it to the monastic archives.
Discussion appreciated.
|
Is this OK?
4 direct replies — Read more / Contribute
|
by jwkrahn
on Apr 09, 2022 at 18:56
|
|
Is it OK to post some Perl code I found on the web and critique/make fun of it, or should I just post it on https://thedailywtf.com/ ?
|
User Profile Element: CPAN author ID
6 direct replies — Read more / Contribute
|
by jdporter
on Apr 04, 2022 at 14:38
|
|
We have just added a new field to the user profile: CPAN author ID. You can put your PAUSE author ID in this field.
When someone views your profile, they will see it and it will be a link to the corresponding page on metacpan.
Do you like this? It can be removed if it is unpopular.
Update:
I have turned off users' ability to set this value themselves.
The field itself is still supported, and you can see it displayed on certain monks' homenodes.
If you would like to have your CPAN ID on your homenode, please just /msg gods with your request.
Thanks!
Update 2:
As a convenience, I have added the CPAN IDs to user profiles based on the info provided
in this CPAN api (about 30 monks)
and in this MetaCPAN api (about 185 monks).
Interestingly, there was almost no intersection between those two sets of data.
I reckon we are the only monastery ever to have a dungeon staffed with 16,000 zombies.
|
Random Perl Pair Programming
1 direct reply — Read more / Contribute
|
by InfiniteSilence
on Apr 01, 2022 at 16:30
|
|
I'm watching Mark Gardner and Gabor Zabo doing some pair programming and wondered if there could be a facility here at PerlMonks to initiate the same thing?
I think it would be like the equivalent of a private chat ... someone is online and you can see what project they would like to code in this fashion. Since you could see their ranking on Perlmonks you could get a feel right away if this might not be a great idea maybe?
Celebrate Intellectual Diversity
|
Problem: Side effects of editing a post and going back and forth in navigation history
1 direct reply — Read more / Contribute
|
by LanX
on Mar 25, 2022 at 10:51
|
|
Hi
I recently did an edit of a post and afterwards did not only mysterious duplicates appear but also was the newest version of the node replaced by an older edit.
I was able to reproduce the problem by going back and forth in browser history and seeing reloads happening:
compare
I can't tell which phases forced a reload, but I could easily tell that they sometimes happened, because I occasionally saw a very new CB chat while navigating back.
Could this be related to different server configs?
Maybe my test was flawed, but I wanted to document it anyway.
|
Color for Error Messages
3 direct replies — Read more / Contribute
|
by LanX
on Mar 18, 2022 at 09:24
|
|
Today we had again a case of a monk complaining that he couldn't post.
Turned out that he used only one word in the title and overlooked the black and bold error-message in between other bold labels. (Which I can understand)
<strong>Title must be more than one word!</strong>
One possible solution for you all is to adjust Display Settings with
strong {
background-color: white;
color: red;
}
This should stand out with all color themes and there are only 14 nodes using <strong> tags, most of which are pretty obscure.
Of course it might be better to add an error_msg class to the CSS, but I learned to humbly make small steps. :)
|
CUFP not included in Best Nodes?
1 direct reply — Read more / Contribute
|
by 1nickt
on Feb 22, 2022 at 15:02
|
|
Title says it all. Is this by design?
The way forward always starts with a minimal test.
|
The Highest Rated Node of All Time
5 direct replies — Read more / Contribute
|
by eyepopslikeamosquito
on Jan 21, 2022 at 23:40
|
|
|
Demotions of monks
9 direct replies — Read more / Contribute
|
by syphilis
on Jan 05, 2022 at 00:46
|
|
Hi,
When and why were BrowserUk, Corion and ikegami demoted from Pope to Patriarch ?
I don't see any discussion about this drastic action ... though I guess it's possible that I'm simply looking in the wrong places.
Just curious.
Cheers, Rob
|
Content deleted from beautyfulman's old posts
3 direct replies — Read more / Contribute
|
by eyepopslikeamosquito
on Jan 02, 2022 at 19:23
|
|
Just noticed that beautyfulman's first 25 posts seem to now be completely empty, even lacking a node title, for example [untitled node, ID 11140036].
I'm pretty sure it's against site policy to remove content from your old nodes.
If so, should their content be restored?
See also:
|