Skip to content

Commit

Permalink
resolves #270 clear :base_dir option if value is :docdir and docdir i…
Browse files Browse the repository at this point in the history
…nformation is not available (PR #277)
  • Loading branch information
mojavelinux authored Nov 6, 2023
1 parent 8f180ac commit 07a9671
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/master[

== Unreleased

_No changes since previous release._
* clear `:base_dir` option if value is `:docdir` and paths with docdir information is not available (such as to `asciidocify` filter) (#270)

== 3.0.0 (2019-08-31) - @mojavelinux

Expand Down
2 changes: 2 additions & 0 deletions lib/jekyll-asciidoc/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ def convert content
paths.delete 'docdir'
end
opts[:attributes] = opts[:attributes].merge paths
elsif opts[:base_dir] == :docdir
opts.delete :base_dir
end
if (doctype = data['doctype'])
opts[:doctype] = doctype
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
</head>
<body>
<div class="page-content">
{% if page.asciidocifyme %}
<p>{{ page.asciidocifyme | asciidocify 'inline' }}</p>
{% endif %}
{{ content }}
</div>
</body>
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/include_relative_to_docdir/about/index.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
= About Us
:page-asciidocifyme: *Who* we are.

We provide content design services for open source tech companies.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= Post With Synopsis
:page-synopsis: This is the _synopsis_ of this post.

Lorem ipsum.
5 changes: 3 additions & 2 deletions spec/fixtures/with_posts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ <h1>Posts</h1>
<ul class="posts">
{% for post in site.posts %}
<li>
<a href="{{ post.url }}">{{ post.title }}</a>
{% if post.excerpt != '' %}<div class="excerpt">{{ post.excerpt }}</div>{% endif %}
<a href="{{ post.url }}">{{ post.title }}</a>{% if post.synopsis %}
<div class="synopsis">{{ post.synopsis | asciidocify: 'inline' }}</div>{% endif %}{% if post.excerpt != '' %}
<div class="excerpt">{{ post.excerpt }}</div>{% endif %}
</li>
{% endfor %}
</ul>
Expand Down
2 changes: 2 additions & 0 deletions spec/jekyll-asciidoc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@
(expect ::File).to exist file
contents = ::File.read file
(expect contents).to include '<div class="excerpt">This is the <em>excerpt</em> of this post.</div>'
(expect contents).to include '<div class="synopsis">This is the <em>synopsis</em> of this post.</div>'
end

it 'should convert excerpt from AsciiDoc using page-specific doctype' do
Expand Down Expand Up @@ -1083,6 +1084,7 @@
out_file = output_file 'about/index.html'
(expect ::File).to exist out_file
contents = ::File.read out_file
(expect contents).to include '<strong>Who</strong> we are.'
(expect contents).to include 'Doc Writer'
(expect contents).to include %(docfile=#{src_file})
(expect contents).to include %(docdir=#{::File.dirname src_file})
Expand Down

0 comments on commit 07a9671

Please sign in to comment.