Skip to main content

Convert Json data into wiki files or update existing files. Provides different templates to generate wiki files

Project description

wikirender

pypi Github Actions Build GitHub issues GitHub issues GitHub PyPI Status

Provides jinja templates to create wiki page files form JSON input

Install

pip install wikirender

check if it worked with

wikirender -h
wikiextract -h

Examples

wikiextract

Use this tool to extract template information from your wiki backup files.

wikiextract -t Event --BackupPath "/home/user/wikibackup/wikiId" -id "Filename"

Returns:

{
   "data": [
      {
         "Acronym": "ICEIS 2011",
         "Title": "13th International Conference on Enterprise Information Systems (ICEIS)",
         "Type": "Conference",
         "Start date": "2011/06/08",
         "End date": "2011/06/11",
         "Homepage": "www.iceis.org/",
         "City": "Beijing",
         "Country": "China",
         "Submission deadline": "2011/01/25",
         "Filename": "ICEIS 2011"
      },
      {
         "  Title": " Foundations of Software Engineering 2001\n ",
         "  Type ": " Conference\n ",
         "  Field ": " Software engineering\n ",
         "  Series": " FSE\n ",
         "  Homepage": " esec.ocg.at/\n ",
         "  Logo": "\n ",
         "  Start date": "\n ",
         "  End date": "\n ",
         "  City": "\n ",
         "  State": "\n ",
         "  Country": "\n ",
         "  Submitted papers ": " 137\n ",
         "  Accepted papers ": " 29",
         "Filename": "FSE 2001"
      },
      {
         "Acronym": "CC 2009",
         "Title": "International Conference on Compiler Construction 2009",
         "Series": "CC",
         "Type": "Conference",
         "Field": "Computer science",
         "Start date": "2009/03/22",
         "End date": "2009/03/29",
         "Homepage": "http://www.brics.dk/~mis/CC2009/",
         "City": "York",
         "Country": "UK",
         "Submission deadline": "2008/10/02",
         "Filename": "CC 2009"
      }
}

Note: As the name says the data is only extracted form the file. Meaning that also template arguments with invalid arguments are included in the result which is contrary to querying the templates in the wiki (invalid values are excluded there)

wikirender

wikirender -m create_entity_pages

In the mode create_entity_pages the following entity pages will be created (e.g. for <entity_name>)

  • Concept:<entity_name>
  • Category:<entity_name>
  • Help:<entity_name>
  • List of<entity_name_plural>
  • Template:<entity_name>
  • Form:<entity_name>

To generate the pages the following input is required:

  • List of all entities the pages should be generated for
{"data":[{
    "name": "Event",
    "pluralName": "Events",
    "icon": "File:EventLogo-64px.png",
    "iconUrl": "",
    "documentation": "a meeting of researchers at a specific time and place",
    "wikiDocumentation": "a meeting of researchers at a specific time and place (virtual or physical) and with a specific thematic focus to present, hear and discuss research outputs ",
  }]
}

*List of all properties of the wiki (all properties are required to extract dependencies between the properties)

{"data":[{
  "property": "Property:Title",
  "name": "Title",
  "label": "Title",
  "type": "Special:Types/Text",
  "index": null,
  "sortPos": null,
  "inputType": "datetimepicker",
  "values_from": null,
  "used_for": "Concept:Event"
  }]
}

For the example input from above the following command generates Concept.wiki, Category:Event.wiki, Help:Event.wiki, Form:Event.wiki, Template:Event.wiki and, List of Events.wiki,

wikirender -m "generate_entity_pages" --BackupPath . --topics topics.json --properties properties.json
Pipeline Example

Example pipeline to generate enity pages for all topics in the wiki with the use of py-3rdparty-mediawiki

$ bash scripts/gen -t <wikiId> &&
wikirender -m "generate_entity_pages" --BackupPath . --topic /tmp/wikirender/<wikiId>/topics.json --properties /tmp/wikirender/<wikiId>/properties.json &&
wikirestore -t <wikiId> --backupPath .

Example Pipeline

For example, we have a json file with information about events with which we want to update the Event templates in the wikibackup.

cat test.json | wikirender -t Event -id Acronym -stdin --BackupPath "."

The data is provided to wikirender through stdin and updates the template Event with the provided data. As page name the key Acronym is used. The update to the templates is applied to the files as shown in the diagram below.

Sample Input Data

{
    "data":
    [
        {
            "Acronym": "SMWCon 2020",
            "Title": "SMWCon",
            "Year": "2020",
            "Description": "test value"
        },
        {
            "Acronym": "SMWCon 2021",
            "Title": "SMWCon",
            "Year": "2021",
            "Description": "test value\\n with line break"
        }
    ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wikirender-0.0.30.tar.gz (47.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wikirender-0.0.30-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

Details for the file wikirender-0.0.30.tar.gz.

File metadata

  • Download URL: wikirender-0.0.30.tar.gz
  • Upload date:
  • Size: 47.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for wikirender-0.0.30.tar.gz
Algorithm Hash digest
SHA256 fcea3862dd297f92b000ce0b23e94cd8c154b5022c8a353454125d04ab23d031
MD5 e21fc5d04bfccf0fa3a78dbca1d502e2
BLAKE2b-256 4f2660c26f35352263d5a283edcf6720db06d9abf2760da676e128e1f8fc04df

See more details on using hashes here.

File details

Details for the file wikirender-0.0.30-py3-none-any.whl.

File metadata

  • Download URL: wikirender-0.0.30-py3-none-any.whl
  • Upload date:
  • Size: 57.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for wikirender-0.0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 82bcc9d79eb74497cbf703036714be40efaffab9a9e160733f9c2c8b44ef36d2
MD5 dbbb18d53c20cd60611d645fd7e7dfd0
BLAKE2b-256 0acd2d11fd4fd0bf38cdce92c26a12709eb63c9b7feea6dde439667d810a456e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page