Skip to content

Instantly share code, notes, and snippets.

@Pokechu22
Created December 8, 2022 19:09
Show Gist options
  • Select an option

  • Save Pokechu22/092fde7a3e13c2f872f517ad19334bb0 to your computer and use it in GitHub Desktop.

Select an option

Save Pokechu22/092fde7a3e13c2f872f517ad19334bb0 to your computer and use it in GitHub Desktop.

Revisions

  1. Pokechu22 created this gist Dec 8, 2022.
    19 changes: 19 additions & 0 deletions gen_rev_list.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    import sys

    with open(sys.argv[1]) as fin:
    lines = fin.readlines()

    INDEX_URL = sys.argv[2]

    TITLE_PREFIX = ' <title>'
    TITLE_SUFFIX = '</title>\n'
    REV_PREFIX = ' <id>'
    REV_SUFFIX = '</id>\n'

    for line in lines:
    if line.startswith(TITLE_PREFIX):
    cur_title = line[len(TITLE_PREFIX):-len(TITLE_SUFFIX)].replace(' ', '_')
    if line.startswith(REV_PREFIX):
    rev=line[len(REV_PREFIX):-len(REV_SUFFIX)]
    print(INDEX_URL + '?title=' + cur_title + '&oldid=' + rev)
    print(INDEX_URL + '?title=' + cur_title + '&action=edit&oldid=' + rev)