documentation-editor 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3625a114ab98bcbd702d8b61f9cfdb9f557faf79
4
- data.tar.gz: 6dbc8592fd6b1912638a7f30eedec88f3edab4be
3
+ metadata.gz: 128ed59d24e3216bc8c4307d0bafb76035e8436b
4
+ data.tar.gz: 26ed4bd0fe4caa858601549f24f9efb59a3c21ae
5
5
  SHA512:
6
- metadata.gz: a0cab134e685459d2ed0f30ff4b2fb4dd2a9f79bd68156cda70b027ab1722bcb15dddab7b67fe85e1e95c9bb9ec6c1add9c9f723768f20fd134e8c4d8fb240f2
7
- data.tar.gz: 74bcfcec2eae27e018a9a3034fd892128bbbf964714566addbe69c6d3bbcbdf52df9a68b895c7907c9626cedb88ffed3b9486bf09d7ba755352d8c63ba23209e
6
+ metadata.gz: 7ebf3279f79bbe3d19694f0d2791cea55c7218a7de1485cce7ea67518a5da0030c34eda2a4c380ea03ad361ea4f3341f12eb975e8c3cb6b08c455d5e62d64341
7
+ data.tar.gz: 2d86d9980b3cd0ad1c17c3e4ac84e0d953ee1c12b9af01ab35381bb4c1317cdc590a1cb693197316fc71894121f5d45b867aec1f8d1f356942cad8addbae0dc9
@@ -40,6 +40,16 @@ module DocumentationEditor
40
40
  roots
41
41
  end
42
42
 
43
+ def section_title(options, section)
44
+ doc = parse_document(options.merge(no_wrap: true))
45
+ ids = id_generator(doc)
46
+ doc.root.children.each do |child|
47
+ text = child.options[:raw_text]
48
+ return text if child.type == :header && child.options[:level] == 1 && section == ids.generate_id(resolve_variables(options, text))
49
+ end
50
+ nil
51
+ end
52
+
43
53
  private
44
54
  def parse_document(options)
45
55
  doc = Kramdown::Document.new(content, options.merge(input: 'BlockKramdown'))
@@ -4,6 +4,7 @@
4
4
  = render partial: 'menu_items', object: @revision.to_toc(@options)
5
5
 
6
6
  - content_for :page_title, @page.title
7
+ - content_for :section_title, @revision.section_title(@options, params[:section]) if params[:section]
7
8
 
8
9
  .markdown-page
9
10
  - if DocumentationEditor::Config.is_admin && send(DocumentationEditor::Config.is_admin)
@@ -1,3 +1,3 @@
1
1
  module DocumentationEditor
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: documentation-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia Team