• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python translate._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中translate._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_hijri_date

	def get_hijri_date(self):
		wd = datetime.datetime.now().strftime("%A")
		calc = HijriCal(self.silaty.prayertimes.options.hijrical_adjustment)
		h_months = ['Muharram ', 'Safar', 'Rabi al Awwal', 'Rabi al Akhira', 'Jumada al Ula', 'Jumada al Akhira', 'Rajab', "Sha'ban", 'Ramadan', 'Shawwal', "Dhu al Qa'da", 'Dhu al Hijja']
		h_year,  h_month,  h_day,  h_week_day = calc.today
		h_date = '%i %s %i' % ( h_day,  _(h_months[int(h_month-1)]),  h_year)
		return (_('%s, %s') % (_(wd), h_date))
开发者ID:Jessewb786,项目名称:Silaty,代码行数:7,代码来源:silaty-indicator.py


示例2: update_compass

	def update_compass(self, qibladirection, country, city):
		## The only way to update so far is to remove the whole thing and create it again
		self.remove(self.mainbox)

		self.mainbox = Gtk.Box()
		self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)

		qibla = self.set_compass(qibladirection)
		qibla.props.valign = Gtk.Align.START

		## Make the top label
		qiblatitle = Gtk.Label(label=_("Qibla direction :"), margin_left=20, margin_right=20)
		qiblatitle.props.halign = Gtk.Align.START
		self.mainbox.pack_start(qiblatitle, False, False, 12)

		## Set the compass image
		self.mainbox.pack_start(qibla, False, True, 0)

		## Set the country and city
		vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
		qiblalabel = Gtk.Label(label=_("Country : %s") % country)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True,True, 0)

		qiblalabel = Gtk.Label(label=_("City : %s") % city)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True, True, 0)

		## Add it all in the end
		self.mainbox.pack_start(vbox, False, False, 12)
		self.pack_start(self.mainbox, True, True, 0)
		self.show_all()
开发者ID:Jessewb786,项目名称:Silaty,代码行数:34,代码来源:qiblacompass.py


示例3: setInfo

	def setInfo(self):
		selection = self["filelist"].getSelection()
		if selection is None:
			return
		elif selection[1] == True: # isDir
			self["key_green"].setText("")
			self.EditScreen = False
			self["key_yellow"].setText("")
			self.DeleteScreen = False
			self["PreviewPicture"].hide()
			self["key_blue"].setText("")
		else:
			self["key_green"].setText(_("Edit"))
			self.EditScreen = True
			if path.exists(self.UserSkin_Selections_dir + self.filelist.getFilename()):
				self["key_yellow"].setText("")
				self.DeleteScreen = False
			else:
				self["key_yellow"].setText(_("Delete"))
				self.DeleteScreen = True

			self.PreviewTimer.start(100,False)
			if self.filelist.getFilename().lower().find('infobar') != -1:
				self["key_blue"].setText(_("Preview"))
			else:
				self["key_blue"].setText("")
开发者ID:serge61,项目名称:eePlugins,代码行数:26,代码来源:skinconfig.py


示例4: keyYellow

    def keyYellow(self):
        if self.NumberOfScreens >= 1:
            self.currentScreenID += 1
            if self.currentScreenID >= self.NumberOfScreens:
                self.currentScreenID = 0
            while self.root[self.currentScreenID].tag != 'screen':
                self.currentScreenID += 1
                
            try:
                self.myScreenName = self.root[self.currentScreenID].attrib['name']
            except:
                self.myScreenName = _('UnknownName')
            myTitle=_("UserSkin %s - Edit %s screen (1/%d)") %  (UserSkinInfo,self.myScreenName,self.NumberOfScreens)
            print myTitle
            
            self.setTitle(myTitle)
            self["menu"].setIndex(0)
        #try:
            #self["Title"]=StaticText(myTitle)
        #except:
        #    pass
            self.createWidgetsList()

        if self.NumberOfChilds != self.NumberOfScreens:
            iindex = 0
            for child in self.root.findall('*'):
                if child.tag == screen:
                    break
                iindex+= 1
            self.currentScreenID = iindex
开发者ID:serge61,项目名称:eePlugins,代码行数:30,代码来源:editscreens.py


示例5: restartGUI

	def restartGUI(self):
	  
		def restartGUIcb(answer):
			if answer is True:
				self.session.open(TryQuitMainloop, 3)
			else:
				self.close()

		def restartNotOKcb(answer):
			if answer is True:
				self.session.open(TryQuitMainloop, 3)
			else:
				user_skin_file=resolveFilename(SCOPE_CONFIG, 'skin_user' + self.currentSkin + '.xml')
				if path.exists(user_skin_file):
					remove(user_skin_file)
				self.close()

		myMessage = ''
		if self.LackOfFile != '':
			printDEBUG("missing components: %s" % self.LackOfFile)
			myMessage += _("Missing components found: %s\n\n") % self.LackOfFile
			myMessage += _("Skin will NOT work properly and GS expected!!!\n\n")
			myMessage += _("Are you sure you want to use it?")
			restartbox = self.session.openWithCallback(restartNotOKcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
		else:
			myMessage += _("Restart GUI now?")
			restartbox = self.session.openWithCallback(restartGUIcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
		restartbox.setTitle(_("Message"))
开发者ID:serge61,项目名称:eePlugins,代码行数:28,代码来源:skinconfig.py


示例6: get_times

 def get_times(self, prayer):# If User Sets Clock Format 12hr or 24hr Return It As He Likes!
     if self.prayertimes.options.clock_format == '12h':
         #print ("DEBUG: using 12h format @", (str(datetime.datetime.now())))
         return self.timeto12(prayer).replace('AM', _('AM')).replace('PM', _('PM'))
     if self.prayertimes.options.clock_format == '24h':
         #print ("DEBUG: using 24h format @", (str(datetime.datetime.now())))
         return self.timeto24(prayer)
开发者ID:Jessewb786,项目名称:Silaty,代码行数:7,代码来源:silaty.py


示例7: __init__

	def __init__(self, qibladirection, country, city):
		Gtk.Box.__init__(self)

		self.mainbox = Gtk.Box()
		self.mainbox.set_orientation(Gtk.Orientation.VERTICAL)

		qibla = self.set_compass(qibladirection)
		qibla.props.valign = Gtk.Align.START

		## Make the top label
		qiblatitle = Gtk.Label(label=_("Qibla direction :"), margin_left=20, margin_right=20)
		qiblatitle.props.halign = Gtk.Align.START
		self.mainbox.pack_start(qiblatitle, False, False, 12)

		## Set the compass image
		self.mainbox.pack_start(qibla, False, True, 0)

		## Set the country and city
		vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,spacing=6)
		qiblalabel = Gtk.Label(label=_("Country : %s") % country)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True,True, 0)

		qiblalabel = Gtk.Label(label=_("City : %s") % city)
		qiblalabel.props.halign = Gtk.Align.CENTER
		qiblalabel.props.valign = Gtk.Align.CENTER
		vbox.pack_start(qiblalabel, True, True, 0)

		## Add it all in the end
		self.mainbox.pack_start(vbox, False, False, 12)
		self.pack_start(self.mainbox, True, True, 0)
开发者ID:Jessewb786,项目名称:Silaty,代码行数:32,代码来源:qiblacompass.py


示例8: openSelected

 def openSelected(self):
     selected = str(self["list"].getCurrent()[2])
     if selected == 'about':
         from about import UserSkin_About
         self.session.openWithCallback(self.refresh,UserSkin_About)
         return
     elif selected == 'config':
         from skinconfig import UserSkin_Config
         self.session.openWithCallback(self.quit,UserSkin_Config)
         return
     elif selected == 'LCDskin':
         from Plugins.Extensions.MiniTVUserSkinMaker.miniTVskinner import miniTVskinnerInitiator
         self.runLCDskin(retDict = None, initRun = True)
         return
     elif selected == 'LCDskinInstall':
         from myComponents import UserSkinconsole
         runlist = []
         runlist.append( ('opkg update') )
         runlist.append( ('opkg install enigma2-plugin-extensions--j00zeks-minitvuserskinmaker') )
         self.session.openWithCallback(self.refresh, UserSkinconsole, title = _("Installing  miniTV skin creator"), cmdlist = runlist)
         self.refresh()
         return
     elif selected == 'ListScreens':
         from ScreensLister import ScreensLister
         self.session.openWithCallback(self.doNothing,ScreensLister)
         return
     elif selected == 'getaddons':
         from myComponents import myMenu
         self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Getaddons', MenuTitle = _("Download addons"))
         return
     elif selected == 'delete_addons':
         from myComponents import myMenu
         self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Deleteaddons', MenuTitle = _("Delete addons"))
         return
     elif selected == 'getcomponents':
         from myComponents import myMenu
         self.session.openWithCallback(self.rebootQuestion, myMenu, MenuFolder = '%sscripts' % PluginPath, MenuFile = '_Getcomponents', MenuTitle = _("Download additional Components/plugins"))
         return
     elif selected == 'importskin':
         from myComponents import myMenu
         self.session.openWithCallback(self.refresh, myMenu, MenuFolder = '%sImportSkinScripts' % PluginPath, MenuFile = '_Skins2Import', MenuTitle = _("Import foreign skin"))
         return
     elif selected == 'getskin':
         def goUpdate(ret):
             if ret is True:
                 from myComponents import UserSkinconsole
                 runlist = []
                 runlist.append( ('chmod 755 %sscripts/SkinUpdate.sh' % PluginPath) )
                 runlist.append( ('%sscripts/SkinUpdate.sh %s' % (PluginPath,SkinPath)) )
                 self.session.openWithCallback(self.rebootQuestion, UserSkinconsole, title = _("Updating skin"), cmdlist = runlist)
             return
             
         self.session.openWithCallback(goUpdate, MessageBox,_("Do you want to update skin?"),  type = MessageBox.TYPE_YESNO, timeout = 10, default = False)
         return
     elif selected == 'history':
         from myComponents import UserSkinconsole
         self.session.openWithCallback(self.refresh, UserSkinconsole, title = _("History of changes"), cmdlist = [ '%sscripts/SkinHistory.sh %s' % (PluginPath,SkinPath) ])
         return
开发者ID:serge61,项目名称:eePlugins,代码行数:58,代码来源:plugin.py


示例9: refresh

	def refresh(self):
		# update hijri date
		self.hytoday, self.hmtoday, self.hdtoday = self.hijrical.goto_gregorian_day(self.gytoday, (self.gmtoday+1), self.gdtoday)
		# update hijri title label
		now_wd = datetime.datetime.now().strftime("%A")
		h_date = '%i %s %i' % (self.hdtoday, _(self.hmonths[int(self.hmtoday-1)]), self.hytoday)
		self.parent.titlestack.get_child_by_name("Hijri").set_label(_('%s, %s') % (_(now_wd), h_date))
		# update calendar
		gday   = (self.refdate).strftime("%d")
		gmonth = (self.refdate).strftime("%B")
		gyear  = (self.refdate).strftime("%Y")
		if self.state == CalendarState.Gregorian:
			# Get the size of this month
			hyear, hmonth, hday = self.hijrical.goto_gregorian_day(int(gyear), (self.gmonths.index(gmonth)+1), int(gday))
			refwd = self.weekdays.index(self.refdate.strftime("%A"))
			calendarindex = -(refwd+(((6-refwd)+int(self.refdate.strftime("%d")))//7)*7)
		else:
			hyear, hmonth, hday = self.hijrical.goto_gregorian_day(int(gyear), (self.gmonths.index(gmonth)+1), int(gday))
			refwd = self.weekdays.index(self.refdate.strftime("%A"))
			calendarindex = -(refwd+(((6-refwd)+hday)//7)*7)
		for row in range(0, 6):
			for column in range(0, 7):
				newgday = int((self.refdate + timedelta(days=(calendarindex))).strftime("%d"))
				newgmonth = self.gmonths.index((self.refdate + timedelta(days=(calendarindex))).strftime("%B"))
				newgyear = int((self.refdate + timedelta(days=(calendarindex))).strftime("%Y"))
				newhyear, newhmonth, newhday = self.hijrical.goto_gregorian_day(newgyear, newgmonth+1, newgday)

				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next = newgday
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next = newhday

				if (column == 0) or (column == 6):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.LGrey
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.LGrey
				else:
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.White
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.White

				if newgmonth != self.gmonths.index(self.refdate.strftime("%B")):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.DGrey

				if newhmonth != hmonth:
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.DGrey

				if (newgday == self.gdtoday and newgmonth == self.gmtoday and newgyear == self.gytoday):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background = CalendarColor.Blue

				if (newhday == self.hdtoday and newhmonth == self.hmtoday and newhyear == self.hytoday):
					self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background = CalendarColor.Blue

				newgbackground = self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_next_background
				newhbackground = self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_next_background

				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day = newgday
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Gregorian').day_background = newgbackground
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day = newhday
				self.caltable.get_child_at(column,row).labelstack.get_child_by_name('Hijri').day_background = newhbackground

				calendarindex += 1
开发者ID:Jessewb786,项目名称:Silaty,代码行数:58,代码来源:silatycal.py


示例10: restartGUI

 def restartGUI(self):
     myMessage = ''
     if self.LackOfFile != '':
         printDEBUG("missing components: %s" % self.LackOfFile)
         myMessage += _("Missing components found: %s\n\n") % self.LackOfFile
         myMessage += _("Skin will NOT work properly!!!\n\n")
     myMessage += _("Restart necessary, restart GUI now?")
     restartbox = self.session.openWithCallback(self.restartGUIcb,MessageBox, myMessage, MessageBox.TYPE_YESNO, default = False)
     restartbox.setTitle(_("Message"))
开发者ID:YourFriendCaspian,项目名称:UserSkin,代码行数:9,代码来源:skinconfig.py


示例11: Plugins

def Plugins(**kwargs):
    return [
        PluginDescriptor(
            name=_("UserSkin Setup"),
            description=_("Personalize your Skin"),
            where=PluginDescriptor.WHERE_MENU,
            fnc=menu,
        )
    ]
开发者ID:YourFriendCaspian,项目名称:UserSkin,代码行数:9,代码来源:plugin.py


示例12: __init__

 def __init__(self, session):
     Screen.__init__(self, session)
     self.setup_title = _("UserSkinMenu")
     Screen.setTitle(self, self.setup_title)
     self["list"] = List()
     self["setupActions"] = ActionMap(
         ["SetupActions", "MenuActions"], {"cancel": self.quit, "ok": self.openSelected, "menu": self.quit}, -2
     )
     self.setTitle(_("UserSkin menu %s") % UserSkinInfo)
     self.createsetup()
开发者ID:YourFriendCaspian,项目名称:UserSkin,代码行数:10,代码来源:plugin.py


示例13: secs_to_hrtime

	def secs_to_hrtime(self, secs):
		# Transform Seconds into Hours and Minutes
		hours = secs//3600
		minutes = (secs//60)%60
		minutes += 1 # correct minutes (to avoid values like "0min")
		if minutes == 60:
			hours += 1
			return _("%s Hours") % str(hours)
		elif hours == 0:
			return _("%s Minutes") % str(minutes)
		else:
			return _("%s Hours and %s Minutes") % (str(hours), str(minutes))
开发者ID:Jessewb786,项目名称:Silaty,代码行数:12,代码来源:silaty-indicator.py


示例14: secs_to_nrtime

	def secs_to_nrtime(self, secs):
		# Transform Seconds into Hours and Minutes
		# Using the same standard in iPray
		hours = secs//3600
		minutes = (secs//60)%60
		minutes += 1 # correct minutes (to avoid values like "0min")
		if minutes == 60:
			hours += 1
			return _("%shr") % str(hours)
		elif hours == 0:
			return _("%smin") % str(minutes)
		else:
			return _("%shr %smin") % (str(hours), str(minutes))
开发者ID:Jessewb786,项目名称:Silaty,代码行数:13,代码来源:silaty-indicator.py


示例15: __init__

 def __init__(self, text, width=None, base_text=None, **kwds):
     #-# Translation live update preparation
     # base_text: to be used each time a widget takes a formated string
     #            defaults to 'text'.
     Widget.__init__(self, **kwds)
     #-# Translation live update preparation
     self.fixed_width = width
     self.base_text = base_text or text
     self.previous_translation = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
     #-#
     self._text = _(text, doNotTranslate=kwds.get('doNotTranslate', False))
     #-#
     self.calc_size()
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:13,代码来源:controls.py


示例16: __

def __(txt):
    if txt.find('_(') == -1:
        txt = _(txt)
    else:
        index = 0
        while txt.find('_(') != -1:
            tmptxt = substring_2_translate(txt)
            translated_tmptxt = _(tmptxt)
            txt = txt.replace('_(' + tmptxt + ')', translated_tmptxt)
            index += 1
            if index == 10:
                break

    return txt
开发者ID:areqq,项目名称:FreePlayer,代码行数:14,代码来源:AdvancedFreePlayerConfig.py


示例17: set_title

	def set_title(self):
		# Set the Date in the Title
		now_time = datetime.datetime.now().strftime("%H:%M")
		now_wd = datetime.datetime.now().strftime("%A")
		g_day = datetime.datetime.now().strftime("%d")
		g_month = datetime.datetime.now().strftime("%B")
		g_year = datetime.datetime.now().strftime("%Y")
		g_date = '%s %s %s' % (g_day, _(g_month), g_year)
		calc = HijriCal(self.parent.prayertimes.options.hijrical_adjustment)
		h_months = ['Muharram', 'Safar', 'Rabi al Awwal', 'Rabi al Akhira', 'Jumada al Ula', 'Jumada al Akhira', 'Rajab',  "Sha'ban",  'Ramadan',  'Shawwal',  "Dhu al Qa'da", 'Dhu al Hijja']
		h_year, h_month, h_day, h_week_day = calc.today
		h_date = '%i %s %i' % (h_day, _(h_months[int(h_month-1)]), h_year)

		self.titlelabel.set_label(_('%s - %s, %s / %s') % (now_time, _(now_wd), h_date, g_date))
开发者ID:Jessewb786,项目名称:Silaty,代码行数:14,代码来源:home.py


示例18: createWidgetsList

 def createWidgetsList(self):
     menu_list = []
     f_list = []
     for child in self.root[self.currentScreenID].findall('*'):
         childTitle = ''
         childDescr = ' '
         childTYPE = child.tag
         if childTYPE.lower() == 'widget':
             pic = self.widget_png
             if 'render' in child.attrib:
               childTitle = _(child.attrib['render'])
             if 'name' in child.attrib and child.attrib['name'] == 'list':
                 if 'serviceNameFont' in child.attrib and 'serviceNumberFont' in child.attrib:
                     childTitle = _('ChannelList')
                 else:
                     childTitle = _('List')
         elif childTYPE.lower() == 'elabel':
             pic = self.elabel_png
             childDescr += _('Paint a square. ')
         elif childTYPE.lower() == 'epixmap':
             pic = self.epixmap_png
             childDescr += _('Display a picture. ')
             
         elif childTYPE.lower() == 'label':
             pic = self.label_png
             
         elif childTYPE.lower() == 'pixmap':
             pic = self.pixmap_png
             
         else:
             pic = None
         if 'text' in child.attrib:
             childDescr += _('Display %s. ') % child.attrib['text']
         if 'render' in child.attrib and 'source' in child.attrib:
             childDescr += _('Controlled through %s. ') % child.attrib['source']
         if 'name' in child.attrib:
             childDescr += _('Controlled by script or plugin. ')
         f_list.append((child, "%s %s" % (childTYPE, childTitle), childDescr, pic))
     if len(f_list) == 0:
         f_list.append(("dummy", _("No widgets found"), '', None))
         self.blockActions=True
     if self.blockActions == True:
         self['key_blue'].setText('')
     for entry in f_list:
         menu_list.append((entry[0], entry[1], entry[2], entry[3]))
     #print menu_list
     try:
         self["menu"].UpdateList(menu_list)
     except:
         print "Update asser error :(" #workarround to have it working on openpliPC
         myIndex=self["menu"].getIndex() #as an effect, index is cleared so we need to store it first
         self["menu"].setList(menu_list)
         self["menu"].setIndex(myIndex) #and restore
     self.selectionChanged()
开发者ID:serge61,项目名称:eePlugins,代码行数:54,代码来源:editscreens.py


示例19: doCall

def doCall(method, *args, **kwargs):
    log = rhnLog.initLog()
    cfg = config.initUp2dateConfig()
    ret = None

    attempt_count = 1
    attempts = cfg["networkRetries"] or 5

    while 1:
        failure = 0
        ret = None
        try:
            ret = apply(method, args, kwargs)
        except KeyboardInterrupt:
            raise rhnErrors.CommunicationError(_(
                "Connection aborted by the user"))
        # if we get a socket error, keep tryingx2
        except (socket.error, socket.sslerror), e:
            log.log_me("A socket error occurred: %s, attempt #%s" % (
                e, attempt_count))
            if attempt_count >= attempts:
                if len(e.args) > 1:
                    raise rhnErrors.CommunicationError(e.args[1])
                else:
                    raise rhnErrors.CommunicationError(e.args[0])
            else:
                failure = 1
        except httplib.IncompleteRead:
            print "httplib.IncompleteRead"
            raise rhnErrors.CommunicationError("httplib.IncompleteRead")
开发者ID:NehaRawat,项目名称:spacewalk,代码行数:30,代码来源:rpcServer.py


示例20: convert_file_for_web

def convert_file_for_web(source_path, result_path, footer, glossary_renderer, increase_headline_level):

    with codecs.open(source_path, 'r', 'utf-8') as source:
        with codecs.open(result_path, 'w', 'utf-8') as target:
            lw = LineWriter(target, source.newlines)
            for line in source:
                L = line.strip()
                if not L:
                    lw.mark_empty_line()
                elif L == GLOSSARY_MARKER:
                    glossary_renderer.render(lw.write)
                elif L in SLIDE_MARKERS:
                    # omit line, do not change empty line marker!
                    pass
                elif L.startswith('#'):
                    if L.endswith(_(u'(…)')):
                        pass  # omit slides with continued headlines
                    else:
                        if increase_headline_level:
                            lw.write(increase_headline_level(L))
                        else:
                            lw.write(line)
                elif line.lstrip().startswith("!["):
                    # fix image
                    pos = L.find('(')
                    lw.write(IMG_TEMPLATE.format(L[pos + 1:]))
                else:
                    lw.write(line)
            if footer:
                target.write(footer)
开发者ID:bboc,项目名称:mdtools,代码行数:30,代码来源:build_web_content.py



注:本文中的translate._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python translate.tr函数代码示例发布时间:2022-05-27
下一篇:
Python transitions.Machine类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap