<reponame>lookforhan/zotero-better-bibtex
#!/usr/bin/env python3

from munch import *

templates = [
  Munch(
    name='Export',
    title='Export bug/enhancement/question',
    about='You appear to have found a bug in BBTs export, are proposing an enhancement to the exports, or have a question about exporting items.',
    labels='bug',
  ),
  Munch(
    name='General_error',
    title='General error',
    about='You are experiencing an error not covered by the other categories',
    labels='bug'
  ),
  Munch(
    name='Import',
    title='Import bug/enhancement/question',
    about='You appear to have found a bug in BBTs BibTeX import, are proposing an enhancement to the import, or have a question about importing BibTeX.',
    labels='bug'
  ),
  Munch(
    name='Key_generation',
    title='Key generation bug/enhancement/question',
    about='You appear to have found a bug in BBTs citation key generation, are proposing an enhancement to the key generation, or have a question about key generation.',
    labels='bug'
  ),
  Munch(
    name='Question',
    title='Question on use, or feature suggestions, not covered by the other categories above.',
    about='You want information on how to use BBT, or have an idea for improvement that is not one of the categories above.',
    labels='question'
  ),
]

for template in templates:
  with open(f'ISSUE_TEMPLATE/{template.name}.md', 'w') as f:
    print('---', file=f)
    print(f'name: {template.title}', file=f)
    print(f'about: {template.about}', file=f)
    if 'labels' in template: print(f'labels: {template.labels}', file=f)
    print('---', file=f)

    action = iter(range(1,20))
    print('', file=f)
    print('<!--', file=f)
    print('*Please verify **all** of the below before submitting*:', file=f)
    print('', file=f)

    print(f'{next(action)}. you have picked the right category for the issue in the previous screen.', file=f)
    print(f'{next(action)}. in the Zotero addons screen you can see that you have the latest release of BBT (https://github.com/retorquere/zotero-better-bibtex/releases/latest) and Zotero installed', file=f)

    if template.name in ['Key_generation', 'Import', 'Export', 'General_error']:
      print(f'{next(action)}. you are posting a single bug or feature request', file=f)
    elif template.name in ['Question']:
      print(f'{next(action)}. you are posting a single question', file=f)
  
    print(f'{next(action)}. you have included a descriptive subject of the problem', file=f)
    print(f'{next(action)}. you are available for follow-up questions and testing', file=f)

    if template.name in ['Import']:
      print(f'{next(action)}. you have attached a copy of the BibTeX you were trying to import to this issue.', file=f)

    if template.name in ['Key_generation', 'Export']:
      print(f'{next(action)}. you have included an error-report ID here generated by reproducing the problem, selecting the problematic reference(s), right-clicking, and submitting an BBT error report from that popup menu', file=f)
      print(f'{next(action)}. you have included the actual output you got from exporting the items you sent in the debug log, not simplified fictional output, and a sample of you you want it to look, again based on the actual items under consideration', file=f)
    elif template.name in ['Import', 'General_error']:
      print(f'{next(action)}. you have included an error-report ID here generated by restarting Zotero with debugging enabled (Help -> Debug Output Logging -> Restart with logging enabled), reproducing your problem, and selecting "Report Better BibTeX error" from the help menu', file=f)

    print('', file=f)

    print("Picking the right issue category is really important. Each category (" + ', '.join([f'`{template.name.replace("_", " ")}`' for template in templates]) + ") has different instructions for gathering the data necessary required to resolve the issue you are experiencing", file=f)
    print('', file=f)

    if template.name in ['Export', 'Key_generation']:
      print("The error report is important; it gives me your current BBT settings and a copy of the problematic reference as a test case so I can best replicate your problem. Without it, I'm effectively blind.", file=f)
      print('', file=f)
    elif template.name in ['General_error']:
      print("The error-report is important; it gives me your current BBT settings and a log of what Zotero was doing at the time of error. Without it, I'm effectively blind.", file=f)
      print('', file=f)
    elif template.name in ['Import']:
      print("The error-report is important; it gives me your current BBT settings and a log of what Zotero was doing at the time of import. Without it, I'm effectively blind.", file=f)
      print('', file=f)

    print('-->', file=f)
    print('', file=f)

    if template.name != 'Question':
      print('**Report ID:**', file=f)
      print('', file=f)

    if template.name in ['Export']:
      print('**Exporter used:**', file=f)
      print('', file=f)
    elif template.name in ['Import']:
      print('**Full Bib(La)TeX item you are trying to import:**', file=f)
      print('', file=f)

    if template.name == 'Question':
      print('**Your question/suggestion:**', file=f)
      print('', file=f)
    else:
      print('**Expected behavior:**', file=f)
      print('', file=f)

      print('**Actual behavior:**', file=f)
      print('', file=f)



#!/usr/bin/env python3

from munch import *

templates = [
  Munch(
    name='Export',
    title='Export bug/enhancement/question',
    about='You appear to have found a bug in BBTs export, are proposing an enhancement to the exports, or have a question about exporting items.',
    labels='bug',
  ),
  Munch(
    name='General_error',
    title='General error',
    about='You are experiencing an error not covered by the other categories',
    labels='bug'
  ),
  Munch(
    name='Import',
    title='Import bug/enhancement/question',
    about='You appear to have found a bug in BBTs BibTeX import, are proposing an enhancement to the import, or have a question about importing BibTeX.',
    labels='bug'
  ),
  Munch(
    name='Key_generation',
    title='Key generation bug/enhancement/question',
    about='You appear to have found a bug in BBTs citation key generation, are proposing an enhancement to the key generation, or have a question about key generation.',
    labels='bug'
  ),
  Munch(
    name='Question',
    title='Question on use, or feature suggestions, not covered by the other categories above.',
    about='You want information on how to use BBT, or have an idea for improvement that is not one of the categories above.',
    labels='question'
  ),
]

for template in templates:
  with open(f'ISSUE_TEMPLATE/{template.name}.md', 'w') as f:
    print('---', file=f)
    print(f'name: {template.title}', file=f)
    print(f'about: {template.about}', file=f)
    if 'labels' in template: print(f'labels: {template.labels}', file=f)
    print('---', file=f)

    action = iter(range(1,20))
    print('', file=f)
    print('<!--', file=f)
    print('*Please verify **all** of the below before submitting*:', file=f)
    print('', file=f)

    print(f'{next(action)}. you have picked the right category for the issue in the previous screen.', file=f)
    print(f'{next(action)}. in the Zotero addons screen you can see that you have the latest release of BBT (https://github.com/retorquere/zotero-better-bibtex/releases/latest) and Zotero installed', file=f)

    if template.name in ['Key_generation', 'Import', 'Export', 'General_error']:
      print(f'{next(action)}. you are posting a single bug or feature request', file=f)
    elif template.name in ['Question']:
      print(f'{next(action)}. you are posting a single question', file=f)
  
    print(f'{next(action)}. you have included a descriptive subject of the problem', file=f)
    print(f'{next(action)}. you are available for follow-up questions and testing', file=f)

    if template.name in ['Import']:
      print(f'{next(action)}. you have attached a copy of the BibTeX you were trying to import to this issue.', file=f)

    if template.name in ['Key_generation', 'Export']:
      print(f'{next(action)}. you have included an error-report ID here generated by reproducing the problem, selecting the problematic reference(s), right-clicking, and submitting an BBT error report from that popup menu', file=f)
      print(f'{next(action)}. you have included the actual output you got from exporting the items you sent in the debug log, not simplified fictional output, and a sample of you you want it to look, again based on the actual items under consideration', file=f)
    elif template.name in ['Import', 'General_error']:
      print(f'{next(action)}. you have included an error-report ID here generated by restarting Zotero with debugging enabled (Help -> Debug Output Logging -> Restart with logging enabled), reproducing your problem, and selecting "Report Better BibTeX error" from the help menu', file=f)

    print('', file=f)

    print("Picking the right issue category is really important. Each category (" + ', '.join([f'`{template.name.replace("_", " ")}`' for template in templates]) + ") has different instructions for gathering the data necessary required to resolve the issue you are experiencing", file=f)
    print('', file=f)

    if template.name in ['Export', 'Key_generation']:
      print("The error report is important; it gives me your current BBT settings and a copy of the problematic reference as a test case so I can best replicate your problem. Without it, I'm effectively blind.", file=f)
      print('', file=f)
    elif template.name in ['General_error']:
      print("The error-report is important; it gives me your current BBT settings and a log of what Zotero was doing at the time of error. Without it, I'm effectively blind.", file=f)
      print('', file=f)
    elif template.name in ['Import']:
      print("The error-report is important; it gives me your current BBT settings and a log of what Zotero was doing at the time of import. Without it, I'm effectively blind.", file=f)
      print('', file=f)

    print('-->', file=f)
    print('', file=f)

    if template.name != 'Question':
      print('**Report ID:**', file=f)
      print('', file=f)

    if template.name in ['Export']:
      print('**Exporter used:**', file=f)
      print('', file=f)
    elif template.name in ['Import']:
      print('**Full Bib(La)TeX item you are trying to import:**', file=f)
      print('', file=f)

    if template.name == 'Question':
      print('**Your question/suggestion:**', file=f)
      print('', file=f)
    else:
      print('**Expected behavior:**', file=f)
      print('', file=f)

      print('**Actual behavior:**', file=f)
      print('', file=f)
#!/usr/bin/env python3