imazen / repositext Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The IDML story file converter should do the reverse of the IDML story file parser: It should generate an XML file that can be placed into an IDML file's Stories/
directory. Combining the generated story file with a (probably pre-built and correctly adjusted) IDML file is the job of another class.
I gave you bad specs, Thomas. We don't want to export all the stories. We're still discussing the best way to select the correct stor(ies) for export here.
If an em
element has any class applied, but does not have an italic
class applied, output a span
element instead.
bundle exec kramdown_to_html_doc is producing [ and ] literals in html.
Used ITL65-0410.idml from batch 4 for testing.
gem 'kramdown', :path => '../kramdown' # NOTE: You need to check out the 'gemfile' branch to make it work.
I don't see a gemfile branch in imazen/kramdown..
AaronW-MBP:repositext-kramdown aaron$ bundle exec rake
/Users/aaron/.rbenv/versions/2.0.0-p353/bin/ruby -I"lib:lib:spec" -I"/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib" "/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/rake_test_loader.rb" "spec/*_/__spec.rb"
Run options: --seed 57438
....................................................................EF.......................................................
Finished in 0.088171s, 1417.6997 runs/s, 1463.0661 assertions/s.
Error:
Kramdown::ElementRt::#replace_with#test_0001_replaces self with other:
NoMethodError: undefined method any?' for <kd:text "text2" nil>:Kramdown::ElementRt /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/element_rt.rb:117:in
replace_with'
/Users/aaron/Documents/repositext/repositext-kramdown/spec/kramdown/element_rt_spec.rb:262:in `block (3 levels) in <top (required)>'
Failure:
Kramdown::ElementRt::#replace_with#test_0002_raises if you try to replace self with self [/Users/aaron/Documents/repositext/repositext-kramdown/spec/kramdown/element_rt_spec.rb:270]:
[ArgumentError] exception expected, not
Class:
Message: <"undefined method any?' for <kd:text \"text1\" nil>:Kramdown::ElementRt"> ---Backtrace--- /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/element_rt.rb:117:in
replace_with'
125 runs, 129 assertions, 1 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:lib:spec" -I"/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib" "/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/rake_test_loader.rb" "spec/*_/__spec.rb" ]
Tasks: TOP => default => test
(See full trace by running task with --trace)
@gettalong we would like to add location/position information to the kramdown parser for validation purposes, so that we can include line numbers when reporting validation issues with kramdown documents.
In your opinion, what's the best way to go about this, both technically and resource-wise?
Hi,
fyi: Michael Franzl just posted on the kramdown mailing list that he has written a Word .docx to kramdown converter- see https://github.com/michaelfranzl/docx_converter
Cheers and a happy new year,
Thomas
I didn't see a Gemspec in the core kramdown library. Should we just run
$ ruby setup.rb config
$ ruby setup.rb setup
$ ruby setup.rb install
After every pull in /kramdown, or is there a better way?
Didn't the idml converter used to error if [No paragraph style] existed?
It is not erroring now. None of the Question paragraph styles in ENG63-1226 had a paragraph style applied. I fixed the original file and imported it again.
In Marku, this works:
## location ## {: .location}
And presumably
## location {:.location}
In At-Kramdown, it only works like this:
## location
{: .location}
Intentional? Or bug?
Even after gem install tidy
, gem install unidecoder
, gem install coderay
, I'm still getting 6 errors running the unit tests on Kramdown:
test_/Users/nathanael/Documents/repositext/kramdown/test/testcases/block/04_header/with_auto_ids_text_to_kramdown_to_html(TestFiles)
LoadError: cannot load such file -- stringex/unidecoder
/Users/nathanael/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in require' /Users/nathanael/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
require'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/utils/unidecoder.rb:24:in <module:Unidecoder>' /Users/nathanael/Documents/repositext/kramdown/lib/kramdown/utils/unidecoder.rb:16:in
module:Utils'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/utils/unidecoder.rb:13:in <module:Kramdown>' /Users/nathanael/Documents/repositext/kramdown/lib/kramdown/utils/unidecoder.rb:12:in
<top (required)>'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/base.rb:156:in generate_id' /Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/html.rb:137:in
convert_header'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/html.rb:78:in block in inner' /Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/html.rb:77:in
each'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/html.rb:77:in inner' /Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/html.rb:332:in
convert_root'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/html.rb:65:in convert' /Users/nathanael/Documents/repositext/kramdown/lib/kramdown/converter/base.rb:79:in
convert'
/Users/nathanael/Documents/repositext/kramdown/lib/kramdown/document.rb:120:in method_missing' /Users/nathanael/Documents/repositext/kramdown/test/test_files.rb:134:in
block (2 levels) in class:TestFiles'
Currently we have a mix of both approaches.
I noticed one difference: The Gemfile approach does not allow specification of patch level.
If we want to specify patch level, we should use .ruby-version.
Question: is .ruby-version compatible with rbenv?
There is currently a fixed mapping from paragraph styles to class names. This mapping should be customizable.
Note that some post-parsing-transformations are done dependent on class names (e.g. removing of the leading tab in normal
and q
paragraphs) - should this also be customizable?
@nathanaeljones In an e-mail from 2013-08-28 you stated that unknown paragraph/character style name should be normalized to CSS class names.
Is this still to be done or is this a non-issue?
AaronW-MBP:repositext-kramdown aaron$ bundle exec rake warning: ignoring extraneous ruby-' prefix in version
ruby-2.0.0-p353'
(set by /Users/aaron/Documents/repositext/repositext-kramdown/.ruby-version)
/Users/aaron/.rbenv/versions/2.0.0-p353/bin/ruby -I"lib:lib:spec" -I"/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib" "/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/rake_test_loader.rb" "spec/*_/__spec.rb"
Run options: --seed 2673
.......................................................................................F........
Finished in 0.090116s, 1065.2936 runs/s, 1065.2936 assertions/s.
- :text - \"para \"
- :text - {:location=>1} - \"para \"
- :text - \"one\"
- :text - {:location=>1} - \"one\"
- :text - \"para \"
- :text - {:location=>3} - \"para \"
- :text - \"two\"
- :text - {:location=>3} - \"two\"
96 runs, 96 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:lib:spec" -I"/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib" "/Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/rake_test_loader.rb" "spec/*_/__spec.rb" ]
Tasks: TOP => default => test
(See full trace by running task with --trace)
<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Regular">
<Content> </Content>
<HyperlinkTextSource Self="u3e7e" Name="Source" Hidden="false" AppliedCharacterStyle="n">
<Content>had no</Content>
</HyperlinkTextSource>
<Content> prayer card, but she touched the border of His garment, for she said in her heart, “I know that Man tells the Truth. If I can touch His garment, I’ll be made well.” </Content>
</CharacterStyleRange>
There is currently still the problem with parsing sub document IDs. The latest kramdown version forbid IDs that start with a digit, so the example file (https://github.com/imazen/syntaxspec/blob/master/Demo.md) can't be parsed correctly.
@nathanaeljones told me that it was planned to use GUIDs. Since a GUID could start with a digit, it needs to be prepended with a letter. @nathanaeljones suggested using r
as prefix.
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
git clone https://github.com/maliayas/MarkdownEditing
cd MarkdownEditing
git checkout nathanael
Restart sublime.
In order to customize any of the colors;
ctrl+shift+p
. The scope name will appear in the status bar.For example, certain exports will require that I highlight the word following a sync marker with an additional span tag.
Another export will require that I apply classes to paragraph numbers and their parent block based on the number of digits in the paragraph number.
What's the best way for me to apply this kind of logic to the tree?
Consider evaluating idml story length based on text length of elements instead of length of serialized XML. Often footers or ID pages will contain dozens of pages of xml.
I think we should probably treat 0x2029 just like
<Br />
, as it originally had that role - even if it's no longer the 'modern' paragraph separator.
Note to Jo: Implement in Kramdown::Parser::IDMLStory#parse_char_children
I tried to convert some of the at files to icml to proof over them and I get the following. It fails on the first file and stops. It does create an icml but that file will not open.
AaronW-MBP:vgr-english aaron$ bundle exec kramdown_to_icml './content/65/*.at'
method_missing' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/idml_story.rb:32:in
convert'block in inner' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/idml_story.rb:39:in
each'inner' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/idml_story.rb:228:in
paragraph_style_range_tag'convert_p' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/idml_story.rb:32:in
convert'block in inner' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/idml_story.rb:39:in
each'inner' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/idml_story.rb:55:in
convert_root'convert' /Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/kramdown-1.3.0/lib/kramdown/converter/base.rb:104:in
convert'compute_story_xml' /Users/aaron/Documents/repositext/repositext-kramdown/lib/kramdown/converter/icml.rb:28:in
convert'convert' /Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/kramdown-1.3.0/lib/kramdown/document.rb:120:in
method_missing'block in run' /Users/aaron/Documents/repositext/repositext-kramdown/lib/repositext/cli/converter_icml.rb:29:in
each'run' /Users/aaron/Documents/repositext/repositext-kramdown/bin/kramdown_to_icml:16:in
<top (required)>'load' /Users/aaron/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/bin/kramdown_to_icml:23:in
'A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.