Example #1
0
    def _get_body_attrs(self, module, overrides=None):
        options = []
        for option in all_options():
            if overrides and option in overrides:
                options.append((option, overrides[option]))
            else:
                options.append((option, get_js_option_value(option)))

        if module:
            options.append(("module", module.Name()))

        options.append(("dir", get_module_css_text_direction(module)))
        return ' '.join('%s="%s"' % option for option in options)
Example #2
0
	def _get_body_attrs(self, module, overrides=None):
		options = []
		for option in all_options():
			if overrides and option in overrides:
				options.append((option, overrides[option]))
			else:
				options.append((option, get_js_option_value(option)))

		if module: 
			options.append(("module", module.Name()))
		
		options.append(("dir", get_module_css_text_direction(module)))
		return ' '.join('%s="%s"' % option for option in options)
Example #3
0
    def get_parallel_text(self, ref):
        vk = SW.VerseKey()
        verselist = vk.ParseVerseList(to_str(ref), "", True)

        items = []
        text = ["<table class='parallel_view'>", "<tr>"]
        for item in self.book.GetModules():
            name = item.Name()
            if name in verse_comparison_settings["comparison_modules"]:
                items.append((item,
                              list(
                                  self.book.GetReference_yield(
                                      verselist,
                                      module=item,
                                      max_verses=176,
                                      skip_linked_verses=False))))

                text.append(u"<th>%s</th>" % process_html_for_module(
                    item, u"<b><a href='%s:%s'>"
                    "%s</a></b>" % (BIBLE_VERSION_PROTOCOL, name, name)))

        text.append("</tr>")

        # if we have no bibles to compare, return the empty string
        if not items:
            return ""

        rows = []
        was_clipped = False
        try:
            self.book.templatelist.append(config.parallel_template)
            while True:
                text.append("<tr>")
                for module, refs in items:
                    if not refs:
                        text.append("</tr>")
                        break

                    body_dict, headings = refs.pop(0)

                    if not body_dict:
                        was_clipped = True
                        # remove opening row
                        text.pop()
                        break

                    text_direction = get_module_css_text_direction(module)
                    text.append(
                        u'<td class="parallel_verse" module="%s" dir="%s">' %
                        (module.Name(), text_direction))

                    t = ""
                    for heading_dict in headings:
                        t += biblemgr.bible.templatelist[-1].\
                         headings.safe_substitute(heading_dict)

                    t += biblemgr.bible.templatelist[-1].\
                     body.safe_substitute(body_dict)
                    t = process_html_for_module(module, t)

                    text.append(t)

                    text.append("</td>")

                else:
                    text.append("</tr>")
                    continue

                break
        finally:
            self.book.templatelist.pop()

        text.append("</table>")

        if was_clipped:
            text.append(config.MAX_VERSES_EXCEEDED() % 177)

        return ''.join(text)
Example #4
0
	def get_parallel_text(self, ref):
		vk = SW.VerseKey()
		verselist = vk.ParseVerseList(to_str(ref), "", True)
		
		items = []
		text = ["<table class='parallel_view'>", "<tr>"]
		for item in self.book.GetModules():
			name = item.Name()
			if name in verse_comparison_settings["comparison_modules"]:
				items.append((
					item, 
					list(self.book.GetReference_yield(
						verselist, module=item, max_verses=176, skip_linked_verses=False
					))
				))
				
				text.append(u"<th>%s</th>" % process_html_for_module(item, 
					u"<b><a href='%s:%s'>"
					"%s</a></b>" % (BIBLE_VERSION_PROTOCOL, name, name))
				)

		text.append("</tr>")
		
		# if we have no bibles to compare, return the empty string
		if not items:
			return ""

		rows = []
		was_clipped = False
		try:
			self.book.templatelist.append(config.parallel_template)
			while True:
				text.append("<tr>")
				for module, refs in items:
					if not refs:
						text.append("</tr>")
						break
					
					body_dict, headings = refs.pop(0)

					if not body_dict:
						was_clipped = True
						# remove opening row
						text.pop() 
						break

					text_direction = get_module_css_text_direction(module)
					text.append(u'<td class="parallel_verse" module="%s" dir="%s">' % (module.Name(), text_direction))
					
					t = ""
					for heading_dict in headings:
						t += biblemgr.bible.templatelist[-1].\
							headings.safe_substitute(heading_dict)
					
					t += biblemgr.bible.templatelist[-1].\
						body.safe_substitute(body_dict)
					t = process_html_for_module(module, t)

					text.append(t)
					
					text.append("</td>")
							
				else:
					text.append("</tr>")
					continue

				break
		finally:
			self.book.templatelist.pop()

		text.append("</table>")
		
		if was_clipped:
			text.append(config.MAX_VERSES_EXCEEDED() % 177)
		

		return ''.join(text)