Wenyan: Can you provide a single JS file to convert a text into history books? TKS

Created on 20 Dec 2019  ·  7Comments  ·  Source: wenyan-lang/wenyan

Can you provide a single JS file to convert a text into history books?
Src / render.js in your project really didn't undstand how to do it.
Now I realize how to transform a text into an history book.
TKS

related-project

Most helpful comment

楚辭·離騷1

All 7 comments

你能单独 提供一个把一段文字转成古代书籍的例子吗?我找这功能好久了,您项目中的src/render.js我没有看明白他是如何转换的。
我现在需要实现 把一段文字转化成古代书籍的样子。最好只用JS就可以,不用NODE.JS和PYTHON

Yes, that would be possible. However you'll need to make a few changes. Right now I'm busy working on the language, so I can only give you a couple of steps:

  • Since you do not want node.js, you need to copy paste all the files require()'ed by render.js into render.js
  • render.js give keywords different colors, which you probably don't want for generic usage. Therefore, change all the fields of BOOK_COLORS to BLACK

Use this line to compute the SVG as strings

var svgs = render("name of your book here", "copy paste all your text here")

You can then do your thing with the array of SVG's returned. e.g. insert them into HTML, console.log them and copy the result, etc.

If you need help please let me know, I'll be glad to do so when I have time!
Thanks.

楚辭·離騷1

your do work is beautifrul!! tks ,i try it now ,

Yes, that would be possible. However you'll need to make a few changes. Right now I'm busy working on the language, so I can only give you a couple of steps:

  • Since you do not want node.js, you need to copy paste all the files require()'ed by render.js into render.js
  • render.js give keywords different colors, which you probably don't want for generic usage. Therefore, change all the fields of BOOK_COLORS to BLACK

Use this line to compute the SVG as strings

var svgs = render("name of your book here", "copy paste all your text here")

You can then do your thing with the array of SVG's returned. e.g. insert them into HTML, console.log them and copy the result, etc.

If you need help please let me know, I'll be glad to do so when I have time!
Thanks.

I do it as you suggest,but happend error ,I haved write email to your [email protected],Please guide in your idle time,very tks!!

@heangfat 你这个效果也不错,我已经看了,后面的JS竟然用繁体中文命名,着实服了一把,头一次见这样的

@heangfat I really liked the way you renders ChuCi from that image. Is that web site an open-source project? Can you share your rendering engine for that page? Would really like to start from your project in order to accomplish this: https://github.com/LingDong-/wenyan-lang/issues/321

Thank you in advance and looking forward to hearing from you soon.

Was this page helpful?
0 / 5 - 0 ratings