コード例 #1
0
ファイル: cakei18n.py プロジェクト: predominant/cake_articles
 def lang_link(lang, path):
     """
     Generates links to other language docs.
     """
     dots = []
     for p in path.split(SEP):
         dots.append('..')
     return SEP.join(dots) + SEP + lang + SEP + path + app.builder.link_suffix
コード例 #2
0
 def lang_link(lang, path):
     """
     Generates links to other language docs.
     """
     dots = []
     for p in path.split(SEP):
         dots.append('..')
     return SEP.join(dots) + SEP + lang + SEP + path + app.builder.link_suffix
コード例 #3
0
ファイル: cakei18n.py プロジェクト: luizjam/docs
 def lang_link(lang, path):
     """
     Generates links to other language docs.
     """
     dots = []
     for p in path.split(SEP):
         dots.append("..")
     tokens = lang.split("_")
     if len(tokens) > 1:
         folder = tokens[0]
     else:
         folder = lang
     return SEP.join(dots) + SEP + folder + SEP + path + app.builder.link_suffix
コード例 #4
0
 def lang_link(lang, path):
     """
     Generates links to other language docs.
     """
     dots = []
     for p in path.split(SEP):
         dots.append('..')
     tokens = lang.split('_')
     if len(tokens) > 1:
         folder = tokens[0]
     else:
         folder = lang
     return SEP.join(dots) + SEP + folder + SEP + path + app.builder.link_suffix
コード例 #5
0
ファイル: rst.py プロジェクト: Lemma1/MINAMI
def relative_uri(base, to):
    """Return a relative URL from ``base`` to ``to``."""
    if to.startswith(SEP):
        return to
    b2 = base.split(SEP)
    t2 = to.split(SEP)
    # remove common segments (except the last segment)
    for x, y in zip(b2[:-1], t2[:-1]):
        if x != y:
            break
        b2.pop(0)
        t2.pop(0)
    if b2 == t2:
        # Special case: relative_uri('f/index.html','f/index.html')
        # returns '', not 'index.html'
        return ''
    if len(b2) == 1 and t2 == ['']:
        # Special case: relative_uri('f/index.html','f/') should
        # return './', not ''
        return '.' + SEP
    return ('..' + SEP) * (len(b2)-1) + SEP.join(t2)
コード例 #6
0
ファイル: builder.py プロジェクト: mwmattis/confluencebuilder
def relative_uri(base, to):
    """Return a relative URL from ``base`` to ``to``."""
    if to.startswith(SEP):
        return to
    b2 = base.split(SEP)
    t2 = to.split(SEP)
    # remove common segments (except the last segment)
    for x, y in zip(b2[:-1], t2[:-1]):
        if x != y:
            break
        b2.pop(0)
        t2.pop(0)
    if b2 == t2:
        # Special case: relative_uri('f/index.html','f/index.html')
        # returns '', not 'index.html'
        return ''
    if len(b2) == 1 and t2 == ['']:
        # Special case: relative_uri('f/index.html','f/') should
        # return './', not ''
        return '.' + SEP
    return ('..' + SEP) * (len(b2) - 1) + SEP.join(t2)