diff --git a/README.md b/README.md index 5a2fe60..6341f57 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ * [jinja2](https://jinja.palletsprojects.com/en/2.11.x/) Python library * Install: * `pip3 install jinja2` +* [Pillow](https://pillow.readthedocs.io/en/stable/) Python library for image processing + * `pip3 install Pillow` * [pandoc](https://pandoc.org/) * Install: * Debian/Ubuntu: `sudo apt install pandoc` @@ -97,3 +99,4 @@ It is to convert pdfs to jpgs: convert -quality 100 -density 300 [name-of-pdf] %02d.jpg + diff --git a/download_imgs.py b/download_imgs.py index 34c1e0c..a8af106 100644 --- a/download_imgs.py +++ b/download_imgs.py @@ -1,7 +1,9 @@ import os from mwclient import Site from pprint import pprint -from functions import update_json +from PIL import Image +from functions import update_json, remove_nonwords + site = Site(host='hub.xpub.nl/sandbox', path='/itchwiki/') wd = os.path.dirname(os.path.abspath(__file__)) # working directory @@ -11,6 +13,7 @@ os.makedirs(imgdir, exist_ok=True) # create images/ dir imgsjson_fn = os.path.join(wd, 'images.json') +thumbnail_size = 1200 # largest px dimension of img thumbnails with open(os.path.join(wd, 'login.txt'), 'r') as login: # read login user & pwd @@ -26,7 +29,7 @@ for img in site.allimages(): # important img info to dictionary img_dict = { 'name': img.name, - 'filename': img.page_title, + 'filename': remove_nonwords(img.page_title), 'timestamp': img.imageinfo['timestamp'], 'url': img.imageinfo['url'], 'urldesc': img.imageinfo['descriptionshorturl'], @@ -35,6 +38,7 @@ for img in site.allimages(): # location of image storage img_fn = os.path.join(imgdir, img_dict['filename']) + print(img_fn) # function updates images.json and returns whether the img needs to be downloaded or not download = update_json(imgsjson_fn, img_dict, img_fn) @@ -43,4 +47,20 @@ for img in site.allimages(): print('DOWNLOADING:', img_fn) with open(img_fn, 'wb') as img_file: img.download(destination=img_file) + + # resize image + fn, ext = os.path.splitext(img_fn) + if ext.lower() in ['.jpg', '.jpeg', '.gif', '.png']: # only img format + pilimg = Image.open(img_fn) + pilimg_dim = list(pilimg._size) + pilimg_dim_sort = sorted(pilimg_dim) # smallest dimension 1st + img_ratio = pilimg_dim_sort[0] / pilimg_dim_sort[1] + if pilimg_dim == pilimg_dim_sort: + # if height was largest + new_dim = [(thumbnail_size * img_ratio), thumbnail_size] + else: + # if with was largest + new_dim = [thumbnail_size,(thumbnail_size * img_ratio)] + pilimg.thumbnail(new_dim) + pilimg.save(img_fn) print('\n') diff --git a/example_api_calls.py b/example_api_calls.py new file mode 100644 index 0000000..2671675 --- /dev/null +++ b/example_api_calls.py @@ -0,0 +1,63 @@ + +# https://www.mediawiki.org/wiki/API:Main_page +# https://mwclient.readthedocs.io/en/latest/ + +import mwclient +from mwclient import Site +from secrets import BOTPASSWORD +import json + +site = Site("hub.xpub.nl", path="/sandbox/itchwiki/") +site.login("Bot", BOTPASSWORD) + +for i in site.allimages(): + # Use imageinfo to request/create a thumbnail + # NB: uses i.name as "titles" (the api call can take a list of titles) + # but here it just uses one. + # NB: iiurlwidth specifies a max width for the resulting thumbnail + # check out the API doc for all the options + # https://www.mediawiki.org/wiki/API:Imageinfo + r = site.api("query", prop="imageinfo", titles=i.name, iiprop="url", iiurlwidth="80", formatversion=2) + iinfo = r['query']['pages'][0]['imageinfo'][0] + thumburl = iinfo['thumburl'] + fullsizeurl = iinfo['url'] + filepageurl = iinfo['descriptionurl'] + print (""" + +""".format(filepageurl, thumburl)) + # print (i.name, thumburl, fullsizeurl, filepageurl) + + + # NOW do an "ASK" api call to get semantic meta data from the same image + # This query is the "code" that you get from the "Semantic Ask" page + # Except you need to remove the {{#ask: and the }} at the end. + + ask_query = """[[{0}]] + |?Title + |?Date + |?Creator + |?Format + |?Organization + |?Part + |?Partof + |?Event + |?Topic + |?Language + |format=json + |limit=50 + |offset=0 + |link=all + |sort= + |order=asc +""".format(i.name) + # print ("Made an ASK query", ask_query) + ask_result = r = site.api("ask", query=ask_query) + # print (json.dumps(ask_result, indent=2)) + image_metadata = ask_result['query']['results'][i.name]["printouts"] + print (json.dumps(image_metadata, indent=2)) + +# Calling the api to make/give a thumbnail of a particular image +# https://hub.xpub.nl/sandbox/itchwiki/api.php?action=query&format=json&prop=imageinfo&iiprop=url&iiurlwidth=320&titles=File:VF250Commitment-18.jpg +# site.api() +# Magic URL to generate and get the URL of a thumbnail of an image +# https://hub.xpub.nl/sandbox/itchwiki/api.php?action=query&format=json&prop=imageinfo&iiprop=url&iiurlwidth=640&titles=File:VF250Commitment-18.jpg diff --git a/examples/example_ask.html b/examples/example_ask.html new file mode 100644 index 0000000..95fb116 --- /dev/null +++ b/examples/example_ask.html @@ -0,0 +1,350 @@ + +

+

1970-02-26 (1/1970/2/26)

+

The Philippine Collegian, Part 1 of 2

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 1 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 2 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 3 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 4 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 5 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 6 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 7 of 8

+ +

+ + +

+

1972-05-20 (1/1972/5/20)

+

Sambayanan, Part 8 of 8

+ +

+ + +

+

1972-09-21 (1/1972/9/21)

+

The Lessons of Martial Law, Part 1 of 4

+ +

+ + +

+

1972-09-21 (1/1972/9/21)

+

The Lessons of Martial Law, Part 2 of 4

+ +

+ + +

+

1972-09-21 (1/1972/9/21)

+

The Lessons of Martial Law, Part 3 of 4

+ +

+ + +

+

1972-09-21 (1/1972/9/21)

+

The Lessons of Martial Law, Part 4 of 4

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 1 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 2 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 3 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 4 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 5 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 6 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 7 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 8 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 9 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 10 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 11 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 12 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 13 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 14 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 15 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 16 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 17 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 18 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 19 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 20 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 21 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 22 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 23 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 24 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 25 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 26 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 27 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 28 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 29 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 30 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 31 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 32 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 33 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 34 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 35 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 36 of 86

+ +

+ + +

+

1977-01-01 (1/1977/1/1)

+

The Logistics of Repression, Part 37 of 86

+ +

+ diff --git a/examples/example_ask.png b/examples/example_ask.png new file mode 100644 index 0000000..0797cda Binary files /dev/null and b/examples/example_ask.png differ diff --git a/examples/example_ask.py b/examples/example_ask.py new file mode 100644 index 0000000..17ecf76 --- /dev/null +++ b/examples/example_ask.py @@ -0,0 +1,93 @@ +""" +Let's say you're interested in documents related to the topic "US Foreign Policy" + +You can start with an "ask" (first just from the "Semantic Ask" interface) and use the condition: + +[[Topic::US Foreign Policy]] + +Press "Find results" and you get a lot of pages as result. +Then you would add the info you're interested in the "printout selection" box, and also make sure to sort the results with the part number to make sure document pages are in order. + +Finally, click on the "Code" view and copy paste the code -- but +be careful NOT to copy the "{{#ask:" and the "}}" at the end. + +This you can then paste into the API Sandbox to test it if you want... +OR just paste it into the code below as the "ask_query" variable. + +https://hub.xpub.nl/sandbox/itchwiki/index.php/Special:ApiSandbox#action=ask + +""" + +# https://www.mediawiki.org/wiki/API:Main_page +# https://mwclient.readthedocs.io/en/latest/ + +import datetime +import json + +import mwclient +from mwclient import Site +from secrets import BOTPASSWORD + + +site = Site("hub.xpub.nl", path="/sandbox/itchwiki/") +site.login("Bot", BOTPASSWORD) + +ask_query = """ +[[Topic::US Foreign Policy]] + |?Date + |?Part + |?Partof + |?Title + |format=broadtable + |limit=50 + |offset=0 + |link=all + |sort=Date,Title,Part + |order=asc,asc,asc + |headers=show + |searchlabel=... further results + |class=sortable wikitable smwtable +""" + +# Tested in the APISandbox +# See: https://hub.xpub.nl/sandbox/itchwiki/index.php/Special:ApiSandbox#action=ask&format=json&query=%5B%5BTopic%3A%3AUS%20Foreign%20Policy%5D%5D%20%20%7C%3FPart%20%20%7C%3FPartof%20%20%7C%3FTitle%20%20%7C%3FDate%20%20%7Cformat%3Dbroadtable%20%20%7Climit%3D50%20%20%7Coffset%3D0%20%20%7Clink%3Dall%20%20%7Csort%3D%20%20%7Corder%3Dasc%20%20%7Cheaders%3Dshow%20%20%7Csearchlabel%3D...%20further%20results%20%20%7Cclass%3Dsortable%20wikitable%20smwtable&formatversion=2 +# copy/paste the URL above and press "Make request" to see the results + +response = site.api("ask", query=ask_query, format="json") +results = response['query']['results'] + +# Results is a dictionary where the keys are wiki names like "File:KSP Kilusan Vol 2 Nos 2 and 3-26.jpg" +# results[wikiname] is then another dictionary with all the results specific to that item +for wikiname in results: + item = results[wikiname] + + # FOR DEBUGGING uncomment the print + # print (wikiname, json.dumps(item, indent=2)) + + date = datetime.date.fromtimestamp(int(item["printouts"]["Date"][0]['timestamp'])) + date_raw = item["printouts"]["Date"][0]['raw'] + title = item["printouts"]["Title"][0]["fulltext"] + part = int(item["printouts"]["Part"][0]) + partof = int(item["printouts"]["Partof"][0]) + + r = site.api("query", prop="imageinfo", \ + titles=wikiname, \ + iiprop="url", \ + iiurlwidth="80", \ + formatversion=2) + iinfo = r['query']['pages'][0]['imageinfo'][0] + thumburl = iinfo['thumburl'] + fullsizeurl = iinfo['url'] + filepageurl = iinfo['descriptionurl'] + # nb: the code lines *need* to be indented + # to stay INSIDE the loop + # the output text between the """ can break this rule + print (""" +

+

{} ({})

+

{}, Part {} of {}

+ +

+""".format(date, date_raw, title, part, partof, filepageurl, thumburl)) + + diff --git a/examples/example_ask_query.png b/examples/example_ask_query.png new file mode 100644 index 0000000..d6ed3dd Binary files /dev/null and b/examples/example_ask_query.png differ diff --git a/functions.py b/functions.py index 4c6b438..e376e46 100644 --- a/functions.py +++ b/functions.py @@ -3,12 +3,18 @@ import subprocess from datetime import datetime +def remove_nonwords(imgname): + filename, ext = os.path.splitext(imgname) # split into filename & extension + filename = re.sub(r'\W', '', filename) # remove nonwoders from filename + return f'{filename}{ext}' # join filename & ext' + + def pandoc(pwd, content, format_in, format_out): # print('HTML content file:', wiki_content_f.name) # tmp files mw_tmp_fn = os.path.join(pwd, '.mediawiki_content') - html_tmp_fn = os.path.join(pwd, '.html_content') # TODO: join with pw + html_tmp_fn = os.path.join(pwd, '.html_content') for fn in [mw_tmp_fn, html_tmp_fn ]: if os.path.isfile(fn) is False: os.mknod(fn) # create them if not in dir @@ -37,23 +43,24 @@ def unpack_response(response): printouts = response['printouts'] page = response['fulltext'] fullurl = response['fullurl'] - d['page'] = page - for prop in printouts: - p_item = response['printouts'][prop] - for prop_val in p_item: - if isinstance(prop_val, dict) is False: - d[prop] = prop_val - else: - # if len(prop_val) > 0: - props = list(prop_val.keys()) - if 'fulltext' in props: - val = prop_val.get('fulltext') - elif 'timestamp' in props: - val = datetime.fromtimestamp(int(prop_val.get('timestamp'))) - else: - val = list(prop_val.values())[0] - d[prop] = val - return page, d, fullurl + # convert OrderDict to Dict json.dumps json.loads + printouts_dumps = json.dumps(printouts) + printouts_loads = json.loads(printouts_dumps) + printouts_loads['page'] = page + simplified_printouts = {} + for k, v in printouts_loads.items(): + if k == 'Date': + simplified_printouts[k] = datetime.fromtimestamp( + int(v[0]['timestamp'])) + # elif k == 'Title': + # simplified_printouts[k] = v[0]['fulltext'] + elif k in ['Part', 'Partof', 'page']: # only 1 value for each + simplified_printouts[k] = v + else: # Possibly more than 1 value for the rest of properties + simplified_printouts[k] = [] + for listitem in v: + simplified_printouts[k].append(listitem['fulltext']) + return page, simplified_printouts, fullurl def update_json(imgsjson_fn, img_dict, img_fn): @@ -95,6 +102,7 @@ def clean_dir(dirfullpath): os.remove(f) def print_colormsg(msg, level): + color_cmd = '' if level == 'fail': color_cmd = Colors.FAIL elif level == 'warning': diff --git a/populate_title_pages.py b/populate_title_pages.py new file mode 100644 index 0000000..992e2b2 --- /dev/null +++ b/populate_title_pages.py @@ -0,0 +1,28 @@ +import os, argparse, sys, re, json +from mwclient import (Site, + errors) + +# API CALL +# https://hub.xpub.nl/sandbox/itchwiki/api.php?action=smwbrowse&browse=pvalue¶ms={ "limit": 1500, "offset": 0, "property" : "Title", "search": "" }&format=json +# generated orgs.json + +# login +site = Site(host='hub.xpub.nl/sandbox', path='/itchwiki/') + +wd =os.path.dirname(os.path.abspath(__file__)) # parent working directory +with open(os.path.join(wd, 'login.txt'), 'r') as login: # read login user & pwd + loginlines = login.read() + user, pwd = loginlines.split('\n') + site.login(username=user, password=pwd) # login to wiki + + +with open('titles.json', 'r') as f: + titles = json.load(f) + +for pagename in titles['query']: + if pagename != 'A Primer on the Tribal Filipinos in Agusan and Surigao': + # print(pagename) + page = site.pages[pagename] + print(page) + # text = page.text() + page.save('{{Publication}}\n[[Category:Title]]') diff --git a/query2html.py b/query2html.py index 018eb9a..0d51119 100644 --- a/query2html.py +++ b/query2html.py @@ -2,7 +2,7 @@ import os, json, sys, urllib from mwclient import Site from pprint import pprint from jinja2 import Template -from functions import pandoc, page_props, unpack_response, clean_dir +from functions import pandoc, unpack_response, clean_dir, remove_nonwords from functions import Colors import argparse @@ -15,7 +15,7 @@ p.add_argument("--conditions", "-c", metavar='', default='[[File:+]][[Title::+]][[Part::+]][[Date::+]]', help='The query conditions') p.add_argument("--printouts", "-p", metavar='', - default='?Title|?Date|?Part|?Partof|?Creator', + default='?Title|?Date|?Part|?Partof|?Creator|?Organization|?Format|?Event|?Topic|?Language', help='Selection of properties to printout') p.add_argument("--sort", "-s", metavar='', default='Date,Title,Part', @@ -23,6 +23,9 @@ p.add_argument("--sort", "-s", metavar='', p.add_argument("--order", "-o", metavar='', default='asc,asc,asc', help='Order of sorting conditions. Should same amount as the --sort properties') +p.add_argument('--limit', '-l', help='(optional) Limit the number of returned ' + 'items') +# TODO: GET limit to work.Perhaps with a site.raw_api method p.add_argument('--dry', '-d', action='store_true', help='dry-run: will only show the query but not run it') @@ -33,8 +36,10 @@ if len(args.sort.split(',')) != len(args.order.split(',')): Colors.WARNING, '--sort and --order do not have the same amount of elements', Colors.ENDC) print('Script exiting now') sys.exit() - query = f'{args.conditions}|{args.printouts}|sort={args.sort}|order={args.order}' +if args.limit: + limit_str = f'|limit={args.limit}' + query += limit_str print('query:', Colors.GREEN, query, Colors.ENDC) query_unquoted = urllib.parse.quote(query) query_url = f'https://{args.host}{args.path}api.php?action=ask&query={query_unquoted}&format=json' @@ -75,7 +80,7 @@ with open(os.path.join(wd, 'templates/document_part.html')) as document_html: all_document_parts = '' # to append all content documentslist = [] for answer in site.ask(query): - publication_title = '' + # publication_title = '' # print(answer, answer.keys()) page, printout_dict, fullurl = unpack_response(answer) print(page) @@ -85,11 +90,17 @@ for answer in site.ask(query): print(Colors.WARNING, f"{printout_dict['page']} is not is missing from the local downloaded images") print(Colors.GREEN, 'run python3 download_imgs.py to fix the issue', Colors.ENDC) sys.exit() + page = site.pages[[printout_dict['page']]] # request that page from wiki pagetext = page.text() pagetext_html = pandoc(pwd=wd, content=pagetext, format_in='mediawiki', format_out='html') img_local = os.path.join(imgdir, img_info.get('filename')) + # Todo: Create list of all images from document + # TODO: join document_part + document + # TODO: look into the template structure of images : columns and rows + + # RENDER document part document_part_html = document_part_template.render( printout_dict=printout_dict, @@ -101,16 +112,18 @@ for answer in site.ask(query): if printout_dict['Part'] == printout_dict['Partof']: # RENDER DOCUMENT # by passing all_document_parts html to document_template content - document_html = document_template.render(title=printout_dict.get('Title'), - date=printout_dict.get('Date'), - content=all_document_parts) # render document template - htmlpage_fn = "{}.html".format(printout_dict.get('Title').replace(" ", "")) + document_html = document_template.render( + title=printout_dict.get('Title'), + date=printout_dict.get('Date'), + content=all_document_parts) # render document template + htmlpage_fn = "{}.html".format( + remove_nonwords(printout_dict.get('Title')[0]) + ) with open(os.path.join(static_html, htmlpage_fn), 'w') as htmlfile: htmlfile.write(document_html) all_document_parts = '' # Reset all_document_parts # add info to documentslist for index creation - # TODO: possibly needs to be a SortedDict documentslist.append({'file': htmlpage_fn, 'title': printout_dict.get('Title'), 'date': printout_dict.get('Date'), diff --git a/sandbox/jinja_tutorial.py b/sandbox/jinja_tutorial.py new file mode 100644 index 0000000..10eb21c --- /dev/null +++ b/sandbox/jinja_tutorial.py @@ -0,0 +1,15 @@ +import os +from jinja2 import Template + +wd = os.path.dirname(os.path.abspath(__file__)) # working directory + +# read template files +with open(os.path.join(wd, '../templates/scatch.html')) as document_html: + template = Template(document_html.read()) + +imgs_list = ['images/01.jpg', 'images/02.jpg', 'images/03.jpg'] + +template_render = template.render(title=':) Hello Sandra', + imgs=imgs_list + ) +print(template_render) \ No newline at end of file diff --git a/static_website/item_page/1LiberationVol14No. 4.html b/static_website/item_page/1LiberationVol14No. 4.html new file mode 100644 index 0000000..375212e --- /dev/null +++ b/static_website/item_page/1LiberationVol14No. 4.html @@ -0,0 +1,137 @@ + + + + + + Liberation: Vol. 14 No. 4 + + +

Liberation: Vol. 14 No. 4 ↵

+

1986.6.1

+ + +
+ + + +
+ + + +
+ Title + View +
+ +
+ Date + Creator +
+ +
National Democratic Front (NDF) +
+ + + +
+ +
+ , National Democratic Front (NDF), Armed Forces of the Philippines (AFP), International Monetary Fund (IMF), Katipunan ng mga Gurong Makabayan (KAGUMA), Philippine Conference for Human Rights (PCHR), World Bank (WB), Kilusang Mayo Uno - May First Movement (KMU), Kabataang Makabayan - Patriotic Youth (KM), National Press Club (NPC), Ministry of National Defense (MND), National Intelligence Security Authority (NISA), Federation of Free Farmers (FFF), Integrated National Police (INP), Military Security Unit (MSU), Communist Party of the Philippines (CPP), Civilian Home Defense Force (CHDF), Communist Party of the Philppines & New Peoples Army (CPP-NPA), Kilusan ng Magbubukid ng Pilipinas (KMP), Trade Union Congress of the Philippines (TUCP), Military Intelligence Service (MIS), Movement of Concerned Citizens for Civil Liberties (MCCCL), Executive Committee of the Central Committee (of the CPP) (EC-CC), National Economic Protectionism Association (NEPA), Pambansang Lakas ng Kilusang Mamamalakaya ng Pilipinas (PAMALAKAYA-Pilipinas), Reform the AFP Movement (RAM), Presidential Security Command (PSC), Metrocom Intelligence and Security Group (MISG), Civilian Armed Geographical Unit (CAFGU), Katipunan Dagiti Mannalon ti Isabela (KAMI-KMP) +
+ +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + + +
+
+ + + + + diff --git a/static_website/item_page/2NineteenEightySickYearoftheLupus.html b/static_website/item_page/2NineteenEightySickYearoftheLupus.html new file mode 100644 index 0000000..cc73fc0 --- /dev/null +++ b/static_website/item_page/2NineteenEightySickYearoftheLupus.html @@ -0,0 +1,122 @@ + + + + + + Nineteen Eighty Sick: Year of the Lupus + + +

Nineteen Eighty Sick: Year of the Lupus ↵

+

1986.1.1

+ + +
+ + + +
+ + + +
+ Title + View +
+ +
+ Date + Creator +
+ +
Manuel Pamaran, Paki A. Lamero +
+ + + +
+
+ + +
+ +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + + + diff --git a/static_website/item_page/Freeallpoliticalprisonersoursolidaritywillsetthemfree.html b/static_website/item_page/Freeallpoliticalprisonersoursolidaritywillsetthemfree.html new file mode 100644 index 0000000..3fcf472 --- /dev/null +++ b/static_website/item_page/Freeallpoliticalprisonersoursolidaritywillsetthemfree.html @@ -0,0 +1,110 @@ + + + + + + Free all political prisoners: our solidarity will set them free + + +

Free all political prisoners: our solidarity will set them free ↵

+

1984.12.4

+ + +
+ + + +
+ + + +
+ Title + View +
+ +
+ Date + Creator +
+ + + + +
+ +
+ , Nationalist Alliance for Justice, Freedom and Democracy (NAJFD), Kapisanan para sa Pagpapalaya at Amnestiya ng mga Detenido sa Pilipinas - Association for the Release and Amnesty of Detainees in the Philippines (KAPATID) +
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + + + + diff --git a/static_website/item_page/HamokIsulongAngPambansangDemokratikongRebolusyon.html b/static_website/item_page/HamokIsulongAngPambansangDemokratikongRebolusyon.html new file mode 100644 index 0000000..c8f7cb2 --- /dev/null +++ b/static_website/item_page/HamokIsulongAngPambansangDemokratikongRebolusyon.html @@ -0,0 +1,113 @@ + + + + + + Hamok: Isulong Ang Pambansang Demokratikong Rebolusyon + + +

Hamok: Isulong Ang Pambansang Demokratikong Rebolusyon ↵

+

1977.6.12

+ + +
+ + + +
+ + + +
+ Title + View +
+ +
+ Date + Creator +
+ + + + + +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + + + diff --git a/static_website/item_page/MartsangBayan.html b/static_website/item_page/MartsangBayan.html new file mode 100644 index 0000000..e4a8a46 --- /dev/null +++ b/static_website/item_page/MartsangBayan.html @@ -0,0 +1,127 @@ + + + + + + Martsa ng Bayan + + +

Martsa ng Bayan ↵

+

1974.1.7

+ + +
+ + + +
+ + + +
+ Title + View +
+ +
+ Date + Creator +
+ +
Philippine Conference for Human Rights (PCHR) +
+ + + +
+ +
+ +
+ +
+
+ + + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + diff --git a/static_website/item_page/index.html b/static_website/item_page/index.html new file mode 100644 index 0000000..c5d796d --- /dev/null +++ b/static_website/item_page/index.html @@ -0,0 +1,39 @@ + + + + + + + + +

Results from query:
[[Format::Song]]

+ + + \ No newline at end of file diff --git a/static_website/item_page/style.css b/static_website/item_page/style.css new file mode 100644 index 0000000..538880d --- /dev/null +++ b/static_website/item_page/style.css @@ -0,0 +1,337 @@ + + +* { + box-sizing: border-box; +} + +body { + margin: 0; + font-family: Arial, Helvetica, sans-serif; + background-color: #aaa4a0; +} + +/*index page links*/ + +li a:hover { + text-decoration: none; + color: blue; +} + +a:link { + text-decoration: none; + color: black; +} + +a:visited { + text-decoration: none; + color: black; +} + +h1 { + position: fixed; + /*height: 50px; + width: auto;*/ + right:0%; + text-align: right; + background-color: grey; + padding: 3px 30px 3px 10px; +} + +h2, h3{ + position: fixed; + left: 0%; + top: 5%; + text-align: left; + background-color: grey; + padding: 3px 3px 3px 30px; +} + +.indexlist { + position: absolute; + top:20%; +} + + +.header { + /*display: inline-block;*/ + position: absolute; + text-align: center; + padding: 32px; + top: 15%; + right: 0%; + z-index: -1; +} + +.row { + display: -ms-flexbox; /* IE 10 */ + display: flex; + position: absolute; + -ms-flex-wrap: wrap; /* IE 10 */ + flex-wrap: wrap; + padding: 0 4px; + top: 35%; + z-index: -1; + +} + +/* Create two equal columns that sits next to each other */ +.column { + -ms-flex: 25%; /* IE 10 */ + flex: 25%; + padding: 0 4px; +} + +.column img { + margin-top: 8px; + vertical-align: middle; +} + +/* Style the buttons */ +.btn { + position: relative; + border: none; + outline: none; + width: 110px; + text-align: center; + padding: 12px 0px; + background-color: grey; + cursor: pointer; + font-size: 18px; + margin-right: 5px; +} + +.btn:hover { + background-color: black; + color: white; +} + +.active { + background-color: black; + color: white; +} + +/*metadata dropup*/ + +.dropbtn { + background-color: black; + color: white; + padding: 16px; + font-size: 16px; + border: none; + width: 200px; + +} + +.dropup { + position: absolute; + display: inline-block; +} + +.dropup-content { + display: none; + position: absolute; + background-color: black; + opacity: 0.8; + min-width: 160px; + bottom: 50px; + z-index: 1; + width: 300px; + color: grey; +} + +.dropup-content a { + color: grey; + padding: 12px 16px; + text-decoration: none; + display: block; +} + +.dropup-content a:hover {color: white;} + +.dropup:hover .dropup-content { + display: block; +} + +.dropup:hover .dropbtn { + background-color: grey; +} + +/*metadata dropdown*/ +.dropbtn { + position: fixed; + background-color: #4CAF50; + color: white; + padding: 16px; + font-size: 16px; + border: none; + cursor: pointer; + bottom:30%; +} + +.dropdown { + position: fixed; + display: inline-block; + bottom:30%; + width: 300px; +} + +.dropdown-content { + display: none; + position: absolute; + right: 0; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + z-index: 1; +} + +.dropdown-content a { + color: black; + padding: 12px 16px; + text-decoration: none; + display: block; +} + +.dropdown-content a:hover {background-color: #f1f1f1;} +.dropdown:hover .dropdown-content {display: block;} +.dropdown:hover .dropbtn {background-color: #3e8e41;} + + + + + +/*something*/ + + +#rightnav a { + position: absolute; + right: -90px; + /*top:10%;*/ + transition: 0.3s; + padding: 10px 50px 10px 30px; + width: 150px; + text-decoration: none; + font-size: 20px; + color: white; + border-radius: 0 5px 5px 0; + text-align: right; + font-size: 15px; +} + +#rightnav a:hover { + right: 0; + background-color: black; +} + +#title { + top: 10%; + background-color: black; +} + +#view { + top: 27%; + background-color: black; +} + +#leftnav a { + position: absolute; + left: -80px; + /*top:10%;*/ + transition: 0.3s; + padding: 10px 50px 10px 20px; + width: 125px; + text-decoration: none; + font-size: 20px; + color: white; + border-radius: 5px 0 0 5px; + text-align: right; + font-size: 15px; +} + +#leftnav a:hover { + left: 0; + background-color: black; +} + +#date { + top: 14%; + background-color: black; +} + +#creator { + top: 25%; + background-color: black; +} + +.metadata_Creator{ + position: absolute; + top:20%; + font-size: 18px; + background-color: grey; + padding: 3px 5px 3px 30px; + color: black; +} + +.metadata_Creator a:hover{ + color: blue; + text-decoration: none; +} + + + +#myDIV { + display: none; + position: absolute; + width: 48%; + height: auto; + left:26%; + top:15%; + /*padding: 50px 0;*/ + text-align: center; + background-color: grey; + margin-top: 20px; + z-index: 4; + opacity:0.8; + font-size: 15px; +} + +#myDIV a:hover{ + color: blue; +} + + +.orgbtn { + position: relative; + border: none; + outline: none; + width: 15%; + left:11%; + text-align: center; + padding-top: 12px; + padding-bottom: 12px; + background-color: grey; + color: grey; + cursor: pointer; + font-size: 18px; + /*margin-right: 5px;*/ +} + +.orgbtn:hover { + background-color: black; + color:white; +} + + +.square { + display: block; + position: absolute; + width: 50%; + height: 80%; + left:25%; + top:11%; + text-align: center; + background-color: transparent; + z-index: 2; + border-color: black; + border: solid 5px; +} \ No newline at end of file diff --git a/templates/document.html b/templates/document.html index 4748c77..72687fd 100644 --- a/templates/document.html +++ b/templates/document.html @@ -3,10 +3,10 @@ - {{title}} + {{ title[0] }} -

{{ title }}

+

{{ title[0] }}

{{ content }} diff --git a/templates/document_part.html b/templates/document_part.html index c435c5a..18bcebc 100644 --- a/templates/document_part.html +++ b/templates/document_part.html @@ -11,19 +11,21 @@

Metadata

- {% for key, value in printout_dict.items() %} - {% if key == 'Date' %} - {% endfor %}
-
diff --git a/templates/index.html b/templates/index.html index 55628bc..8e45d6e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,12 +5,12 @@ {{title}} -

Results from query:
{{query}}

+

Resultsss from query:
{{query}}

diff --git a/templates/scatch.html b/templates/scatch.html new file mode 100644 index 0000000..0ca2714 --- /dev/null +++ b/templates/scatch.html @@ -0,0 +1,13 @@ +

{{ title|upper }}

+ +
+
+ + {% for img in imgs %} + + {% endfor %} + +
+
+ +{{imgs}} \ No newline at end of file diff --git a/templates/smw_infobox_template.jinja b/templates/smw_infobox_template.jinja index 5461111..3e529c8 100644 --- a/templates/smw_infobox_template.jinja +++ b/templates/smw_infobox_template.jinja @@ -10,4 +10,3 @@ |Topic={{ topic }} |Language={{ language }} {{ '}}' }} -[[Template:ImageMetadata]] diff --git a/titles.json b/titles.json new file mode 100644 index 0000000..ee9efff --- /dev/null +++ b/titles.json @@ -0,0 +1 @@ +{"query":["Signs of the Times","Trimestrial Report- Political Detainees Vol.1","The review","WHO","Update Factsheet","Justice Delayed, Justice Denied Rolieto Trinidad, et al: an Update","Sunday Vol 2 No 6 (1)","Sunday Vol 2 No 6 (2)","Sunday Vol 2 No 6 (3)","Sunday Vol 2 No 6 (4)","Sunday Vol 2 No 6 (5)","Sunday Vol 2 No 6 (6)","Sunday Vol 2 No 6 (7)","Sunday November 18, 1984 (1)","Sunday November 18, 1984 (2)","Sunday November 18, 1984 (3)","Sunday November 18, 1984 (4)","Sunday November 18, 1984 (5)","Sunday November 18, 1984 (6)","Sunday November 18, 1984 (7)","Sunday November 18, 1984 (8)","Sunday November 18, 1984 (13)","Sunday November 18, 1984 (15)","Ang Bayan: Vol. 16 No. 10","Ang Gabay: Vol. 1 No. 1","A Primer on the Tribal Filipinos in Agusan and Surigao","Call for an Independent, Democratic and Nuclear-Free Philippines: Vol. 1 No. 2","Batasan Resolution: Nos. 39 and 127","Courier: Vol. 2 No. 5","Fast for Justice, Freedom and General Amnesty","Commitment: Strive for National Unity, Struggle for Democracy","Insurgency Beginning Crucial Urban Struggle","Kaguma: Series No. 1","Kalinangan: Vol. 5 No. 3 (Pagdatal'85)","Statement on the Death of Ninoy Aquino","I Kalinangan: Vol. 1 No. 5","Makiisa Sa Lakbay Ng Bayan Para Sa Boykot","Uphold Human Rights! Boycott the 1984 BP Elections","Mensahe Mula Kay Ka Bert Olalia, Tagapangulo ng Kmu","BAYAN","Panahon na ng Pagbabago Tinie ng Tao - IPAGLABAN sa Sendo!","Primer for Nationalist and Democratic Charter","Pahayag ng Pagkakaisa sa Lakbayan","Ang Mga Welga Sa Ating Panahon","Lansagin Ang Diktadurang EU- Marcos Boyktin Ang \u201cEleksyon\u201d","Dalawang Pahayag","People's Assembly on the Pope's Arrival","Ilantad ang Huwad Na Pag-Alis ng Batas Militar","Sunog","Mga Mamamayan ng Tundo","Higit Pang Isulong ang Kilusan Para sa Demokratikong Reporma!","Gising, Aping Manggagawa!","Political Prisoners Open Letter to Filipino People","Strengthen Our Unity in the Fight for Our Democratic Demands","Day of Reckoning","Now... the How of Boycott","Manifesto of Metro Manila Student Leaders","People's Congress for Justice, Freedom and Democracy","Resolution on a Year Long Campaign on Human Rights","Katarungan: Vol. 3 No. 7","Liberation: Special Issue No. 2","Liberation: Special Issue No. 4","Singgit: Vol. 2 No. 6","Nineteen Eighty Sick: Year of the Lupus","Nassa News: Vol. 21 No. 7","Katarungan: Vol. 4 No. 1","Liberation: Vol. 14 No. 2","Liberation: Vol. 11 No. 1","KSP Kilusan: Vol. 2 Nos. 2 and 3","Katarungan: Vol. 2 No. 1","Letter to President Marcos","Letter of Support","Open Letter to the President","Isabela Dossier","Liham para sa Magulang, Anak, Kapatid at mga Kasama","The Trial of September 19: Filipino People vs. The Military Commission","The Lessons of Martial Law","Picketline Diary of Artex Corp.","Primer on the Virginia Tobacco Industry","List of Detained Workers","Cries From the Countryside","Political Detention: The Struggle Goes On!","Batangas: Plundered by Militarization","Low Intensity Conflict and Vigilante Groups","Discussion Papers: Human Rights and the New Counter Insurgency","Crooks and Rulers: Corruption as Instrument of Imperialist Policy","The Philippine Program for Economic Recovery","Discussion Outline: Hidden Wealth","Philippine News and Features","Philippine News and Features: Vol. 1 No. 50","Primer on Militarization","Tambalan: No. 26","Panitikan Mula Sa Masa At Tungo Sa Masa","An Irrepressible Revolution: The Decline and Resurgence of the Philippine Communist Movement","Babala","The Logistics of Repression","Militarization in Moroland","Bulletin Today","South: The Third World Magazine","Ways of Torture","Manifesto","Makibaka: Malayang Kilusan ng Bagong Kababaihan","Nagkakaisang Paninindigan: Huwad ang Ating Kalayaan","Ibasura ang PDA! Wakasan ang di-maktarungang pagpipiit!","Butas na Bulsa: Nadukutan Pa!","Scrap the National Service Law: Statement of MAKABAYAN","Philippine Collegian: Oil Imperialism Responsible for Starvation in Biafra","Commitment: Vol. 7 No. 1","Commitment: Vol. 8 No. 2","Manifesto of Teachers in Distress","Draft: Restore Priority for Education in the National Budget","The Philippine Educational System","Kamtin ang Tagumpay","Nagkaisang Tugon: General Program of Action","An Unholy Alliance","Vote Chito Gascon","Manifesto for a Democratic and Independent Philippines","Manipesto ng Samahan ng mga Manggagawa sa Timog Katagalugan","Civil Liberties Union of the Philippines: Return to Freedom","Bicutan Detainees' Letter to PANORAMA","The UP Barricades: A United Response","Free Josa Ma. Sison Committee: Statement on the Fast for Freedom, Justice and General Amnesty","Free All Political Prisoners: Our Solidarity Will Set Them Free","Violation of Human Rights in the Philippines","Fellow Administrators...","Isulong ang Pamumuno ng Uring Manggagawa sa Pakikibaka ng Sambayanan!","Ipagbunyi ang lumalakas na Paglaban ng Mamamayan","KOMPIL Invitation","Manifesto of Freedom, Democracy and Sovereignty","On the Abduction and Continued Detention of Cynthia Nolasco, Mila Aguilar and Willie Tolentino","Formal Launching: International Solidarity Week/International Day of Protest","The Economics for Times","Tatalon Masaker","What\u2019s Behind the Educational Act of 1982?","Singgit: Vol. 4 No. 3","Malaya: 'Terror' Plot Underway","Tinig ng Kabataan: Vol. 1 No. 3","Peace Tour Tells Metro Students of Horrors of Living With War","Commitment: Special Issue","Malaya: A story of Valor","Manila Hotline: Vol. 2 No. 8","Sambayanan","Gains Problems and Prospects of the Peace Talks between the NDFP and the GRP","Pambansa Demokratikong Paaralan","National Democratic Front","First Municipal Congress Program","Statement on the 35th Anniversary of The Declaration of Human Rights","Statement on the May 11 Elections","IDF-IAS Lecture Series: Ideology","IDF-IAS Lecture Series: Marxist Social Science","IDF-IAS Lecture Series: Socialism and Communism","Bayan Liturhiya","Breakaway Factions in Fragments","Kalatas: Vol. 18 No. 1","Liberation: Vol. 15 No. 1","Liberation: Vol. 17 No. 2","Liberation: Vol. 17 No. 4","Liberation: Vol. 16 No. 1","Liberation: Vol. 14 No. 4","Liberation: Special Release No. 3","Himagsik: Vol. 19 No. 7","Himagsik: Vol. 19 No. 6","Himagsik Vol. 19 No. 5","Himagsik: Vol. 19 No. 3","Himagsik: Vol. 20 No. 1","Kalayaan","Selected Readings: No. 3","Kurso Hinggil sa Rebolusyong Tsino","Free Antonio Moncupa Jr","IChThYS: Vol. 2 No. 1","IChThYS: Vol. 1 No. 14","Labanan ang Militarisasyon","Manalagna: Vol. 2 No. 6","Manalagna: Vol. 2 No. 1","Manifesto Against Tyranny and Oppression","Manila Hotline: In Laguna Raid","Martsa ng Bayan","Kaakbay: A Call to Collective Non-Cooperation","Political Detainees Update: Negros Occidental","Boycott the Meaningless Elections! Join the Noise Barrage","Pahatid Kapatid: Vol. 4 No. 4","Pahatid Kapatid: Vol. 5 Nos. 9 and 10","People's Resistance: Special Issue","National Day of Sorrow","A Message to the Filipino People","Pakikibaka ng Manggagawa, Pakikibaka ng Buong Sambayanan","Mayo Uno... Araw ng Pagkakaisa, Araw ng Protesta!","Unang Pambansang Kongreso Ng Magbubukid","Welcome to the Launching of the Resources for People Program","People's Resistance: Vol. 1 No. 5","Boycott the May 14 Elections","Walang Kompromiso sa mga Loyalistang Pasista!","People's Resistance: Vol. 1 No. 7","People's Resistance: Vol. 1 Special Issue","Philippine Trade Union Reports Repression: Vol. 1 No. 1","Praksis: No. 1","Praksis: No. 2","Mayo Uno: Makasaysayang Martsa ng Manggagawa Para sa Uri, Para sa Bayan!","Bangon","Hamok: Isulong Ang Pambansang Demokratikong Rebolusyon","Isang Bukas Na Pahayag","Press Statement","Preventive Detention Action","Pulang Bandila: Vol. 1 No. 2","Report of the Fact-Finding Mission to Bohol","Report of the Fact-Finding Mission to Davao City","Signos, Concerned Artists of the Philippines: Official Newsletter No. 5","Sikat: Vol. 7 No. 7","Mamamayan ng Marikina: Sulong at Makibaka para sa Tunay na Kalayaan at Ganap na Demokrasya","Isang Liham Mula Sa Pamilya ng Isang Biktima ng Militarisasyon Sa Nueva Fcija","Through the Bars, Transform Captivity Into Revolutionary Art.","To Give My People a Rousing Spring","Kaakbay: The May \"Election\" -- Who Won?","Statement on Rice Crisis","ATOMs Position Paper on US Bases","Dept of Field","Presidential Decree No. 1706","Statement of President Marcos on the Proclamation of Martial Law","Proclamation No. 1081: Proclaiming a State of Martial Law in the Philippines","The United States and the Philippines: A Study of Neocolonialism","Victims Without Voice: Human Rights Violations Against Children","Open Letter to the Workers of the World","A Statement of the Ecumenical Movement for Justice and Peace","Speech by Jose W. Diokno","Parish of the Sacred Heart","An Open Letter to Our Fellow Countrymen","Letter to President F. E. Marcos","Everything Was Just Extraordinary","Hagkis","Philippine Collegian: Fighting with Various Forms","Balita: Reopen Probe on Dead Priest!","Everything You Wanted to Know About Puppets","The Truth Behind the PCO","Bakit Ganito? Hanggang Kailan pa Tayo Magtitiis?","Alay sa Manggagawa","Kalayaan: Vol. 12 No. 1","Boykot: Karapatan ng Bawat Mamamayan","Bukas na Liham: Mga Kababayan","Bukas na Liham: Mga Kalalawigan","The Rosarian: Bukas na Liham","A Compact for a Democratic & Independent Philippines","The Chill on Human Violence Continues","Balita: 11 Farmers, Stude Killed by Military","Surigao del Sur Fact-Finding Mission Report","Mindanao Spectrum: Vol.3 No.6","Surigao Inquirer: Vol.5 No.151","The Manila Chronicle: Ferrer to See Bishop Accused of NDF Links","The Manila Chronicle: Surigao Mayor Fired","The Pacific Times: Cantillan Rejects Bantay Bayan","The Pacific Times: Vol.9 No.19"],"query-continue-offset":0,"version":1,"meta":{"type":"pvalue","limit":1500,"count":250,"queryTime":0.02766}} \ No newline at end of file