dyndoc-ruby-doc 1.0.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/dyndoc/document.rb +24 -23
- metadata +10 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: edde38388ba718dd3a0e49246f997aa67a66a2b3d3befaf6c3350f9c07784b8d
|
4
|
+
data.tar.gz: 2e1e3513ed2a0555bd9d74a6780e1af388c6b3efab01bc0a5957b7811f73eb25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73de84b84c9a6c1e8705dfa1791c0df77d0382352699d2630c550de8529fb345411121d7467cd0fcc99072f099e061e6f6585547fb2ab35bab1035170fe4a90
|
7
|
+
data.tar.gz: e236d9d0bf76edab60dc72b166e711a1a91a099531acae2695db13ce364289254527552cda0b302c30175c71ffda4cf09e7b620b6fd42254dcd1592b68cb805f
|
data/lib/dyndoc/document.rb
CHANGED
@@ -55,6 +55,7 @@ module Dyndoc
|
|
55
55
|
@cfg[k2.to_sym]=cfg[k]
|
56
56
|
end
|
57
57
|
end
|
58
|
+
## puts "append_cfg";p @cfg
|
58
59
|
end
|
59
60
|
|
60
61
|
def [](key)
|
@@ -68,9 +69,9 @@ module Dyndoc
|
|
68
69
|
|
69
70
|
end
|
70
71
|
|
71
|
-
EMPTY_ODT=File.join(ENV["HOME"],"dyndoc","share","odt","2004","empty.odt") if File.
|
72
|
-
EMPTY_ODT=File.join($dyn_gem_root,"share","odt","2004","emptyTex4Ht.odt") if $dyn_gem_root and File.
|
73
|
-
EMPTY_ODT=File.join("/export/prjCqls","share","rsrc","dyndoc","odt","2004","empty.odt") if File.
|
72
|
+
EMPTY_ODT=File.join(ENV["HOME"],"dyndoc","share","odt","2004","empty.odt") if File.exist? File.join(ENV["HOME"],"dyndoc","share","odt","2004","empty.odt")
|
73
|
+
EMPTY_ODT=File.join($dyn_gem_root,"share","odt","2004","emptyTex4Ht.odt") if $dyn_gem_root and File.exist? File.join($dyn_gem_root,"share","odt","2004","empty.odt")
|
74
|
+
EMPTY_ODT=File.join("/export/prjCqls","share","rsrc","dyndoc","odt","2004","empty.odt") if File.exist? File.join("/export/prjCqls","share","rsrc","dyndoc","odt","2004","empty.odt")
|
74
75
|
|
75
76
|
#just for a shortcut
|
76
77
|
TexDoc={
|
@@ -126,9 +127,11 @@ module Dyndoc
|
|
126
127
|
:raw_mode=>false,
|
127
128
|
:model_tmpl=>"default",
|
128
129
|
:model_doc=>"default",
|
130
|
+
:exec_mode=>"no",
|
129
131
|
:append => "",
|
130
132
|
:verbose => false,
|
131
|
-
:debug => false
|
133
|
+
:debug => false,
|
134
|
+
:ruby_only => false
|
132
135
|
}
|
133
136
|
|
134
137
|
|
@@ -207,7 +210,7 @@ module Dyndoc
|
|
207
210
|
|
208
211
|
def lib_dyn_content_from(tmpl=nil)
|
209
212
|
code,lib_file = "",nil
|
210
|
-
code=File.read(lib_file) if (lib_file=(Dyndoc::Utils.
|
213
|
+
code=File.read(lib_file) if (lib_file=(Dyndoc::Utils.lib_file_exist? tmpl))
|
211
214
|
return code
|
212
215
|
end
|
213
216
|
|
@@ -232,7 +235,7 @@ module Dyndoc
|
|
232
235
|
|
233
236
|
def cfg_dyn_from(tmpl)
|
234
237
|
code,cfg_file=nil,nil
|
235
|
-
code=File.read(cfg_file) if (cfg_file=(Dyndoc::Utils.
|
238
|
+
code=File.read(cfg_file) if (cfg_file=(Dyndoc::Utils.cfg_file_exist? tmpl))
|
236
239
|
##puts "code";p code;p cfg_file
|
237
240
|
Utils.clean_bom_utf8!(code) if code
|
238
241
|
code="Dyndoc::TexDoc" unless code
|
@@ -245,6 +248,7 @@ module Dyndoc
|
|
245
248
|
cfg_cmdline[:doc_list]=Dyndoc.cfg_dyn[:doc_list] unless Dyndoc.cfg_dyn[:doc_list].empty?
|
246
249
|
cfg_cmdline[:cmd]=Dyndoc.cfg_dyn[:cmd_doc] unless Dyndoc.cfg_dyn[:cmd_doc].empty?
|
247
250
|
cfg_cmdline[:model_doc]=Dyndoc.cfg_dyn[:model_doc] unless Dyndoc.cfg_dyn[:model_doc].empty?
|
251
|
+
cfg_cmdline[:exec_mode]=Dyndoc.cfg_dyn[:exec_mode] if Dyndoc.cfg_dyn[:exec_mode] and !Dyndoc.cfg_dyn[:exec_mode].empty?
|
248
252
|
cfg_cmdline[:tag_tmpl]=Dyndoc.cfg_dyn[:tag_tmpl] unless Dyndoc.cfg_dyn[:tag_tmpl].empty?
|
249
253
|
cfg_cmdline[:options]=Dyndoc.cfg_dyn[:options] unless Dyndoc.cfg_dyn[:options].empty?
|
250
254
|
## select doc_list by reading "[#default]" useful in atom
|
@@ -327,6 +331,7 @@ module Dyndoc
|
|
327
331
|
:mode_doc => :tex, #execution mode
|
328
332
|
:rootDoc=>"",
|
329
333
|
:model_doc=>"default",
|
334
|
+
:exec_mode=>"no",
|
330
335
|
:pre_doc=>[],
|
331
336
|
:post_doc=>[],
|
332
337
|
:cmd=> [], # :save , :cat, :pdf or :png, :view behaving differently depending on the format_doc
|
@@ -420,8 +425,7 @@ module Dyndoc
|
|
420
425
|
def make_all
|
421
426
|
#puts "make_all";p @cfg[:cmd]
|
422
427
|
make_prelim
|
423
|
-
#
|
424
|
-
puts "make_all";p @cfg[:cmd]
|
428
|
+
#puts "make_all";p @cfg[:cmd]
|
425
429
|
cd_new
|
426
430
|
open_log
|
427
431
|
|
@@ -432,7 +436,8 @@ puts "make_all";p @cfg[:cmd]
|
|
432
436
|
# make content
|
433
437
|
make_content if @cfg[:cmd].include? :make_content
|
434
438
|
##OBSOLETE## @content=make_ttm if @cfg[:format_doc]==:ttm
|
435
|
-
|
439
|
+
@cfg[:cmd] -= [:save] if Dyndoc.cfg_dyn[:exec_mode]=="yes"
|
440
|
+
#puts "make_all";p [@cfg[:cmd],Dyndoc.cfg_dyn[:exec_mode]]
|
436
441
|
make_save unless (@cfg[:cmd] & [:save,:save!]).empty?
|
437
442
|
##OBSOLETE## make_pandoc if @cfg[:cmd].include? :pandoc
|
438
443
|
##OBSOLETE## make_backup if @cfg[:cmd].include? :backup
|
@@ -477,7 +482,7 @@ puts "make_all";p @cfg[:cmd]
|
|
477
482
|
=begin
|
478
483
|
# read current path if it exists
|
479
484
|
cur_path=File.join(@dirname,".dyn_path")
|
480
|
-
Dyndoc.setRootDoc(@cfg[:rootDoc],File.read(cur_path).chomp,true) if File.
|
485
|
+
Dyndoc.setRootDoc(@cfg[:rootDoc],File.read(cur_path).chomp,true) if File.exist? cur_path
|
481
486
|
Dyndoc.make_append unless Dyndoc.appendVar
|
482
487
|
=end
|
483
488
|
#p "ici";p @cfg
|
@@ -586,22 +591,18 @@ puts "make_all";p @cfg[:cmd]
|
|
586
591
|
nb = @cfg[:options][:pdflatex_nb_pass] || @tmpl_doc.cfg[:options][:pdflatex_nb_pass] || 1
|
587
592
|
if @cfg[:format_doc]==:tex
|
588
593
|
require 'dyntask'
|
589
|
-
|
590
|
-
|
591
|
-
task[:texinputs]=ENV["TEXINPUTS"] if ENV["TEXINPUTS"] and !ENV["TEXINPUTS"].empty?
|
592
|
-
id=DynTask.add_task(task)
|
593
|
-
DynTask.save_tasks(id,@basename)
|
594
|
+
DynTask.add_task({cmd: :pdflatex, source: "%"+@basename+".tex", content: @content.force_encoding("utf-8"), nb_pass: nb, echo: echo})
|
595
|
+
DynTask.save_tasks(@basename)
|
594
596
|
end
|
595
597
|
end
|
596
598
|
|
597
599
|
def make_task_pandoc
|
598
600
|
filter=@cfg[:format_doc].to_s + "2" + @cfg[:format_output].to_s
|
599
601
|
require 'dyntask'
|
600
|
-
task={cmd: :pandoc,
|
601
|
-
task[:
|
602
|
-
task
|
603
|
-
|
604
|
-
DynTask.save_tasks(id,@basename)
|
602
|
+
task={cmd: :pandoc, content: @content.force_encoding("utf-8"), filter: filter}
|
603
|
+
task[:source]="%"+@basename+".tex" if ["tex2docx","tex2odt"].include? filter
|
604
|
+
DynTask.add_task(task)
|
605
|
+
DynTask.save_tasks(@basename)
|
605
606
|
end
|
606
607
|
|
607
608
|
def make_odt_content_xml
|
@@ -662,7 +663,7 @@ puts "make_all";p @cfg[:cmd]
|
|
662
663
|
# As soon as possible when using dropbox or tools
|
663
664
|
def make_old(mode=:rm) #mode=:rm or :save
|
664
665
|
## After introduction of dyntask, the default is to save the old file if existing
|
665
|
-
if File.
|
666
|
+
if File.exist? @filename
|
666
667
|
case mode
|
667
668
|
when :save
|
668
669
|
FileUtils.mkdir_p(File.join(File.dirname(@filename),".save"))
|
@@ -679,7 +680,7 @@ puts "make_all";p @cfg[:cmd]
|
|
679
680
|
#before saving: make automatic styles!
|
680
681
|
make_odt_content_xml
|
681
682
|
make_odt_automatic_styles
|
682
|
-
FileUtils.cp(EMPTY_ODT,@cfg[:filename_doc]) unless File.
|
683
|
+
FileUtils.cp(EMPTY_ODT,@cfg[:filename_doc]) unless File.exist? @cfg[:filename_doc]
|
683
684
|
require 'zip'
|
684
685
|
@ar=Zip::ZipFile.open(@cfg[:filename_doc])
|
685
686
|
@ar.get_output_stream('content.xml') do |f|
|
@@ -696,7 +697,7 @@ puts "make_all";p @cfg[:cmd]
|
|
696
697
|
|
697
698
|
## if @content is nil => bad execution
|
698
699
|
if !@content
|
699
|
-
FileUtils.mv(@filename_old,@filename) if @filename_old and File.
|
700
|
+
FileUtils.mv(@filename_old,@filename) if @filename_old and File.exist? @filename_old
|
700
701
|
else
|
701
702
|
## Save new
|
702
703
|
File.open(@cfg[:filename_doc],"w") do |f|
|
metadata
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndoc-ruby-doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
Provide templating in text document.
|
13
|
+
description: " Provide templating in text document.\n"
|
15
14
|
email: rdrouilh@gmail.com
|
16
15
|
executables: []
|
17
16
|
extensions: []
|
@@ -22,27 +21,26 @@ files:
|
|
22
21
|
homepage: http://cqls.upmf-grenoble.fr
|
23
22
|
licenses:
|
24
23
|
- MIT
|
25
|
-
- GPL-2
|
24
|
+
- GPL-2.0
|
26
25
|
metadata: {}
|
27
|
-
post_install_message:
|
26
|
+
post_install_message:
|
28
27
|
rdoc_options: []
|
29
28
|
require_paths:
|
30
29
|
- lib
|
31
30
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
31
|
requirements:
|
33
|
-
- -
|
32
|
+
- - ">="
|
34
33
|
- !ruby/object:Gem::Version
|
35
34
|
version: '0'
|
36
35
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
|
-
- -
|
37
|
+
- - ">="
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '0'
|
41
40
|
requirements:
|
42
41
|
- none
|
43
|
-
|
44
|
-
|
45
|
-
signing_key:
|
42
|
+
rubygems_version: 3.4.5
|
43
|
+
signing_key:
|
46
44
|
specification_version: 4
|
47
45
|
summary: dyndoc document
|
48
46
|
test_files: []
|