diff options
-rw-r--r-- | AUTHORS.md | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lib/utils/links.js | 53 | ||||
-rw-r--r-- | lib/utils/page.js | 5 | ||||
-rw-r--r-- | theme/i18n/tr.json | 20 |
5 files changed, 53 insertions, 29 deletions
@@ -61,3 +61,5 @@ Translators - @mjanda - Swedish - Jacob Burenstam (@buren) +- Turkish + - Turan Konan (@turankonan) @@ -8,7 +8,7 @@ GitBook GitBook is a command line tool (and Node.js library) for building beautiful books using GitHub/Git and Markdown (or AsciiDoc). Here is an example: [Learn Javascript](https://www.gitbook.com/book/GitBookIO/javascript). -You can publish and host book easily online using [gitbook.com](https://www.gitbook.com), a desktop editor is [also available](https://www.gitbook.com/editor). +You can publish and host books easily online using [gitbook.com](https://www.gitbook.com). A desktop editor is [also available](https://www.gitbook.com/editor). Check out the [GitBook Community Slack Channel](https://slack.gitbook.com), Stay updated by following [@GitBookIO](https://twitter.com/GitBookIO) on Twitter or [GitBook](https://www.facebook.com/gitbookcom) on Facebook. diff --git a/lib/utils/links.js b/lib/utils/links.js index 589e0d7..5122396 100644 --- a/lib/utils/links.js +++ b/lib/utils/links.js @@ -1,51 +1,50 @@ -var url = require("url"); -var path = require("path"); +var url = require('url'); +var path = require('path'); // Is the link an external link -var isExternal = function(href) { +function isExternal(href) { try { return Boolean(url.parse(href).protocol); - } catch(err) { } - - return false; -}; + } catch(err) { + return false; + } +} // Return true if the link is relative -var isRelative = function(href) { +function isRelative(href) { try { var parsed = url.parse(href); return !!(!parsed.protocol && parsed.path); - } catch(err) {} - - return true; -}; + } catch(err) { + return true; + } +} // Return true if the link is an achor -var isAnchor = function(href) { +function isAnchor(href) { try { var parsed = url.parse(href); return !!(!parsed.protocol && !parsed.path && parsed.hash); - } catch(err) {} - - return false; -}; + } catch(err) { + return false; + } +} // Normalize a path to be a link -var normalizeLink = function(s) { - return s.replace(/\\/g, "/"); -}; +function normalizeLink(s) { + return s.replace(/\\/g, '/'); +} // Relative to absolute path // dir: directory parent of the file currently in rendering process // outdir: directory parent from the html output - -var toAbsolute = function(_href, dir, outdir) { +function toAbsolute(_href, dir, outdir) { if (isExternal(_href)) return _href; // Path "_href" inside the base folder var hrefInRoot = path.normalize(path.join(dir, _href)); - if (_href[0] == "/") hrefInRoot = path.normalize(_href.slice(1)); + if (_href[0] == '/') hrefInRoot = path.normalize(_href.slice(1)); // Make it relative to output _href = path.relative(outdir, hrefInRoot); @@ -54,22 +53,22 @@ var toAbsolute = function(_href, dir, outdir) { _href = normalizeLink(_href); return _href; -}; +} // Join links -var join = function() { +function join() { var _href = path.join.apply(path, arguments); return normalizeLink(_href); }; // Change extension -var changeExtension = function(filename, newext) { +function changeExtension(filename, newext) { return path.join( path.dirname(filename), path.basename(filename, path.extname(filename))+newext ); -}; +} module.exports = { isAnchor: isAnchor, diff --git a/lib/utils/page.js b/lib/utils/page.js index 0636ce8..010d703 100644 --- a/lib/utils/page.js +++ b/lib/utils/page.js @@ -205,9 +205,12 @@ function normalizeHtml(src, options) { // Keep it as it is } else if (links.isRelative(href)) { var parts = url.parse(href); - var absolutePath = links.join(options.base, parts.pathname); + + var pathName = decodeURIComponent(parts.pathname); var anchor = parts.hash || ''; + // Calcul absolute path for this file (without the anchor) + var absolutePath = links.join(options.base, pathName); // If is in navigation relative: transform as content if (options.navigation[absolutePath]) { diff --git a/theme/i18n/tr.json b/theme/i18n/tr.json new file mode 100644 index 0000000..d92d5a2 --- /dev/null +++ b/theme/i18n/tr.json @@ -0,0 +1,20 @@ +{ + "LANGS_CHOOSE": "Dil seçimi", + "GLOSSARY": "Sözlük", + "GLOSSARY_INDEX": "Dizin", + "GLOSSARY_OPEN": "Sözlük", + "GITBOOK_LINK": "GitBook ile yayınla", + "SUMMARY": "İçindekiler", + "SUMMARY_INTRODUCTION": "Giriş", + "SUMMARY_TOGGLE": "İçindekiler", + "SEARCH_TOGGLE": "Arama", + "SEARCH_PLACEHOLDER": "Aramak istediğiniz", + "FONTSETTINGS_TOGGLE": "Font Ayarları", + "SHARE_TOGGLE": "Paylaş", + "SHARE_ON": "{{platform}} ile paylaş", + "FONTSETTINGS_WHITE": "Beyaz", + "FONTSETTINGS_SEPIA": "Sepya", + "FONTSETTINGS_NIGHT": "Karanlık", + "FONTSETTINGS_SANS": "Sans", + "FONTSETTINGS_SERIF": "Serif" +} |