Skip to content

V9: clean wikitext replace for bot-plugins #411

Open
@Cobertos

Description

@Cobertos

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...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions