question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V9: clean wikitext replace for bot-plugins

See original GitHub issue

Is there any way to get the original wikitext for a specific model? Not converting it back like wtf-plugin-wikitext does, but like a startIndex, endIndex into the originally parsed wikitext string?

I want to be able to convert back to wikitext while keeping the originally desired user formatting, just changing the text in one or two rows of a table.

Almost something like

const [brandTable] = tldDoc.sections('Brand top-level domains').tables();
brandTable.data
  .map(r => {
    if(r.Name === '.somebrand') {
      r.Name = new Sentence('');
      return r.wikitext(); //It's a table _row_ so it doesn't really have that but I can manage on my end
    }
    else {
      return r.originalWikiText(); //Just returns the original wikitext for that row
    }
  })
  .join('\n');

…where r.originalWikiText() would basically just, return the

Is this even possible? Could the parser decorate the models with this information? Is this something that would be valuable in a PR? Trying to write a Wikipedia bot that updates a table…

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Dec 28, 2020

yep - I’ve been thinking about this too. Let me take a crack at it, i’ve got some time over the holidays. I don’t have any clear ideas, but maybe it will help to just try a few things. will let you know how it goes

0reactions
spencermountaincommented, Jan 10, 2021

hey @Cobertos - I haven’t got a solution to this, but haven’t forgotten.

Plan is to do a fuzzy-match on the original wikitext, then allow replacing chunks of it - hard part is that the model isn’t built-well for reproducing subsets of the document, like the table use-case you mentioned.

I will almost-certainly be over-thinking this over the winter, but should scale-back my promises for it. cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extension:Replace Text - MediaWiki
Extension:Replace Text ; Description, Provides a form to let administrators do string replacements on the entire wiki, for both page contents and page...
Read more >
Untitled
Libertinism in restoration theatre, Petaluma adobe wiki. ... Belinda stajan, Nrgeek unboxing, Mapas estelares gratis, Cm1836 replacement blade?
Read more >
Untitled
Septic pipe replacement cost, Que es shunt electrico, Graham and brown saville wallpaper ... Jules destrooper wiki, Hans peter waldhoff, Celebrazione inizio ...
Read more >
Untitled
Perii usi culisante, Npt council environmental health, Dism cleanup server 2008 r2, ... Define trilete mark, Febdok alternativ, Newton streamline wiki, ...
Read more >
Help:Wikitext - Wikipedia
The markup language called wikitext, also known as wiki markup or wikicode, consists of the syntax and keywords used by the MediaWiki software...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found