Esempio n. 1
0
def construct_index():
    root = SchemaNode()
    root.add_title('Chesed LeAvraham', 'en', primary=True)
    root.add_title(u'חסד לאברהם', 'he', primary=True)
    root.key = 'Chesed LeAvraham'

    intro = JaggedArrayNode()
    intro.add_title('Introduction', 'en', primary=True)
    intro.add_title(u'הקדמה', 'he', primary=True)
    intro.key = 'Introduction'
    intro.depth = 1
    intro.sectionNames = ['Paragraph']
    intro.addressTypes = ['Integer']
    intro.validate()
    root.append(intro)

    even = JaggedArrayNode()
    even.add_title('Even Shetiya', 'en', primary=True)
    even.add_title(u'אבן שתיה', 'he', primary=True)
    even.key = 'Even Shetiya'
    even.sectionNames = ['Maayan']
    even.depth = 1
    even.addressTypes = ['Integer']

    maayanot = [u'עין כל', u'עין הקורא', u'עין הארץ', u'עין יעקב', u'עין משפט', u'עין גנים', u'עין גדי']
    for i, title in enumerate(maayanot):
        node = JaggedArrayNode()
        node.add_title('Maayan {}'.format(i+1), 'en', primary=True)
        node.add_title(title, 'he', primary=True)
        node.key = 'Maayan {}'.format(i+1)
        node.depth = 2
        node.sectionNames = ['Nahar', 'Paragraph']
        node.addressTypes = ['Integer', 'Integer']
        node.validate()
        even.append(node)
    even.validate()
    root.append(even)

    breichat = JaggedArrayNode()
    breichat.add_title('Breichat Avraham', 'en', primary=True)
    breichat.add_title(u'בריכת אברהם', 'he', primary=True)
    breichat.key = 'Breichat Avraham'
    breichat.depth = 2
    breichat.sectionNames = ['Shoket', 'Paragraph']
    breichat.addressTypes = ['Integer', 'Integer']
    breichat.validate()
    root.append(breichat)

    root.validate()
    return {
        'title': 'Chesed LeAvraham',
        'categories': ['Kabbalah'],
        'schema': root.serialize()
    }
Esempio n. 2
0
    def test_presentation_and_default(self):
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)

        j2 = JaggedArrayNode()
        j2.key = "default"
        j2.default = True
        j2.depth = 1
        j2.sectionNames = ["Foo"]
        j2.addressTypes = ["Integer"]
        s.append(j2)

        assert not s.has_titled_continuation()

        j = JaggedArrayNode()
        j.key = "child1"
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.add_title("Child 1", "en", primary=True)
        j.add_title("Sweet Child", "en", presentation="alone")
        j.add_title("Sweet Child of Mine", "en", presentation="both")
        s.append(j)

        s.validate()

        assert s.has_titled_continuation()
        assert s.has_numeric_continuation()
        assert not j.has_titled_continuation()
        assert not j2.has_titled_continuation()
        assert j2.has_numeric_continuation()
        assert j.has_numeric_continuation()

        td = s.title_dict()
        assert len(td) == 7

        target = {
            'root': j2,
            'root, Child 1': j,
            'root, Sweet Child of Mine': j,
            'root Child 1': j,
            'root Sweet Child of Mine': j,
            'Sweet Child of Mine': j,
            'Sweet Child': j,
        }

        assert td == target
Esempio n. 3
0
    def test_default_chain(self):
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)
        s.add_title("alt root", "en")

        s2 = SchemaNode()
        s2.key = "default"
        s2.default = True
        s2.append_to(s)

        j = JaggedArrayNode()
        j.key = "default"
        j.depth = 1
        j.default = True
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.append_to(s2)

        s.validate()

        assert s.has_numeric_continuation()
        assert s2.has_numeric_continuation()
        assert j.has_numeric_continuation()
        assert not s.has_titled_continuation()
        assert not s2.has_titled_continuation()
        assert not j.has_titled_continuation()
Esempio n. 4
0
def post_yitzira():
    node = JaggedArrayNode()
    node.add_title('Sefer Yetzirah', 'en', primary=True)
    node.add_title(u'ספר יצירה', 'he', primary=True)
    node.key = 'Sefer Yetzirah'
    node.depth = 2
    node.addressTypes = ['Integer', 'Integer']
    node.sectionNames = ['Chapter', 'Mishnah']
    node.validate()

    y_index = {
        'title': 'Sefer Yetzirah',
        'categories': ['Kabbalah'],
        'language': 'he',
        'schema': node.serialize()
    }

    y_version = {
        'versionTitle': 'Sefer Yetzirah, Warsaw 1884',
        'versionSource': 'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
        'language': 'he',
        'text': parse_yitzira()
    }
    post_index(y_index)
    post_text("Sefer Yetzirah", y_version, index_count='on')
Esempio n. 5
0
def build_index(titles):

    struct_node = JaggedArrayNode()
    struct_node.add_title('Sefer HaKana', 'en', primary=True)
    struct_node.add_title(u'ספר הקנה', 'he', primary=True)
    struct_node.key = 'Sefer HaKana'
    struct_node.depth = 2
    struct_node.addressTypes = ['Integer', 'Integer']
    struct_node.sectionNames = ['Chapter', 'Comment']
    struct_node.add_title('Sefer HaQana', 'en')
    struct_node.add_title('Sefer HaQanah', 'en')
    struct_node.add_title('Sefer Hakana', 'en')
    struct_node.add_title('Sefer HaKanah', 'en')
    struct_node.validate()

    alt_struct = TitledTreeNode()
    for index, title in enumerate(titles):
        i = index + 1
        node = ArrayMapNode()
        node.add_title('Chapter {}'.format(i), 'en', primary=True)
        node.add_title(title.replace(u'ד"ה ', u''), 'he', primary=True)
        node.depth = 0
        node.wholeRef = 'Sefer HaKana {}'.format(i)
        alt_struct.append(node)

    return {
        'title': 'Sefer HaKana',
        'categories': ['Kabbalah'],
        'schema': struct_node.serialize(),
        'alt_structs': {'Titles': alt_struct.serialize()}
    }
Esempio n. 6
0
    def test_jaggedarray_fields(self):

        j = JaggedArrayNode()
        j.add_title(u"title1", "en", primary=True)\
         .add_title(u"ייי", "he", primary=True)\
         .add_title(u"title2", "en")\
         .add_title(u"ייכי", "he")
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.key = "bob"

        j.validate()

        for f in ["depth", "sectionNames", "addressTypes", "key"]:
            t = copy.deepcopy(j)
            delattr(t, f)

            with pytest.raises(IndexSchemaError):
                t.validate()

        t = copy.deepcopy(j)
        t.sectionNames += ["foob"]
        with pytest.raises(IndexSchemaError):
            t.validate()

        t = copy.deepcopy(j)
        t.addressTypes += ["Integer"]
        with pytest.raises(IndexSchemaError):
            t.validate()
Esempio n. 7
0
def create_jagged_array_node():
    jagged_array_node = JaggedArrayNode()
    jagged_array_node.key = 'default'
    jagged_array_node.default = True
    jagged_array_node.depth = 1
    jagged_array_node.addressTypes = ["Integer"]
    jagged_array_node.sectionNames = ["Comment"]
    return jagged_array_node
Esempio n. 8
0
def create_commentary_node():
    commentary = JaggedArrayNode()
    commentary.default = True
    commentary.key = 'default'
    commentary.depth = 3
    commentary.addressTypes = ["Integer", "Integer", "Integer"]
    commentary.sectionNames = ["Perek", "Pasuk", "Comment"]
    return commentary
Esempio n. 9
0
def create_default_nodes():
    default_node = JaggedArrayNode()
    default_node.key = "default"
    default_node.default = True
    default_node.depth = 1
    default_node.addressTypes = ["Integer"]
    default_node.sectionNames = ["Comment"]
    return default_node
def create_commentary_node():
    commentary = JaggedArrayNode()
    commentary.default = True
    commentary.key = 'default'
    commentary.depth = 3
    commentary.addressTypes = ["Integer", "Integer", "Integer"]
    commentary.sectionNames = ["Perek", "Pasuk", "Comment"]
    return commentary
Esempio n. 11
0
def create_jagged_array_node():
    jagged_array_node = JaggedArrayNode()
    jagged_array_node.key = 'default'
    jagged_array_node.default = True
    jagged_array_node.depth = 1
    jagged_array_node.addressTypes = ["Integer"]
    jagged_array_node.sectionNames = ["Comment"]
    return jagged_array_node
def create_default_nodes():
    default = JaggedArrayNode()
    default.default = True
    default.key = 'default'
    default.depth = 2
    default.addressTypes = ["Integer", "Integer"]
    default.sectionNames = ["Mitzvah", "Comment"]
    return default
Esempio n. 13
0
def create_default_nodes():
    default_node = JaggedArrayNode()
    default_node.key = 'default'
    default_node.default = True
    default_node.depth = 1
    default_node.addressTypes = ["Integer"]
    default_node.sectionNames = ["Comment"]
    return default_node
Esempio n. 14
0
def post_simple_commentaries():
    ramban_node, rasag_node = JaggedArrayNode(), JaggedArrayNode()
    ramban_text = parse_general('yitzira_ramban.txt')
    rasag_text = parse_general('yitzira_rasag.txt')

    ramban_node.add_title("Ramban on Sefer Yetzirah", 'en', primary=True)
    ramban_node.add_title(u'רמב"ן על ספר יצירה', 'he', primary=True)
    ramban_node.key = "Ramban on Sefer Yetzirah"
    ramban_node.addressTypes = ['Integer', 'Integer', 'Integer']
    ramban_node.sectionNames = ["Chapter", "Mishnah", "Comment"]
    ramban_node.toc_zoom = 2
    ramban_node.depth = 3
    ramban_node.validate()

    rasag_node.add_title("Rasag on Sefer Yetzirah", 'en', primary=True)
    rasag_node.add_title(u'רס"ג על ספר יצירה', 'he', primary=True)
    rasag_node.key = "Rasag on Sefer Yetzirah"
    rasag_node.addressTypes = ['Integer', 'Integer', 'Integer']
    rasag_node.sectionNames = ["Chapter", "Mishnah", "Comment"]
    rasag_node.toc_zoom = 2
    rasag_node.depth = 3
    rasag_node.validate()

    ramban_index = {
        "title": "Ramban on Sefer Yetzirah",
        "categories": ["Commentary2", "Kabbalah", "Ramban"],
        "language": "he",
        "schema": ramban_node.serialize()
    }
    post_index(ramban_index)
    post_text(
        "Ramban on Sefer Yetzirah", {
            'versionTitle': 'Ramban on Sefer Yetzirah, Warsaw 1884',
            'versionSource':
            'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
            'language': 'he',
            'text': ramban_text
        })

    rasag_index = {
        "title": "Rasag on Sefer Yetzirah",
        "categories": ["Commentary2", "Kabbalah", "Rasag"],
        "language": "he",
        "schema": rasag_node.serialize()
    }
    post_index(rasag_index)
    post_text(
        "Rasag on Sefer Yetzirah", {
            'versionTitle': 'Rasage on Sefer Yetzirah, Warsaw 1884',
            'versionSource':
            'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
            'language': 'he',
            'text': rasag_text
        })
    links = linker(ramban_text, "Ramban on Sefer Yetzirah")
    links.extend(linker(rasag_text, "Rasag on Sefer Yetzirah"))
    post_link(links)
Esempio n. 15
0
def create_shorash_node():
    shorash = JaggedArrayNode()
    shorash.add_title('Shorashim', 'en', primary=True)
    shorash.add_title(u'שורשים', 'he', primary=True)
    shorash.key = 'Shorashim'
    shorash.depth = 2
    shorash.addressTypes = ["Integer", "Integer"]
    shorash.sectionNames = ["Shoresh", "Comment"]
    return shorash
Esempio n. 16
0
def create_mitzvah_node(en_name, he_name):
    mitzvah = JaggedArrayNode()
    mitzvah.add_title(en_name, 'en', primary=True)
    mitzvah.add_title(he_name, 'he', primary=True)
    mitzvah.key = en_name
    mitzvah.depth = 2
    mitzvah.addressTypes = ["Integer", "Integer"]
    mitzvah.sectionNames = ["Mitzvah", "Comment"]
    return mitzvah
def create_schema():
    rif_on_nedarim = JaggedArrayNode()
    rif_on_nedarim.add_title('Rif_Nedarim', 'en', primary=True)
    rif_on_nedarim.add_title(u'רי"ף נדרים', 'he', primary=True)
    rif_on_nedarim.key = 'Rif_Nedarim'
    rif_on_nedarim.depth = 2
    rif_on_nedarim.addressTypes = ["Talmud", "Integer"]
    rif_on_nedarim.sectionNames = ["Daf", "Line"]
    return rif_on_nedarim
Esempio n. 18
0
def create_jagged_array_nodes(en_name, he_name):
    book_node = JaggedArrayNode()
    book_node.key = en_name
    book_node.add_title(en_name, 'en', primary=True)
    book_node.add_title(he_name, 'he', primary=True)
    book_node.depth = 2
    book_node.addressTypes = ["Integer", "Integer"]
    book_node.sectionNames = ["Chapter", "Verse"]
    return book_node
Esempio n. 19
0
def create_schema():
    rb_schema = JaggedArrayNode()
    rb_schema.add_title('Rabbeinu Yonah on Pirkei Avot', 'en', primary=True)
    rb_schema.add_title(u'רבינו יונה על פרקי אבות', 'he', primary=True)
    rb_schema.key = 'Rabbeinu Yonah on Pirkei Avot'
    rb_schema.depth = 3
    rb_schema.addressTypes = ["Integer", "Integer", "Integer"]
    rb_schema.sectionNames = ["Perek", "Mishna", "Comment"]
    return rb_schema
Esempio n. 20
0
def create_jagged_array_nodes(en_name, he_name):
    book_node = JaggedArrayNode()
    book_node.key = en_name
    book_node.add_title(en_name, 'en', primary=True)
    book_node.add_title(he_name, 'he', primary=True)
    book_node.depth = 2
    book_node.addressTypes = ["Integer", "Integer"]
    book_node.sectionNames = ["Chapter", "Verse"]
    return book_node
Esempio n. 21
0
def create_schema():
    rif_on_nedarim = JaggedArrayNode()
    rif_on_nedarim.add_title('Rif_Nedarim', 'en', primary=True)
    rif_on_nedarim.add_title(u'רי"ף נדרים', 'he', primary=True)
    rif_on_nedarim.key = 'Rif_Nedarim'
    rif_on_nedarim.depth = 2
    rif_on_nedarim.addressTypes = ["Talmud", "Integer"]
    rif_on_nedarim.sectionNames = ["Daf", "Line"]
    return rif_on_nedarim
def create_schema():
    rif_on_megillah = JaggedArrayNode()
    rif_on_megillah.add_title('Rif_Megillah', 'en', primary=True)
    rif_on_megillah.add_title(u'רי"ף מגילה', 'he', primary=True)
    rif_on_megillah.key = 'Rif_Megillah'
    rif_on_megillah.depth = 2
    rif_on_megillah.addressTypes = ["Talmud", "Integer"]
    rif_on_megillah.sectionNames = ["Daf", "Line"]
    return rif_on_megillah
Esempio n. 23
0
def create_intro_node():
    intro = JaggedArrayNode()
    intro.add_title('Introduction', 'en', primary=True)
    intro.add_title(u'הקדמה', 'he', primary=True)
    intro.key = 'Introduction'
    intro.depth = 1
    intro.addressTypes = ["Integer"]
    intro.sectionNames = ["Comment"]
    return intro
Esempio n. 24
0
def create_schema():
    ls_schema = JaggedArrayNode()
    ls_schema.add_title('Lechem Shamayim on Pirkei Avot', 'en', primary=True)
    ls_schema.add_title(u'לחם שמים על פרקי אבות', 'he', primary=True)
    ls_schema.key = 'Lechem Shamayim on Pirkei Avot'
    ls_schema.depth = 3
    ls_schema.addressTypes = ["Integer", "Integer", "Integer"]
    ls_schema.sectionNames = ["Perek", "Mishna", "Comment"]
    return ls_schema
Esempio n. 25
0
def create_schema():
    gra_schema = JaggedArrayNode()
    gra_schema.add_title('Gra on Pirkei Avot', 'en', primary=True)
    gra_schema.add_title(u'גר"א על פרקי אבות', 'he', primary=True)
    gra_schema.key = 'Gra on Pirkei Avot'
    gra_schema.depth = 3
    gra_schema.addressTypes = ["Integer", "Integer", "Integer"]
    gra_schema.sectionNames = ["Perek", "Mishna", "Comment"]
    return gra_schema
Esempio n. 26
0
def create_intro_node():
    intro = JaggedArrayNode()
    intro.add_title('Introduction', 'en', primary=True)
    intro.add_title(u'הקדמה', 'he', primary=True)
    intro.key = 'Introduction'
    intro.depth = 1
    intro.addressTypes = ["Integer"]
    intro.sectionNames = ["Comment"]
    return intro
Esempio n. 27
0
def create_schema():
    gra_schema = JaggedArrayNode()
    gra_schema.add_title('Gra on Pirkei Avot', 'en', primary=True)
    gra_schema.add_title(u'גר"א על פרקי אבות', 'he', primary=True)
    gra_schema.key = 'Gra on Pirkei Avot'
    gra_schema.depth = 3
    gra_schema.addressTypes = ["Integer", "Integer", "Integer"]
    gra_schema.sectionNames = ["Perek", "Mishna", "Comment"]
    return gra_schema
def create_negative_commandments_node():
    negative_commandments = JaggedArrayNode()
    negative_commandments.add_title('Negative Commandments', 'en', primary=True)
    negative_commandments.add_title(u'מנין לא תעשה', 'he', primary=True)
    negative_commandments.key = 'Negative Commandments'
    negative_commandments.depth = 2
    negative_commandments.addressTypes = ["Integer", "Integer"]
    negative_commandments.sectionNames = ["Mitzvah", "Comment"]
    return negative_commandments
Esempio n. 29
0
def create_shorash_node():
    shorash = JaggedArrayNode()
    shorash.add_title('Shorashim', 'en', primary=True)
    shorash.add_title(u'שורשים', 'he', primary=True)
    shorash.key = 'Shorashim'
    shorash.depth = 2
    shorash.addressTypes = ["Integer", "Integer"]
    shorash.sectionNames = ["Shoresh", "Comment"]
    return shorash
Esempio n. 30
0
def create_schema():
    ls_schema = JaggedArrayNode()
    ls_schema.add_title('Lechem Shamayim on Pirkei Avot', 'en', primary=True)
    ls_schema.add_title(u'לחם שמים על פרקי אבות', 'he', primary=True)
    ls_schema.key = 'Lechem Shamayim on Pirkei Avot'
    ls_schema.depth = 3
    ls_schema.addressTypes = ["Integer", "Integer", "Integer"]
    ls_schema.sectionNames = ["Perek", "Mishna", "Comment"]
    return ls_schema
def create_schema():
    rb_schema = JaggedArrayNode()
    rb_schema.add_title('Rabbeinu Yonah on Pirkei Avot', 'en', primary=True)
    rb_schema.add_title(u'רבינו יונה על פרקי אבות', 'he', primary=True)
    rb_schema.key = 'Rabbeinu Yonah on Pirkei Avot'
    rb_schema.depth = 3
    rb_schema.addressTypes = ["Integer", "Integer", "Integer"]
    rb_schema.sectionNames = ["Perek", "Mishna", "Comment"]
    return rb_schema
Esempio n. 32
0
def create_mitzvah_node(en_name, he_name):
    mitzvah = JaggedArrayNode()
    mitzvah.add_title(en_name, 'en', primary=True)
    mitzvah.add_title(he_name, 'he', primary=True)
    mitzvah.key = en_name
    mitzvah.depth = 2
    mitzvah.addressTypes = ["Integer", "Integer"]
    mitzvah.sectionNames = ["Mitzvah", "Comment"]
    return mitzvah
Esempio n. 33
0
def create_toalot_node():
    toalot = JaggedArrayNode()
    toalot.add_title('Benefits', "en", primary=True)
    toalot.add_title(u'תועלות', "he", primary=True)
    toalot.key = 'Benefits'
    toalot.depth = 1
    toalot.addressTypes = ["Integer"]
    toalot.sectionNames = ["Comment"]
    return toalot
Esempio n. 34
0
def create_intro_nodes():
    intro_node = JaggedArrayNode()
    intro_node.add_title('Introduction', "en", primary=True)
    intro_node.add_title(u'הצעה', "he", primary=True)
    intro_node.key = 'Introduction'
    intro_node.depth = 1
    intro_node.addressTypes = ["Integer"]
    intro_node.sectionNames = ["Comment"]
    return intro_node
def create_positive_commandments_node():
    positive_commandments = JaggedArrayNode()
    positive_commandments.add_title('Positive Commandments', 'en', primary=True)
    positive_commandments.add_title(u'מנין עשה', 'he', primary=True)
    positive_commandments.key = 'Positive Commandments'
    positive_commandments.depth = 2
    positive_commandments.addressTypes = ["Integer", "Integer"]
    positive_commandments.sectionNames = ["Mitzvah", "Comment"]
    return positive_commandments
def create_shorash_node():
    intro_node = JaggedArrayNode()
    intro_node.add_title('Shorashim', "en", primary=True)
    intro_node.add_title(u'שורשים', "he", primary=True)
    intro_node.key = 'Shorashim'
    intro_node.depth = 2
    intro_node.addressTypes = ["Integer", "Integer"]
    intro_node.sectionNames = ["Shorash", "Comment"]
    return intro_node
def chapter_nine(number):
    hebrew_letter = util.numToHeb(number)
    chapter = JaggedArrayNode()
    chapter.add_title('Chapter {}'.format(number), "en", primary=True)
    chapter.add_title(u'{} {}'.format(u'סימן', hebrew_letter), "he", primary=True)
    chapter.key = 'Chapter {}'.format(number)
    chapter.depth = 2
    chapter.addressTypes = ["Integer", "Integer"]
    chapter.sectionNames = ["Section", "Mitzvah"]
    return chapter
def regular_chapter_nodes(number):
    hebrew_letter = util.numToHeb(number)
    chapter = JaggedArrayNode()
    chapter.add_title('Chapter {}'.format(number), "en", primary=True)
    chapter.add_title(u'{} {}'.format(u'סימן',hebrew_letter), "he", primary=True)
    chapter.key = 'Chapter {}'.format(number)
    chapter.depth = 1
    chapter.addressTypes = ["Integer"]
    chapter.sectionNames = ["Comment"]
    return chapter
def create_book_ja_node(english_book_name, hebrew_book_name):
    en_name = english_book_name[0]
    he_name = hebrew_book_name[0]
    book_node = JaggedArrayNode()
    book_node.key = en_name
    book_node.add_title(en_name, 'en', primary=True)
    book_node.add_title(he_name, 'he', primary=True)
    book_node.depth = 3
    book_node.addressTypes = ["Integer", "Integer", "Integer"]
    book_node.sectionNames = ["Chapter", "Verse", "Comment"]
    book_node.toc_zoom = 2
    return book_node
Esempio n. 40
0
def post_simple_commentaries():
    ramban_node, rasag_node = JaggedArrayNode(), JaggedArrayNode()
    ramban_text = parse_general('yitzira_ramban.txt')
    rasag_text = parse_general('yitzira_rasag.txt')

    ramban_node.add_title("Ramban on Sefer Yetzirah", 'en', primary=True)
    ramban_node.add_title(u'רמב"ן על ספר יצירה', 'he', primary=True)
    ramban_node.key = "Ramban on Sefer Yetzirah"
    ramban_node.addressTypes = ['Integer', 'Integer', 'Integer']
    ramban_node.sectionNames = ["Chapter", "Mishnah", "Comment"]
    ramban_node.toc_zoom = 2
    ramban_node.depth = 3
    ramban_node.validate()

    rasag_node.add_title("Rasag on Sefer Yetzirah", 'en', primary=True)
    rasag_node.add_title(u'רס"ג על ספר יצירה', 'he', primary=True)
    rasag_node.key = "Rasag on Sefer Yetzirah"
    rasag_node.addressTypes = ['Integer', 'Integer', 'Integer']
    rasag_node.sectionNames = ["Chapter", "Mishnah", "Comment"]
    rasag_node.toc_zoom = 2
    rasag_node.depth = 3
    rasag_node.validate()

    ramban_index = {
        "title": "Ramban on Sefer Yetzirah",
        "categories": ["Commentary2", "Kabbalah", "Ramban"],
        "language": "he",
        "schema": ramban_node.serialize()
    }
    post_index(ramban_index)
    post_text("Ramban on Sefer Yetzirah", {
        'versionTitle': 'Ramban on Sefer Yetzirah, Warsaw 1884',
        'versionSource': 'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
        'language': 'he',
        'text': ramban_text
    })

    rasag_index = {
        "title": "Rasag on Sefer Yetzirah",
        "categories": ["Commentary2", "Kabbalah", "Rasag"],
        "language": "he",
        "schema": rasag_node.serialize()
    }
    post_index(rasag_index)
    post_text("Rasag on Sefer Yetzirah", {
        'versionTitle': 'Rasage on Sefer Yetzirah, Warsaw 1884',
        'versionSource': 'http://primo.nli.org.il/primo_library/libweb/action/dlDisplay.do?vid=NLI&docId=NNL_ALEPH001310968',
        'language': 'he',
        'text': rasag_text
    })
    links = linker(ramban_text, "Ramban on Sefer Yetzirah")
    links.extend(linker(rasag_text, "Rasag on Sefer Yetzirah"))
    post_link(links)
Esempio n. 41
0
    def test_remove(self):
        j = JaggedArrayNode()
        j.add_title("title1", "en", primary=True)\
         .add_title("ייי", "he", primary=True)\
         .add_title("title2", "en")\
         .add_title("ייכי", "he")
        j.remove_title("title1", "en")
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.key = "bob"

        with pytest.raises(IndexSchemaError):
            j.validate()
Esempio n. 42
0
    def test_remove(self):
        j = JaggedArrayNode()
        j.add_title(u"title1", "en", primary=True)\
         .add_title(u"ייי", "he", primary=True)\
         .add_title(u"title2", "en")\
         .add_title(u"ייכי", "he")
        j.remove_title(u"title1", "en")
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.key = "bob"

        with pytest.raises(IndexSchemaError):
            j.validate()
Esempio n. 43
0
    def test_terms_and_he(self):
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)
        s.add_title("שרש", "he", primary=True)

        j = JaggedArrayNode()
        j.key = "bereshit"
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.add_shared_term("Bereshit")
        j.append_to(s)

        j2 = JaggedArrayNode()
        j2.key = "noah"
        j2.depth = 1
        j2.sectionNames = ["Foo"]
        j2.addressTypes = ["Integer"]
        j2.add_shared_term("Noach")
        j2.append_to(s)

        s.validate()

        td = s.title_dict("he")
        assert len(td) == 5

        target = {
            'שרש': s,
            'שרש, בראשית': j,
            'שרש, נח': j2,
            'שרש בראשית': j,
            'שרש נח': j2,
        }

        assert td == target
Esempio n. 44
0
    def test_terms_and_he(self):
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)
        s.add_title(u"שרש", "he", primary=True)

        j = JaggedArrayNode()
        j.key = "bereshit"
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.add_shared_term("Bereshit")
        j.append_to(s)

        j2 = JaggedArrayNode()
        j2.key = "noah"
        j2.depth = 1
        j2.sectionNames = ["Foo"]
        j2.addressTypes = ["Integer"]
        j2.add_shared_term("Noach")
        j2.append_to(s)

        s.validate()

        td = s.title_dict("he")
        assert len(td) == 5

        target = {
            u'שרש': s,
            u'שרש, בראשית': j,
            u'שרש, נח': j2,
            u'שרש בראשית': j,
            u'שרש נח': j2,
        }

        assert td == target
Esempio n. 45
0
    def test_validate_children(self):
        """
        Does validate fall through to children?
        """
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)
        j = JaggedArrayNode()
        j.add_title("child", "en", primary=True)
        j.key = "child"
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.append_to(s)

        with pytest.raises(IndexSchemaError):
            s.validate()
Esempio n. 46
0
    def test_validate_children(self):
        """
        Does validate fall through to children?
        """
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)
        j = JaggedArrayNode()
        j.add_title("child", "en", primary=True)
        j.key = "child"
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.append_to(s)

        with pytest.raises(IndexSchemaError):
            s.validate()
Esempio n. 47
0
def post():

    root = SchemaNode()
    root.add_title('Pardes Rimonim', 'en', primary=True)
    root.add_title(u'פרדס רימונים', 'he', primary=True)
    root.key = 'Pardes Rimonim'

    anode = JaggedArrayNode()
    anode.add_title("Author's Introduction", 'en', primary=True)
    anode.add_title(u'הקדמת המחבר', 'he', primary=True)
    anode.key = "Author's Introduction"
    anode.depth = 1
    anode.addressTypes = ['Integer']
    anode.sectionNames = ['Paragraph']
    root.append(anode)

    inode = JaggedArrayNode()
    inode.add_title("Index", 'en', primary=True)
    inode.add_title(u'סימני הספר', 'he', primary=True)
    inode.key = "Index"
    inode.depth = 2
    inode.addressTypes = ['Integer', 'Integer']
    inode.sectionNames = ['Gate', 'Chapter']
    root.append(inode)

    pnode = JaggedArrayNode()
    pnode.add_title("A Prayer", 'en', primary=True)
    pnode.add_title(u'בקשה', 'he', primary=True)
    pnode.key = "A Prayer"
    pnode.depth = 1
    pnode.addressTypes = ['Integer']
    pnode.sectionNames = ['Paragraph']
    root.append(pnode)

    dnode = JaggedArrayNode()
    dnode.default = True
    dnode.key = 'default'
    dnode.depth = 3
    dnode.addressTypes = ['Integer', 'Integer', 'Integer']
    dnode.sectionNames = ['Gate', 'Chapter', 'Paragraph']
    root.append(dnode)
    root.validate()

    index = {
        "pubDate": "1651",
        "title": "Pardes Rimonim",
        "pubPlace": "Amsterdam",
        "enDesc":
        "Pardes Rimonim (Orchard of Pomegranates) is a primary text of Kabbalah composed by the Jewish mystic Moses ben Jacob Cordovero in Safed. It is composed of thirteen gates or sections each subdivided into chapters. He indicates in his introduction that the work is based upon notes he took during his study of the Zohar, the foundational work of the Kabbalahand was designed \"in order not to become lost and confused in its [the Zohar] depths\". The work is an encyclopaedic summary of the Kabbalah, including an effort to \"elucidate all the tenets of the Cabala, such as the doctrines of the sefirot, emanation, the divine names, the import and significance of the alphabet, etc.\" Pardes Rimonim was the first comprehensive exposition of Medieval Kabbalah, though its rationally influenced scheme was superseded by the subsequent 16th century Safed mythological scheme of Isaac Luria.",
        "era": "RI",
        "authors": ["Moshe Cordovero"],
        "categories": ["Kabbalah"],
        'schema': root.serialize()
    }
    version = {
        'versionTitle': 'Pardes Rimonim',
        'versionSource':
        'http://www.hebrew.grimoar.cz/kordovero/pardes_rimonim.htm',
        'language': 'he',
        'text': parse()
    }
    post_index(index)
    post_text('Pardes Rimonim', version, index_count='on', skip_links=1)
Esempio n. 48
0
    def test_grandchild_presentation(self):
        s = SchemaNode()
        s.key = "root"
        s.add_title("root", "en", primary=True)
        s.add_title("alt root", "en")

        s2 = SchemaNode()
        s2.key = "l2"
        s2.add_title("Level 2", "en", primary=True)
        s2.add_title("Level 2 Alone", "en", presentation="alone")
        s2.add_title("Level 2 Both", "en", presentation="both")
        s2.append_to(s)

        j = JaggedArrayNode()
        j.key = "child1"
        j.depth = 1
        j.sectionNames = ["Foo"]
        j.addressTypes = ["Integer"]
        j.add_title("Level 3a", "en", primary=True)
        j.add_title("Level 3a alone", "en", presentation="alone")
        j.add_title("Level 3a both", "en", presentation="both")
        j.append_to(s2)

        j2 = JaggedArrayNode()
        j2.key = "child2"
        j2.depth = 1
        j2.sectionNames = ["Foo"]
        j2.addressTypes = ["Integer"]
        j2.add_title("Level 3b", "en", primary=True)
        j2.add_title("Level 3b alone", "en", presentation="alone")
        j2.add_title("Level 3b both", "en", presentation="both")
        j2.append_to(s2)

        s.validate()

        assert not s.has_numeric_continuation()
        assert not s2.has_numeric_continuation()

        td = s.title_dict()
        assert len(td) == 96

        target = {
            "root": s,
            "alt root": s,
            "Level 2 Alone": s2,
            "Level 3b alone": j2,
            "Level 3a alone": j,
            "Level 2 Both": s2,
            "Level 3a both": j,
            "Level 3b both": j2,

            # combined, with comma separator
            "root, Level 2 Both": s2,
            "root, Level 2": s2,
            "alt root, Level 2 Both": s2,
            "alt root, Level 2": s2,
            "root, Level 2 Both, Level 3a": j,
            "root, Level 2, Level 3a": j,
            "alt root, Level 2 Both, Level 3a": j,
            "alt root, Level 2, Level 3a": j,
            "Level 2 Alone, Level 3a": j,
            "Level 2 Both, Level 3a": j,
            "root, Level 2 Both, Level 3a both": j,
            "root, Level 2, Level 3a both": j,
            "alt root, Level 2 Both, Level 3a both": j,
            "alt root, Level 2, Level 3a both": j,
            "Level 2 Alone, Level 3a both": j,
            "Level 2 Both, Level 3a both": j,
            "root, Level 2 Both, Level 3b": j2,
            "root, Level 2, Level 3b": j2,
            "alt root, Level 2 Both, Level 3b": j2,
            "alt root, Level 2, Level 3b": j2,
            "Level 2 Alone, Level 3b": j2,
            "Level 2 Both, Level 3b": j2,
            "root, Level 2 Both, Level 3b both": j2,
            "root, Level 2, Level 3b both": j2,
            "alt root, Level 2 Both, Level 3b both": j2,
            "alt root, Level 2, Level 3b both": j2,
            "Level 2 Alone, Level 3b both": j2,
            "Level 2 Both, Level 3b both": j2,

            # combined, with space separator
            "root Level 2 Both": s2,
            "root Level 2": s2,
            "alt root Level 2 Both": s2,
            "alt root Level 2": s2,
            "root Level 2 Both Level 3a": j,
            "root Level 2 Level 3a": j,
            "alt root Level 2 Both Level 3a": j,
            "alt root Level 2 Level 3a": j,
            "Level 2 Alone Level 3a": j,
            "Level 2 Both Level 3a": j,
            "root Level 2 Both Level 3a both": j,
            "root Level 2 Level 3a both": j,
            "alt root Level 2 Both Level 3a both": j,
            "alt root Level 2 Level 3a both": j,
            "Level 2 Alone Level 3a both": j,
            "Level 2 Both Level 3a both": j,
            "root Level 2 Both Level 3b": j2,
            "root Level 2 Level 3b": j2,
            "alt root Level 2 Both Level 3b": j2,
            "alt root Level 2 Level 3b": j2,
            "Level 2 Alone Level 3b": j2,
            "Level 2 Both Level 3b": j2,
            "root Level 2 Both Level 3b both": j2,
            "root Level 2 Level 3b both": j2,
            "alt root Level 2 Both Level 3b both": j2,
            "alt root Level 2 Level 3b both": j2,
            "Level 2 Alone Level 3b both": j2,
            "Level 2 Both Level 3b both": j2,

            # combined, space, comma
            "root Level 2 Both, Level 3a": j,
            "root Level 2, Level 3a": j,
            "alt root Level 2 Both, Level 3a": j,
            "alt root Level 2, Level 3a": j,
            "root Level 2 Both, Level 3a both": j,
            "root Level 2, Level 3a both": j,
            "alt root Level 2 Both, Level 3a both": j,
            "alt root Level 2, Level 3a both": j,
            "root Level 2 Both, Level 3b": j2,
            "root Level 2, Level 3b": j2,
            "alt root Level 2 Both, Level 3b": j2,
            "alt root Level 2, Level 3b": j2,
            "root Level 2 Both, Level 3b both": j2,
            "root Level 2, Level 3b both": j2,
            "alt root Level 2 Both, Level 3b both": j2,
            "alt root Level 2, Level 3b both": j2,

            # combined, comma, space
            "root, Level 2 Both Level 3a": j,
            "root, Level 2 Level 3a": j,
            "alt root, Level 2 Both Level 3a": j,
            "alt root, Level 2 Level 3a": j,
            "root, Level 2 Both Level 3a both": j,
            "root, Level 2 Level 3a both": j,
            "alt root, Level 2 Both Level 3a both": j,
            "alt root, Level 2 Level 3a both": j,
            "root, Level 2 Both Level 3b": j2,
            "root, Level 2 Level 3b": j2,
            "alt root, Level 2 Both Level 3b": j2,
            "alt root, Level 2 Level 3b": j2,
            "root, Level 2 Both Level 3b both": j2,
            "root, Level 2 Level 3b both": j2,
            "alt root, Level 2 Both Level 3b both": j2,
            "alt root, Level 2 Level 3b both": j2,
        }

        assert td == target