asciidoctor-latex 1.5.0.14.dev → 1.5.0.15.dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc734ad876211ade9c666f3435c2336fb7f4e137
4
- data.tar.gz: d214449fbd2f4801d6a71b356cb8b11591e36da4
3
+ metadata.gz: 2eb1be67600beb3fba62db4022504dc0d44c92ac
4
+ data.tar.gz: aa1699d76a04a60fbb483bb2bccc98b49ae84e5b
5
5
  SHA512:
6
- metadata.gz: 12206f4ecca6eeaa1d403c434801a9e9fedecab9e5ff419df938a13a33cd1a7cf4b1470663bc8a36083730f39a047fb750364968f17e978177cd4105ffccfee4
7
- data.tar.gz: 3204d66f18648782cc38d8fdf6dc75c1eb7c1a8837bd3d38c39b99a23e8d7942cc891bce5bc54ceed00b715a5c3fba65650df3db29c08d4ee4246b47b9858125
6
+ metadata.gz: 664b4a2771ff48b5c910edd1c8c0bc71285fb5f7c468e1892712f1c8971f4269ceb841919600e20e00321975b279efc04ececbbc10fb8270df59710df05fc5a8
7
+ data.tar.gz: 5ce18becc5a53d1f186754b5d4b2a0410f7f5336e984fcdec0f3d028bbe63cbb29dd8c28908afd6de66bcf2352fe251ee5bf8c76f2be82c9d78fa5fdca1ac378
@@ -22,19 +22,23 @@ for cross-referencing, e.g.,
22
22
  `[env.equation#hohoho]`, then it is numbered.
23
23
  ////
24
24
 
25
- 1.5.0.12.dev:: (1) Make 'latex' the default dialect: no ``-a dialect=blahblah` switch is needed.
25
+ 1.5.0.15.dev:: (1) Eliminate automatic inclusion of `macros.tex` if it is present.
26
+ (2) Introduce the block macro `include_latex_macros::LATEX_FILE`, where LATEX_FILE is
27
+ typically a LaTeX style or macro file, or a path thereto. For the HTML backend, the file is included
28
+ in the source text as `\( FILE CONTENTS \)`. For the tex backend it is included as-is.
29
+
30
+ 1.5.0.14.dev:: Add the inadvertently omitted file `print.css` to the repository.
31
+
32
+ 1.5.0.13.dev:: (1) Make 'latex' the default dialect: no ``-a dialect=blahblah` switch is needed.
26
33
  (2) Add file data/print.css for better print output.
27
34
  (3) Add documentnation on how to use data/print.css.
28
35
  (4)NOTE: solution in previous line is awkward. One should be able to access
29
36
  the css file without copying it form data/ (or useing a long file path)
30
37
 
31
-
32
-
33
38
  1.5.0.12.dev:: Fix issue #44 in which the file
34
39
  macros.tex is ignored in the latex dialect
35
40
  when using the html backend.
36
41
 
37
-
38
42
  1.5.0.11.dev:: Enable the syntax
39
43
  `Asciidoctor.convert str, { 'dialect' => 'latex' }`
40
44
  for specifying the dialect in the Ruby API.
@@ -103,11 +103,13 @@ to produce `foo.tex`.
103
103
 
104
104
  === Macro files
105
105
 
106
- The contents of a file named `macros.tex` will be
107
- read and used by `asciidoctor-latex`
108
- if it is in the same directory as the file
109
- being rendered. This is the case regardless
110
- of the output format -- HTML or tex.
106
+ To include a LaTeX macro file MACRO_FILE, insert the code
107
+ `include_latex_macros::MACRO_FILE[]`. This works
108
+ for both the html and tex backends.
109
+
110
+
111
+ NOTE: Automatic inclusion of the file `macros.tex`
112
+ has been discontinued.
111
113
 
112
114
 
113
115
  === Switches
@@ -118,11 +120,11 @@ To generate a tex file with a minimal header, do:
118
120
  $ asciidoctor-latex -a header=no foo.adoc
119
121
 
120
122
  .Print style
121
- An alternate css file, `data/print.css` is provided
122
- for printing. It features wider margins and a smaller
123
- type size. Copy it to the root of your document
124
- folder and use the commeand `asciidoctor-latex -a stylesheet=print.css`
125
- or more generally `asciidoctor-latex -a stylesheet=path_to/print.css`.
123
+ An alternate css file, `data/print.css` is provided
124
+ for printing. It features wider margins and a smaller
125
+ type size. Copy it to the root of your document
126
+ folder and use the command `asciidoctor-latex -a stylesheet=print.css`
127
+ or more generally `asciidoctor-latex -a stylesheet=path_to/print.css`.
126
128
 
127
129
 
128
130
  {adlp}'s default form at is `:latexmath`.
@@ -19,11 +19,43 @@ require 'asciidoctor/extensions'
19
19
  require 'asciidoctor/latex/core_ext/colored_string'
20
20
 
21
21
 
22
+
22
23
  module Asciidoctor::LaTeX
24
+
25
+ # Usage: `include_latex::LATEX_FILE`, where LATEX_FILE is
26
+ # typically a LaTeX style or macro file, or a path thereto.
27
+ # For the HTML backend, the file is included
28
+ # in the source text as `\( FILE CONTENTS \)`.
29
+ # For the tex backend it is included as-is.
30
+ class IncludeLatexBlockMacro < Asciidoctor::Extensions::BlockMacroProcessor
31
+
32
+ use_dsl
33
+
34
+ named :include_latex_macros
35
+
36
+ def process parent, target, attrs
37
+ # puts "attrs: #{attrs.values.to_s.red}"
38
+ # puts "target: #{target.to_s.red}"
39
+
40
+ file_contents = IO.read(target)
41
+ if file_contents == nil
42
+ file_contents = IO.read('public/macros.tex')
43
+ end
44
+
45
+ if parent.document.basebackend? 'html'
46
+ content = "\n\\(\n#{file_contents}\n\\)\n" || ''
47
+ else
48
+ content = "\n#{file_contents}\n" || ''
49
+ end
50
+
51
+ create_pass_block parent, content, attrs, subs: nil
52
+ end
53
+
54
+ end
55
+
23
56
  class ClickBlock < Asciidoctor::Extensions::BlockProcessor
24
57
 
25
58
  use_dsl
26
- # ^^^ don't know what this is. Could you explain?
27
59
 
28
60
  named :click
29
61
  on_context :open
@@ -83,7 +83,7 @@
83
83
  # You can put files 'macros.tex' and 'preamble.tex' to
84
84
  # replace the default preamble and set of macros.
85
85
  # Define your own 'newEnvironments.tex' to use your definitions
86
- # as opposed to the default definitons of environments
86
+ # as opposed to the default definitions of environments
87
87
  # in tex mapping to [tex.ENVIRONOMENT] in asciidoctor-latex.
88
88
  #
89
89
  # TECHNICAL NOTES (This section needs a thorough rewrite)
@@ -265,12 +265,12 @@ module Asciidoctor::LaTeX
265
265
  # Example:
266
266
  # [env.include_latex]
267
267
  # --
268
- # \nput abc.text
268
+ # \input abc.text
269
269
  # \usepackage{def}
270
270
  # --
271
271
  # Nothing appears in the HTML,
272
272
  # bu lines
273
- # \nput abc.text
273
+ # \input abc.text
274
274
  # \usepackage{def}
275
275
  # appear in the generated tex file.
276
276
  def handle_include_latex node
@@ -483,6 +483,8 @@ module Asciidoctor::LaTeX
483
483
 
484
484
  dialect = document.options['dialect'] || document.attributes['dialect'] || 'latex'
485
485
 
486
+ # puts "DIALECT = #{dialect}".red
487
+
486
488
  if ['asciidoc', 'manuscript'].include? dialect
487
489
 
488
490
  preprocessor DollarPreprocessor if document.basebackend? 'tex'
@@ -512,6 +514,8 @@ module Asciidoctor::LaTeX
512
514
 
513
515
  inline_macro ChemInlineMacro
514
516
 
517
+ block_macro IncludeLatexBlockMacro
518
+
515
519
  postprocessor InjectHTML unless document.attributes['inject_javascript'] == 'no'
516
520
  postprocessor Chem if document.basebackend? 'html'
517
521
  postprocessor HTMLPostprocessor if document.basebackend? 'html'
@@ -8,6 +8,7 @@ require 'asciidoctor/latex/core_ext/colored_string'
8
8
  #
9
9
  module Asciidoctor::LaTeX
10
10
 
11
+
11
12
  class ChemInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
12
13
  use_dsl
13
14
  named :chem
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module LaTeX
3
- VERSION = '1.5.0.14.dev'
3
+ VERSION = '1.5.0.15.dev'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-latex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.14.dev
4
+ version: 1.5.0.15.dev
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Carlson
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
320
  version: 1.3.1
321
321
  requirements: []
322
322
  rubyforge_project:
323
- rubygems_version: 2.6.2
323
+ rubygems_version: 2.4.5.1
324
324
  signing_key:
325
325
  specification_version: 4
326
326
  summary: Converts AsciiDoc documents to LaTeX, provides LaTeX extensions to Asciidoc