Skip to content

Commit 5264702

Browse files
authored
Merge pull request #94 from aklef/master
Fixes #92 (Upload path uses system separator vs. web separator)
2 parents ae7009d + cc3734f commit 5264702

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

docs/commands.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ Insert current datetime
128128
:Description: Inserts the current datetime at the cursor using the format specified by the ``jekyll_datetime_format`` setting.
129129

130130

131-
Insert upload
132-
^^^^^^^^^^^^^
131+
Insert upload tag
132+
^^^^^^^^^^^^^^^^^
133133

134134
:Command: ``jekyll_insert_upload``
135-
:Description: Brings up a quick panel for choosing an existing file in your ``uploads`` directory, and adds a pre-formatted link at the cursor.
135+
:Description: Brings up a quick panel allowing you to choose an existing file from your ``jekyll_uploads_path`` directory, and creates a pre-formatted link at the cursor. This won't move the selected file, nor will it check if the realtive URL it creates points to an actual file.
136136

137137

138138
Jekyll Utility

docs/settings.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ User Settings
6161
``jekyll_uploads_baseurl``
6262
^^^^^^^^^^^^^^^^^^^^^^^^^^
6363

64-
:Default: ``{{ site.baseurl }}``
65-
:Description: This string value should represent the **baseurl** for the uploads directory. For example, if your uploads directory is ``uploads`` and you have an image called ``image.png``, the output of inserting the image in your post would be ``{{ uploads_baseurl }}/uploads/image.png``, with ``{{ uploads_baseurl }}`` replace by its value.
64+
:Default: ``{{site.baseurl}}``
65+
:Description: This string value should represent the **baseurl** for the uploads directory of your site. For example, if your uploads directory is ``/uploads`` and you have an image called ``image.png``, the output of inserting the image in your post with the ``Insert upload tag`` command would be ``{{ uploads_baseurl }}/uploads/image.png``, with ``{{ uploads_baseurl }}`` replaced by its value.
6666

6767

6868
.. note::
6969

70-
If you wish to have an absolute link and you have ``url`` defined in your Jekyll ``config.yml`` file, then you can set the value to ``{{ site.url }}/{{ site.baseurl }}``.
70+
If you wish to have an absolute link and you have ``url`` defined in your Jekyll ``config.yml`` file, then you can set the value to ``{{site.url}}/{{site.baseurl}}``.
7171

7272

7373
``jekyll_default_markup``
@@ -144,7 +144,7 @@ For per-project settings, make sure you add your Jekyll settings correctly to yo
144144
.. code-block:: python
145145
146146
# some-file.sublime-settings
147-
147+
148148
{
149149
"folders":
150150
[
@@ -171,4 +171,4 @@ For per-project settings, make sure you add your Jekyll settings correctly to yo
171171
Read the conversation on `issue #16`_ if you have questions on formatting your Project settings file correctly.
172172

173173

174-
.. _issue #16: https://github.com/23maverick23/sublime-jekyll/issues/16
174+
.. _issue #16: https://github.com/23maverick23/sublime-jekyll/issues/16

jekyll.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,8 +1200,9 @@ def run(self, edit, **args):
12001200
uploads_path = get_setting(self.view, 'jekyll_uploads_path')
12011201
uploads_baseurl = get_setting(self.view, 'jekyll_uploads_baseurl')
12021202
relative_path = os.path.relpath(args["path"], os.path.dirname(uploads_path))
1203+
relative_path = relative_path.replace(os.sep, '/')
12031204

1204-
# check if image
1205+
# build image URL
12051206
link_str = "{0}[{1}]({2}/{3})".format(
12061207
'!' if imghdr.what(args["path"]) is not None else '',
12071208
'${1:' + args["name"] + '}', uploads_baseurl, relative_path

0 commit comments

Comments
 (0)