This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//content/cayw/formatter.ts | |
Components.utils.import("resource://gre/modules/AddonManager.jsm"); | |
import { Translators } from "../translators"; | |
import { getItemsAsync } from "../get-items-async"; | |
import { Preference } from "../../gen/preferences"; | |
import { log } from "../logger"; | |
import { fromEntries } from "../object"; | |
import * as unicode_table from "unicode2latex/tables/unicode.json"; | |
const unicode2latex = fromEntries(Object.entries(unicode_table).map(([unicode, latex]) => [unicode, { text: latex.text || latex.math, math: !latex.text }])); | |
function tolatex(s) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/member-ordering */ | |
Components.utils.import('resource://gre/modules/osfile.jsm') | |
import { log } from '../../logger' | |
// Components.utils.import('resource://gre/modules/Sqlite.jsm') | |
// declare const Sqlite: any | |
export class File { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Components.utils.import("resource://gre/modules/AddonManager.jsm"); | |
import { Translators } from "../translators"; | |
import { getItemsAsync } from "../get-items-async"; | |
import { Preference } from "../../gen/preferences"; | |
import { log } from "../logger"; | |
import { fromEntries } from "../object"; | |
import * as unicode_table from "unicode2latex/tables/unicode.json"; | |
const unicode2latex = fromEntries(Object.entries(unicode_table).map(([unicode, latex]) => [unicode, { text: latex.text || latex.math, math: !latex.text }])); | |
function tolatex(s) { | |
if (!s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# run as ris.py importdir1 importdir2 ... | |
import glob, sys, os, re | |
for importdir in sys.argv[1:]: | |
importdir = os.path.abspath(os.path.expanduser(importdir)) | |
ris = '' | |
for pdf in glob.glob(os.path.join(importdir, '*.pdf')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# run as ris.py importdir1 importdir2 ... | |
import glob, sys, os, re | |
for importdir in sys.argv[1:]: | |
importdir = os.path.abspath(os.path.expanduser(importdir)) | |
ris = '' | |
for pdf in glob.glob(os.path.join(importdir, '*.pdf')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# run as ris.py importdir1 importdir2 ... | |
import glob, sys, os, re | |
for importdir in sys.argv[1:]: | |
importdir = os.path.abspath(os.path.expanduser(importdir)) | |
ris = '' | |
for pdf in glob.glob(os.path.join(importdir, '*.pdf')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# run as ris.py importdir1 importdir2 ... | |
import glob, sys, os, re | |
ris = '' | |
for importdir in sys.argv[1:]: | |
for pdf in glob.glob(os.path.join(importdir, '*.pdf')): | |
m = re.match(r'^(.+?)@(.+?)\$(.+?).pdf$', os.path.basename(pdf)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import glob, sys, os, re | |
ris = '' | |
for importdir in sys.argv[1:]: | |
for pdf in glob.glob(os.path.join(importdir, '*.pdf')): | |
m = re.match(r'^(.+?)@(.+?)\$(.+?).pdf$', os.path.basename(pdf)) | |
if m: | |
title, author, year = [g.strip() for g in m.groups()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"translatorID": "32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7", | |
"label": "RIS", | |
"creator": "Simon Kornblith and Aurimas Vinckevicius", | |
"target": "ris", | |
"minVersion": "3.0.4", | |
"maxVersion": "", | |
"priority": 100, | |
"configOptions": { | |
"async": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare interface DirectoryIterator { | |
forEach: (handler: any) => Promise<void> | |
} | |
declare interface DirectoryIteratorConstructable { | |
new(path: string): DirectoryIterator | |
} | |
export declare const OS: { | |
File: { | |
exists: (path: string) => Promise<boolean> |