Module: GovukTechDocs
- Defined in:
- lib/govuk_tech_docs.rb,
lib/govuk_tech_docs/pages.rb,
lib/govuk_tech_docs/version.rb,
lib/govuk_tech_docs/meta_tags.rb,
lib/govuk_tech_docs/redirects.rb,
lib/govuk_tech_docs/page_review.rb,
lib/govuk_tech_docs/contribution_banner.rb,
lib/govuk_tech_docs/tech_docs_html_renderer.rb,
lib/govuk_tech_docs/table_of_contents/heading.rb,
lib/govuk_tech_docs/table_of_contents/helpers.rb,
lib/govuk_tech_docs/unique_identifier_extension.rb,
lib/govuk_tech_docs/unique_identifier_generator.rb,
lib/govuk_tech_docs/table_of_contents/heading_tree.rb,
lib/govuk_tech_docs/table_of_contents/headings_builder.rb,
lib/govuk_tech_docs/table_of_contents/heading_tree_builder.rb,
lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb
Defined Under Namespace
Modules: ContributionBanner, TableOfContents Classes: MetaTags, PageReview, Pages, Redirects, SourceUrls, TechDocsHTMLRenderer, UniqueIdentifierExtension, UniqueIdentifierGenerator
Constant Summary collapse
- VERSION =
"1.2.0".freeze
Class Method Summary collapse
Class Method Details
.configure(context) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/govuk_tech_docs.rb', line 24 def self.configure(context) context.activate :autoprefixer context.activate :sprockets context.activate :syntax context.files.watch :source, path: "#{__dir__}/source" context.set :markdown_engine, :redcarpet context.set :markdown, renderer: TechDocsHTMLRenderer.new( with_toc_data: true ), fenced_code_blocks: true, tables: true, no_intra_emphasis: true # Reload the browser automatically whenever files change context.configure :development do activate :livereload end context.configure :build do activate :minify_css activate :minify_javascript end context.config[:tech_docs] = YAML.load_file('config/tech-docs.yml').with_indifferent_access context.activate :unique_identifier context.helpers do include GovukTechDocs::TableOfContents::Helpers include GovukTechDocs::ContributionBanner def ||= GovukTechDocs::MetaTags.new(config, current_page) end def current_page_review @current_page_review ||= GovukTechDocs::PageReview.new(current_page) end def format_date(date) date.strftime('%-e %B %Y') end end context.page '/*.xml', layout: false context.page '/*.json', layout: false context.page '/*.txt', layout: false context.ready do redirects = GovukTechDocs::Redirects.new(context).redirects redirects.each do |from, to| context.redirect from, to end end end |