WO2019214539A1 - 一种文档展示方法和装置 - Google Patents

一种文档展示方法和装置 Download PDF

Info

Publication number
WO2019214539A1
WO2019214539A1 PCT/CN2019/085466 CN2019085466W WO2019214539A1 WO 2019214539 A1 WO2019214539 A1 WO 2019214539A1 CN 2019085466 W CN2019085466 W CN 2019085466W WO 2019214539 A1 WO2019214539 A1 WO 2019214539A1
Authority
WO
WIPO (PCT)
Prior art keywords
document
component
code
react native
web
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/085466
Other languages
English (en)
French (fr)
Inventor
谢焕榆
陈智浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2019214539A1 publication Critical patent/WO2019214539A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Definitions

  • the present application relates to the field of computer technology, and in particular, to a document display method and a document display device.
  • the React Native component for native systems is a common UI component.
  • the current documentation for the React Native component can only display the source code of the React Native component, and it is not possible to preview the running of the code, which is not conducive to the user to quickly understand the React Native component.
  • a document display method including:
  • the Markdown document includes a React Native component code
  • the Html webpage document is displayed on the web end in the React Native running environment based on the compatible code emulation, and the preview effect is displayed in the Html webpage document by using the React Native component code.
  • the method further includes:
  • the step of converting the Markdown document into an Html webpage document on the web end includes:
  • the Html web page document is generated by the conversion component using the metadata.
  • the method further includes:
  • the step of generating the Html webpage document by using the metadata by using the conversion component includes:
  • the metadata specified by the configuration file is obtained by the conversion component, and the Html webpage document is generated by using the metadata.
  • the step of displaying the Html webpage document and displaying the preview effect in the Html webpage document by using the React Native component code in the React Native running environment based on the compatible code simulation on the web end comprises:
  • the step of converting the React Native component code into the code adapted to the web end comprises:
  • the React Native component code is converted into code adapted to the web end by the conversion component on the web side based on the React Native running environment of the compatible code emulation.
  • the step of parsing the metadata in the Markdown document comprises:
  • the metadata in the Markdown document is parsed by the parsing component.
  • the step of generating a configuration file specifying the metadata includes:
  • a configuration file specifying the metadata is generated by the parsing component.
  • the method further includes:
  • the Markdown document is generated as follows:
  • the component library includes a plurality of React Native component codes
  • the step of generating document data for the React Native component code and generating the Markdown document using the document data and the React Native component code comprises:
  • document data for the React Native component code is generated, and the Markdown document is generated using the document data and the React Native component code.
  • the embodiment of the present application further discloses a document display method, including:
  • the first format document includes front end component code
  • the method further includes:
  • the step of converting the first format document to the second format document on the web end includes:
  • the second format document is generated by the conversion component using the metadata.
  • the step of displaying the second format document and displaying the preview effect in the second format document by using the front end component code in the front end running environment based on the compatible code simulation on the web end include:
  • the step of converting the front end component code into the code adapted to the web end comprises:
  • the front end component code is converted into code adapted to the web end by the conversion component in the front end operating environment of the web terminal based on the compatible code emulation.
  • the embodiment of the present application further discloses a document display device, including:
  • a document obtaining module configured to obtain a Markdown document on the web side;
  • the Markdown document includes a React Native component code;
  • a document conversion module configured to convert the Markdown document into an Html webpage document on the web end
  • a compatible code loading module for loading compatible code for emulating the React Native runtime environment on the web side
  • a display module configured to display the Html webpage document in the React Native running environment based on the compatible code emulation, and display the preview effect in the Html webpage document by using the React Native component code.
  • the method further includes:
  • a parsing module configured to parse metadata in the Markdown document
  • the document conversion module includes:
  • the conversion component loads the submodule for loading the conversion component
  • a conversion submodule configured to generate an Html webpage document by using the metadata by the conversion component.
  • the method further includes:
  • a configuration file generating module configured to generate a configuration file that specifies the metadata
  • a configuration file incoming module configured to pass the configuration file to the conversion component
  • the step of generating the Html webpage document by using the metadata by using the conversion component includes:
  • a page document generating unit configured to acquire metadata specified by the configuration file by using the conversion component, and generate an Html webpage document by using the metadata.
  • the display module comprises:
  • a code conversion submodule configured to convert the React Native component code into a code adapted to the web end in a React Native running environment based on the compatible code emulation
  • a display sub-module configured to display the Html webpage document on the web end, and display the preview effect in the Html webpage document by using the code adapted to the web end.
  • the transcoding submodule comprises:
  • a code conversion unit configured to convert, by the conversion component, the React Native component code into a code adapted to the web end, in the React Native running environment based on the compatible code simulation.
  • the parsing module comprises:
  • the parsing component loads the submodule for loading the parsing component
  • a parsing submodule for parsing metadata in the Markdown document by the parsing component For parsing metadata in the Markdown document by the parsing component.
  • the configuration file generating module includes:
  • a profile generation submodule is configured to generate, by the parsing component, a configuration file that specifies the metadata.
  • the method further includes:
  • a connection relationship establishing module is configured to establish a link relationship between the plurality of Html webpage documents.
  • the Markdown document is generated by the following module:
  • a component library loading module configured to load a component library;
  • the component library includes a plurality of React Native component codes;
  • a document generation module configured to generate document data for the React Native component code, and generate a Markdown document using the document data and the React Native component code.
  • the document generating module comprises:
  • a document generation component loading submodule for loading a document generation component
  • a document generation submodule for generating document data for the React Native component code by the document generation component, and generating a Markdown document using the document data and the React Native component code.
  • the embodiment of the present application also discloses an apparatus, including:
  • One or more processors are One or more processors.
  • One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the apparatus to perform one or more of the methods described above.
  • Embodiments of the present application also disclose one or more machine-readable media having stored thereon instructions that, when executed by one or more processors, cause the processor to perform one or more of the method.
  • FIG. 1 is a flow chart showing the steps of a first embodiment of a document display method according to the present application
  • FIG. 2 is a flow chart of steps of a second embodiment of a document display method according to the present application.
  • FIG. 3 is a schematic diagram of previewing a document on a web end in an embodiment of the present application.
  • FIG. 4 is a flow chart showing the steps of a third embodiment of a document display method according to the present application.
  • FIG. 5 is a structural block diagram of an embodiment of a document display apparatus of the present application.
  • FIG. 1 a flow chart of steps in a first embodiment of a document display method of the present application is shown, which may specifically include the following steps:
  • Step 101 Obtain a Markdown document on the Web side; the Markdown document includes a React Native component code;
  • the web side can be a browser or other client that provides web access.
  • writing documentation for a component is essential.
  • the writing of the document can be sampled in various forms, and Markdown is used to write the document in the embodiment of the present application.
  • Markdown is a markup language that can be written using a plain text editor. Markdown has simple grammar rules that allow documents to be written in plain text format that is easy to read and write, and Markdown documents can be converted into Html web documents, pdf files for other users to open.
  • the Markdown document contains React Native component code and document data for explaining the React Native component code.
  • each Markdown document can be stored in a separate directory.
  • Putting code and document data in a single directory makes it easy for the maintainer of the document to maintain both code and document data.
  • the document data may include: a title, an attribute, and the like.
  • the Markdown document can be generated by the following steps:
  • the component library includes a plurality of React Native component codes; generating document data for the React Native component code, and generating a Markdown document using the document data and the React Native component code.
  • the generating the document data for the React Native component code, and generating the Markdown document by using the document data and the React Native component code may include:
  • the document generation component is a component developed by the developer for generating document data of the React Native component code, and the document generation component can generate corresponding document data after scanning the React Native component code.
  • Step 102 Convert the Markdown document to an Html webpage document on the web end
  • the React Native component code and the document data in the Markdown document are retained. Therefore, you can still browse the React Native component code and the corresponding document data in the Html page.
  • Step 103 Load compatible code for simulating a React Native running environment on the web side;
  • React Native code is only compatible with two platforms (iOS and Android) and is not compatible with web-side access.
  • iOS and Android In order to implement React Native code on the web side, you can develop compatible code for emulating the React Native runtime environment on the web.
  • the React Native runtime environment can also be called the React Native framework.
  • the React Native runtime environment contains functions and parameters that the React Native component code depends on.
  • Step 104 Display the Html webpage document on the web end based on the React Native running environment of the compatible code emulation, and display the preview effect in the Html webpage document by using the React Native component code.
  • launching the Html web document on the web side can display the React Native code in the Html web document and the document data used to describe the React Native code.
  • the React Native component code can be run to show the preview of the React Native component code.
  • FIG. 2 a flow chart of the steps of the second embodiment of the document display method of the present application is shown, which may specifically include the following steps:
  • Step 201 Obtain a Markdown document on the Web side; the Markdown document includes a React Native component code;
  • Step 202 Parse metadata in the Markdown document; the metadata includes: document data and a React Native component code;
  • the step 202 may include the following sub-steps:
  • Sub-step S11 loading the parsing component
  • a parsing component is a component developed by a developer to parse code and document data in a Markdown document.
  • the parsing component can include a number of components that cooperate to implement the analysis.
  • Sub-step S12 parsing the metadata in the Markdown document by the parsing component.
  • the parsed metadata can be stored in a structured form (for example, a tree structure) to make it easier for other components or systems to use the metadata.
  • Step 203 loading a conversion component
  • the transformation component was developed by the developer to convert the Markdown document to an Html web document.
  • the transformation component can include a plurality of components that cooperate to implement the transformation.
  • Step 204 Generate, by the conversion component, the Html webpage document by using the metadata
  • the method may further include: generating a configuration file that specifies the metadata; and transmitting the configuration file to the conversion component;
  • the parsing component may generate a configuration file specifying the metadata, and pass the configuration file to the conversion component.
  • the step 204 may be: acquiring metadata specified by the configuration file by using the conversion component, and generating an Html page by using the metadata.
  • the transformation component can obtain the specified metadata based on the configuration file.
  • the method may further include: establishing a link relationship between the plurality of Html webpage documents.
  • each Markdown document can be placed in a separate directory.
  • Multiple directories correspond to multiple sites.
  • Markdown documents in multiple directories can be referenced by a relative path format to implement jumps between sites.
  • Step 205 Load compatible code for simulating the React Native running environment on the web side
  • Step 206 The Html webpage document is displayed on the web end in the React Native running environment based on the compatible code simulation, and the preview effect is displayed in the Html webpage document by using the React Native component code.
  • the step 206 may include the following sub-steps:
  • Sub-step S21 in the React Native running environment based on the compatible code simulation, the web end converts the React Native component code into a code that adapts the web end;
  • the React Native component actually uses the .jsx code, while the Web side runs the .js code.
  • the practical role of compatible code provides a way to convert .jsx code to .js code.
  • the .jsx code used by the React Native component can be converted to .js code by the conversion method provided by the compatible code.
  • the sub-step S21 may include: converting, by the conversion component, the React Native component code into an adaptation in a React Native running environment based on the compatible code simulation on the web end. The code on the web side.
  • the React Native component code can be converted into a code adapted to the Web side by the conversion component calling a conversion method provided by the compatible code.
  • Sub-step S22 displaying the Html webpage document on the web end, and displaying the preview effect in the Html webpage document by using the code adapted to the web end.
  • FIG. 3 it is a schematic diagram of previewing a document on the web side in the embodiment of the present application.
  • an analysis component for example, a parser parser
  • a parser parser For the Redown Native component code in the .jsx format of the Markdown document and the Markdown document, an analysis component (for example, a parser parser) can be used for analysis to obtain the structured metadata meta.json.
  • Metadata meta.json is converted to Html web document using compatible code through the conversion component, and the preview effect of React Native component code is displayed in the Html web document.
  • FIG. 4 A flow chart of the steps of the third embodiment of the document display method of the present application is shown in FIG. 4, which may specifically include the following steps:
  • Step 401 Obtain a first format document on the web end; the first format document includes a front end component code;
  • the first format document may be a Markdown document;
  • the front end component code may be a React Native component code or a Weex component code.
  • Weex is a framework for developing native applications using the Web.
  • Weex component code is component code written based on the Weex framework.
  • Step 402 Convert the first format document to a second format document on the web end;
  • the second format document can be an Html web document.
  • the method may further include: parsing metadata in the first format document;
  • the step 402 may include: loading a conversion component; generating, by the conversion component, the second format document by using the metadata.
  • the method may further include: generating a configuration file that specifies the metadata; and transmitting the configuration file to the conversion component;
  • the step of generating the second format document by using the metadata by using the conversion component may include:
  • the step of parsing the metadata in the first format document comprises: loading a parsing component; and parsing, by the parsing component, the metadata in the first format document.
  • the generating the configuration file that specifies the metadata includes: generating, by the parsing component, a configuration file that specifies the metadata.
  • the method may further include: establishing a link relationship between the plurality of the second format documents.
  • the second format document is generated by:
  • the component library includes a plurality of front-end component codes; generating document data for the front-end component code, and generating a second format document using the document data and the front-end component code.
  • the step of generating document data for the front-end component code and generating the second format document by using the document data and the front-end component code includes:
  • Loading a document generation component generating, by the document generation component, document data for the front-end component code, and generating a second format document using the document data and the front-end component code.
  • Step 403 loading compatible code for simulating the running environment of the front end on the web end;
  • the front-end runtime environment contains the functions and parameters that the front-end component code runs on. After loading the compatible code on the web side, you can run the front-end component code on the web side.
  • Step 404 Display the second format document in the front end running environment of the web terminal based on the compatible code simulation, and display the preview effect in the second format document by using the front end component code.
  • the second format document is started on the web side to display the front-end component code in the second format document and the document data used to describe the front-end component code.
  • the front-end component code can be run to show the preview effect of the front-end component code.
  • the step 404 may include:
  • the step of converting the front end component code into the code that adapts the web end includes:
  • the front end component code is converted into code adapted to the web end by the conversion component in the front end operating environment of the web terminal based on the compatible code emulation.
  • FIG. 5 a structural block diagram of an embodiment of a document display apparatus of the present application is shown, which may specifically include the following modules:
  • a document obtaining module 501 configured to acquire a Markdown document on the web side;
  • the Markdown document includes a React Native component code;
  • a document conversion module 502 configured to convert the Markdown document into an Html webpage document on the web end;
  • a compatible code loading module 503, configured to load compatible code for simulating a React Native running environment on the web side;
  • the display module 504 is configured to display the Html webpage document in the React Native running environment based on the compatible code emulation, and display the preview effect in the Html webpage document by using the React Native component code.
  • the device may further include:
  • a parsing module configured to parse metadata in the Markdown document
  • the document conversion module 502 can include:
  • the conversion component loads the submodule for loading the conversion component
  • a conversion submodule configured to generate an Html webpage document by using the metadata by the conversion component.
  • the device may further include:
  • a configuration file generating module configured to generate a configuration file that specifies the metadata
  • a configuration file incoming module configured to pass the configuration file to the conversion component
  • the step of generating the Html webpage document by using the metadata by using the conversion component includes:
  • a page document generating unit configured to acquire metadata specified by the configuration file by using the conversion component, and generate an Html webpage document by using the metadata.
  • the display module 504 may include:
  • a code conversion submodule configured to convert the React Native component code into a code adapted to the web end in a React Native running environment based on the compatible code emulation
  • a display sub-module configured to display the Html webpage document on the web end, and display the preview effect in the Html webpage document by using the code adapted to the web end.
  • the code conversion submodule may include:
  • a code conversion unit configured to convert, by the conversion component, the React Native component code into a code adapted to the web end, in the React Native running environment based on the compatible code simulation.
  • the parsing module may include:
  • the parsing component loads the submodule for loading the parsing component
  • a parsing submodule for parsing metadata in the Markdown document by the parsing component For parsing metadata in the Markdown document by the parsing component.
  • the configuration file generating module may include:
  • a profile generation submodule is configured to generate, by the parsing component, a configuration file that specifies the metadata.
  • the device may further include:
  • a connection relationship establishing module is configured to establish a link relationship between the plurality of Html webpage documents.
  • the Markdown document is generated by the following module:
  • a component library loading module configured to load a component library;
  • the component library includes a plurality of React Native component codes;
  • a document generation module for generating document data for the React Native component code and generating a Markdown document using the document data and the React Native component code.
  • the document generating module includes:
  • a document generation component loading submodule for loading a document generation component
  • a document generation submodule for generating document data for the React Native component code by the document generation component, and generating a Markdown document using the document data and the React Native component code.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • the embodiment of the present application further provides an apparatus, including:
  • One or more processors are One or more processors.
  • One or more machine readable medium having instructions stored thereon, when executed by the one or more processors, causes the apparatus to perform the methods described in the embodiments of the present application.
  • the embodiment of the present application further provides one or more machine readable mediums having instructions stored thereon that, when executed by one or more processors, cause the processor to perform the methods described in the embodiments of the present application.
  • embodiments of the embodiments of the present application can be provided as a method, apparatus, or computer program product. Therefore, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Moreover, embodiments of the present application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal device to produce a machine such that instructions are executed by a processor of a computer or other programmable data processing terminal device
  • Means are provided for implementing the functions specified in one or more of the flow or in one or more blocks of the flow chart.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the instruction device implements the functions specified in one or more blocks of the flowchart or in a flow or block of the flowchart.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Transfer Between Computers (AREA)
  • Document Processing Apparatus (AREA)

Abstract

本申请实施例提供了一种文档展示方法和装置,所述方法包括:在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;在所述Web端将所述Markdown文档转换为Html网页文档;在所述Web端加载用于模拟React Native运行环境的兼容代码;在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。在本申请实施例中,通过在Web端加载用于模拟React Native运行环境的兼容代码,可以实现在展示React Native组件代码和相应的文档数据的同时,展示React Native组件代码的预览效果。

Description

一种文档展示方法和装置
本申请要求2018年05月08日递交的申请号为201810434160.5、发明名称为“一种文档展示方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别是涉及一种文档展示方法和一种文档展示装置。
背景技术
随着应用程序的发展,应用程序中用到的UI组件也越来越多。其中,用于原生系统(iOS系统和Android系统)React Native组件是一种常见的UI组件。
开发者在开发React Native组件时,为了便于其他使用者使用该组件,可以为React Native组件编写用于说明React Native组件如何使用的文档。
但是,目前针对React Native组件的文档只能展示React Native组件的源代码,无法预览代码的运行效果,不利于使用者快速了解React Native组件。
发明内容
鉴于上述问题,提出了本申请实施例以便提供一种克服上述问题或者至少部分地解决上述问题的一种文档展示方法和相应的一种文档展示装置。
为了解决上述问题,本申请实施例公开了一种文档展示方法,包括:
在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
在所述Web端将所述Markdown文档转换为Html网页文档;
在所述Web端加载用于模拟React Native运行环境的兼容代码;
在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。
优选的,还包括:
解析所述Markdown文档中的元数据;
所述在所述Web端将所述Markdown文档转换为Html网页文档的步骤包括:
加载转换组件;
通过所述转换组件采用所述元数据生成Html网页文档。
优选的,还包括:
生成指定所述元数据的配置文件;
将所述配置文件传入所述转换组件;
所述通过所述转换组件采用所述元数据生成Html网页文档的步骤包括:
通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成Html网页文档。
优选的,所述在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用React Native组件代码在所述Html网页文档中展示预览效果的步骤包括:
在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码;
在所述Web端展示所述Html网页文档,并采用所述适配所述Web端的代码在所述Html网页文档中展示预览效果。
优选的,在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码的步骤包括:
在所述Web端基于所述兼容代码模拟的React Native运行环境下,通过所述转换组件将所述React Native组件代码转换为适配所述Web端的代码。
优选的,所述解析所述Markdown文档中的元数据的步骤包括:
加载解析组件;
通过所述解析组件,解析所述Markdown文档中的元数据。
优选的,所述生成指定所述元数据的配置文件的步骤包括:
通过所述解析组件生成指定所述元数据的配置文件。
优选的,还包括:
建立多个所述Html网页文档的之间的链接关系。
优选的,所述Markdown文档通过如下方式生成:
加载组件库;所述组件库中包括多个React Native组件代码;
生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
优选的,所述生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档的步骤包括:
加载文档生成组件;
通过所述文档生成组件,生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
本申请实施例还公开了一种文档展示方法,包括:
在Web端获取第一格式文档;所述第一格式文档包含有前端组件代码;
在所述Web端将所述第一格式文档转换为第二格式文档;
在所述Web端加载用于模拟前端运行环境的兼容代码;
在所述Web端基于所述兼容代码模拟的前端运行环境下,展示所述第二格式文档,并采用所述前端组件代码在所述第二格式文档中展示预览效果。
优选的,还包括:
解析所述第一格式文档中的元数据;
所述在所述Web端将所述第一格式文档转换为第二格式文档的步骤包括:
加载转换组件;
通过所述转换组件采用所述元数据生成第二格式文档。
优选的,所述在所述Web端基于所述兼容代码模拟的前端运行环境下,展示所述第二格式文档,并采用所述前端组件代码在所述第二格式文档中展示预览效果的步骤包括:
在所述Web端基于所述兼容代码模拟的前端运行环境下,将所述前端组件代码转换为适配所述Web端的代码;
在所述Web端展示所述第二格式文档,并采用所述适配所述Web端的代码在所述第二格式文档中展示预览效果。
优选的,在所述Web端基于所述兼容代码模拟的前端运行环境下,将所述前端组件代码转换为适配所述Web端的代码的步骤包括:
在所述Web端基于所述兼容代码模拟的前端运行环境下,通过所述转换组件将所述前端组件代码转换为适配所述Web端的代码。
本申请实施例还公开了一种文档展示装置,包括:
文档获取模块,用于在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
文档转换模块,用于在所述Web端将所述Markdown文档转换为Html网页文档;
兼容代码加载模块,用于在所述Web端加载用于模拟React Native运行环境的兼容 代码;
展示模块,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。
优选的,还包括:
解析模块,用于解析所述Markdown文档中的元数据;
所述文档转换模块包括:
转换组件加载子模块,用于加载转换组件;
转换子模块,用于通过所述转换组件采用所述元数据生成Html网页文档。
优选的,还包括:
配置文件生成模块,用于生成指定所述元数据的配置文件;
配置文件传入模块,用于将所述配置文件传入所述转换组件;
所述通过所述转换组件采用所述元数据生成Html网页文档的步骤包括:
页面文档生成单元,用于通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成Html网页文档。
优选的,所述展示模块包括:
代码转换子模块,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码;
展示子模块,用于在所述Web端展示所述Html网页文档,并采用所述适配所述Web端的代码在所述Html网页文档中展示预览效果。
优选的,所述代码转换子模块包括:
代码转换单元,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,通过所述转换组件将所述React Native组件代码转换为适配所述Web端的代码。
优选的,所述解析模块包括:
解析组件加载子模块,用于加载解析组件;
解析子模块,用于通过所述解析组件,解析所述Markdown文档中的元数据。
优选的,所述配置文件生成模块包括:
配置文件生成子模块,用于通过所述解析组件生成指定所述元数据的配置文件。
优选的,还包括:
连接关系建立模块,用于建立多个所述Html网页文档的之间的链接关系。
优选的,所述Markdown文档通过如下模块生成:
组件库加载模块,用于加载组件库;所述组件库中包括多个React Native组件代码;
文档生成模块,用于生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
优选的,所述文档生成模块包括:
文档生成组件加载子模块,用于加载文档生成组件;
文档生成子模块,用于通过所述文档生成组件,生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
本申请实施例还公开了一种装置,包括:
一个或多个处理器;和
其上存储有指令的一个或多个机器可读介质,当由所述一个或多个处理器执行时,使得所述装置执行如上所述的一个或多个的方法。
本申请实施例还公开了一个或多个机器可读介质,其上存储有指令,当由一个或多个处理器执行时,使得所述处理器执行如权上所述的一个或多个的方法。
本申请实施例包括以下优点:
在本申请实施例中,通过在Web端加载用于模拟React Native运行环境的兼容代码,可以实现在展示React Native组件代码和相应的文档数据的同时,展示React Native组件代码的预览效果。
附图说明
图1是本申请的一种文档展示方法实施例一的步骤流程图;
图2是本申请的一种文档展示方法实施例二的步骤流程图;
图3是本申请实施例中实现在Web端预览文档的示意图;
图4是本申请的一种文档展示方法实施例三的步骤流程图;
图5是本申请的一种文档展示装置实施例的结构框图。
具体实施方式
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。
参照图1,示出了本申请的一种文档展示方法实施例一的步骤流程图,具体可以包括如下步骤:
步骤101,在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
Web端可以是浏览器端或是其他提供网页访问功能的客户端。
对于开发者而言,为组件编写说明文档是必不可少的工作。文档的编写可以采样多种形式,在本申请实施例中采用Markdown来编写文档。
Markdown是一种可以使用普通文本编辑器编写的标记语言。Markdown具有简单的语法规则,其允许使用易读易写的纯文本格式编写文档,并且Markdown文档能转换成Html网页文档、pdf文档,方便其他使用者打开。
在本申请实施例中,Markdown文档包含有React Native组件代码和用于说明React Native组件代码的文档数据。
在实际中,每个Markdown文档都可以存储在独立的目录中。将代码和文档数据放在一个目录中,可以方便文档的维护者同时维护代码和文档数据。其中,文档数据可以包括:标题、属性等信息。
在实际中,往往需要对多个React Native组件生成说明文档。例如,对React Native组件库中的所有React Native组件生成说明文档。
在本申请实施例中,Markdown文档可以通过如下步骤生成:
加载组件库;所述组件库中包括多个React Native组件代码;生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
具体的,所述生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档可以包括:
加载文档生成组件;通过所述文档生成组件,生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
文档生成组件是开发者开发的用于生成React Native组件代码的文档数据的组件,文档生成组件在扫描React Native组件代码后,即可生成相应的文档数据。
步骤102,在所述Web端将所述Markdown文档转换为Html网页文档;
为了方便将Markdown文档转换成Html网页文档,可以开发转换组件来进行转换。对于使用者而言,可以在Web端安装其他开发者开发的转换组件。
在本申请实施例中,Markdown文档转换为Html网页文档后,Markdown文档中的React Native组件代码和文档数据会被保留。因此,仍然可以在Html页面中浏览React Native组件代码和相应的文档数据。
步骤103,在所述Web端加载用于模拟React Native运行环境的兼容代码;
在实际中,React Native代码只兼容两个平台(iOS和Android),并没有兼容Web端访问。为了能在Web端实现React Native代码,可以开发用于在Web端模拟React Native运行环境的兼容代码。
React Native运行环境也可以称为React Native框架,React Native运行环境包含了React Native组件代码运行所依赖的函数和参数。
在Web端加载该兼容代码后,即可以实现在Web端运行React Native组件代码。
步骤104,在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。
Web端模拟出React Native运行环境后,在Web端启动Html网页文档即可展示Html网页文档中的React Native代码和用于描述React Native代码的文档数据。同时,在模拟出的React Native运行环境下,可以实现React Native组件代码的运行,从而展示React Native组件代码的预览效果。
在本申请实施例中,通过在Web端加载用于模拟React Native运行环境的兼容代码,可以实现在展示React Native组件代码和相应的文档数据的同时,展示React Native组件代码的预览效果。
参照图2,示出了本申请的一种文档展示方法实施例二的步骤流程图,具体可以包括如下步骤:
步骤201,在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
步骤202,解析所述Markdown文档中的元数据;所述元数据包括:文档数据以及React Native组件代码;
在本申请实施例中,所述步骤202可以包括如下子步骤:
子步骤S11,加载解析组件;
解析组件是由开发者开发的用于解析出Markdown文档中的代码和文档数据的组件。
在实际中,解析组件可以包括多个相互配合来实现分析的组件。
子步骤S12,通过所述解析组件,解析所述Markdown文档中的元数据。
解析得到的元数据,可以按结构化的形式存储(例如,树结构),从而方便其他组件或系统使用这些元数据。
步骤203,加载转换组件;
转换组件是由开发者开发的用于将Markdown文档转换为Html网页文档。
在实际中,转换组件可以包括多个相互配合来实现转换的组件。
步骤204,通过所述转换组件采用所述元数据生成Html网页文档;
在本申请实施例中,所述的方法还可以包括:生成指定所述元数据的配置文件;将所述配置文件传入所述转换组件;
具体的,可以由解析组件在解析出元数据后,生成指定所述元数据的配置文件,并将配置文件传入到转换组件。
所述步骤204可以为:通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成Html页面。
为了使转换组件能更方便、更准确的获取到元数据,可用通过配置文件来指定元数据。转换组件可以根据配置文件,获取指定的元数据。
在本申请实施例中,所述的方法还可以包括:建立多个所述Html网页文档的之间的链接关系。
通过建立多个所述Html网页文档的之间的链接关系,就可以实现Html网页文档之间的跳转。
具体的,每个Markdown文档可以独立放在一个目录中,多个目录对应的就是多个站点,多个目录下的Markdown文档可以使用一种相对路径格式相互引用,实现了站点间的跳转。
步骤205,在所述Web端加载用于模拟React Native运行环境的兼容代码;
步骤206,在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。
在本申请实施例中,所述步骤206可以包括如下子步骤:
子步骤S21,在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码;
具体的,React Native组件实际使用的是.jsx代码,而在Web端运行的则是.js代码。兼容代码的实际作用就提供将.jsx代码转换为.js代码的方法。
通过兼容代码提供的转换方法,可以将React Native组件所用到的.jsx代码都转换为.js代码。
在本申请实施例中,所述子步骤S21可以包括为:在所述Web端基于所述兼容代码模拟的React Native运行环境下,通过所述转换组件将所述React Native组件代码转换为适配所述Web端的代码。
具体的,可以通过转换组件调用兼容代码提供的转换方法,将React Native组件代码转换为适配Web端的代码。
子步骤S22,在所述Web端展示所述Html网页文档,并采用所述适配所述Web端的代码在所述Html网页文档中展示预览效果。
在本申请实施例中,通过在Web端加载用于模拟React Native运行环境的兼容代码,可以实现在展示React Native组件代码和相应的文档数据的同时,展示React Native组件代码的预览效果。
参照图3所示,为本申请实施例中实现在Web端预览文档的示意图。
对于Markdown文档和Markdown文档中.jsx格式的React Native组件代码,可以采用分析组件(例如,解析器parser)进行分析,得到结构化的元数据meta.json。
在Web端加载用于模拟React Native运行环境的兼容代码,以在Web端模拟React Native运行环境。
在模拟的React Native运行环境下,通过转换组件将元数据meta.json使用兼容代码转换为Html网页文档,并在Html网页文档中展示React Native组件代码的预览效果。
参照图4示出了本申请的一种文档展示方法实施例三的步骤流程图,具体可以包括如下步骤:
步骤401,在Web端获取第一格式文档;所述第一格式文档包含有前端组件代码;
在本申请实施例中,第一格式文档可以为Markdown文档;前端组件代码可以为React  Native组件代码、Weex组件代码。Weex是一个使用Web开发原生应用的框架。Weex组件代码是基于Weex框架编写的组件代码。
步骤402,在所述Web端将所述第一格式文档转换为第二格式文档;
第二格式文档可以为Html网页文档。
在本申请实施例中,所述的方法还可以包括:解析所述第一格式文档中的元数据;
所述步骤402可以包括:加载转换组件;通过所述转换组件采用所述元数据生成第二格式文档。
在本申请实施例中,所述的方法还可以包括:生成指定所述元数据的配置文件;将所述配置文件传入所述转换组件;
所述通过所述转换组件采用所述元数据生成第二格式文档的步骤可以包括:
通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成第二格式文档。
在本申请实施例中,所述解析所述第一格式文档中的元数据的步骤包括:加载解析组件;通过所述解析组件,解析所述第一格式文档中的元数据。
在本申请实施例中,所述生成指定所述元数据的配置文件的步骤包括:通过所述解析组件生成指定所述元数据的配置文件。
在本申请实施例中,所述的方法还可以包括:建立多个所述第二格式文档的之间的链接关系。
在本申请实施例中,所述第二格式文档通过如下方式生成:
加载组件库;所述组件库中包括多个前端组件代码;生成针对所述前端组件代码的文档数据,并采用所述文档数据和所述前端组件代码生成第二格式文档。
在本申请实施例中,所述生成针对所述前端组件代码的文档数据,并采用所述文档数据和所述前端组件代码生成第二格式文档的步骤包括:
加载文档生成组件;通过所述文档生成组件,生成针对所述前端组件代码的文档数据,并采用所述文档数据和所述前端组件代码生成第二格式文档。
步骤403,在所述Web端加载用于模拟前端运行环境的兼容代码;
前端运行环境包含了前端组件代码运行所依赖的函数和参数。在Web端加载该兼容代码后,即可以实现在Web端运行前端组件代码。
步骤404,在所述Web端基于所述兼容代码模拟的前端运行环境下,展示所述第二格式文档,并采用所述前端组件代码在所述第二格式文档中展示预览效果。
Web端模拟出前端运行环境后,在Web端启动第二格式文档即可展示第二格式文档中的前端组件代码和用于描述前端组件代码的文档数据。同时,在模拟出的前端运行环境下,可以实现前端组件代码的运行,从而展示前端组件代码的预览效果。
在本申请实施例中,通过在Web端加载用于模拟前端运行环境的兼容代码,可以实现在展示前端组件代码和相应的文档数据的同时,展示前端组件代码的预览效果。
在本申请实施例中,所述步骤404可以包括:
在所述Web端基于所述兼容代码模拟的前端运行环境下,将所述前端组件代码转换为适配所述Web端的代码;
在所述Web端展示所述第二格式文档,并采用所述适配所述Web端的代码在所述第二格式文档中展示预览效果。
在本申请实施例中,在所述Web端基于所述兼容代码模拟的前端运行环境下,将所述前端组件代码转换为适配所述Web端的代码的步骤包括:
在所述Web端基于所述兼容代码模拟的前端运行环境下,通过所述转换组件将所述前端组件代码转换为适配所述Web端的代码。
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请实施例所必须的。
参照图5,示出了本申请的一种文档展示装置实施例的结构框图,具体可以包括如下模块:
文档获取模块501,用于在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
文档转换模块502,用于在所述Web端将所述Markdown文档转换为Html网页文档;
兼容代码加载模块503,用于在所述Web端加载用于模拟React Native运行环境的兼容代码;
展示模块504,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档 中展示预览效果。
在本申请实施例中,所述的装置还可以包括:
解析模块,用于解析所述Markdown文档中的元数据;
所述文档转换模块502可以包括:
转换组件加载子模块,用于加载转换组件;
转换子模块,用于通过所述转换组件采用所述元数据生成Html网页文档。
在本申请实施例中,所述的装置还可以包括:
配置文件生成模块,用于生成指定所述元数据的配置文件;
配置文件传入模块,用于将所述配置文件传入所述转换组件;
所述通过所述转换组件采用所述元数据生成Html网页文档的步骤包括:
页面文档生成单元,用于通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成Html网页文档。
在本申请实施例中,所述展示模块504可以包括:
代码转换子模块,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码;
展示子模块,用于在所述Web端展示所述Html网页文档,并采用所述适配所述Web端的代码在所述Html网页文档中展示预览效果。
在本申请实施例中,所述代码转换子模块可以包括:
代码转换单元,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,通过所述转换组件将所述React Native组件代码转换为适配所述Web端的代码。
在本申请实施例中,所述解析模块可以包括:
解析组件加载子模块,用于加载解析组件;
解析子模块,用于通过所述解析组件,解析所述Markdown文档中的元数据。
在本申请实施例中,所述配置文件生成模块可以包括:
配置文件生成子模块,用于通过所述解析组件生成指定所述元数据的配置文件。
在本申请实施例中,所述的装置还可以包括:
连接关系建立模块,用于建立多个所述Html网页文档的之间的链接关系。
在本申请实施例中,所述Markdown文档通过如下模块生成:
组件库加载模块,用于加载组件库;所述组件库中包括多个React Native组件代码;
文档生成模块,用于生成针对所述React Native组件代码的文档数据,并采用所述 文档数据和所述React Native组件代码生成Markdown文档。
在本申请实施例中,所述文档生成模块包括:
文档生成组件加载子模块,用于加载文档生成组件;
文档生成子模块,用于通过所述文档生成组件,生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本申请实施例还提供了一种装置,包括:
一个或多个处理器;和
其上存储有指令的一个或多个机器可读介质,当由所述一个或多个处理器执行时,使得所述装置执行本申请实施例所述的方法。
本申请实施例还提供了一个或多个机器可读介质,其上存储有指令,当由一个或多个处理器执行时,使得所述处理器执行本申请实施例所述的方法。
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方 框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。
以上对本申请所提供的一种文档展示方法和一种文档展示装置,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (26)

  1. 一种文档展示方法,其特征在于,包括:
    在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
    在所述Web端将所述Markdown文档转换为Html网页文档;
    在所述Web端加载用于模拟React Native运行环境的兼容代码;
    在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。
  2. 根据权利要求1所述的方法,其特征在于,还包括:
    解析所述Markdown文档中的元数据;
    所述在所述Web端将所述Markdown文档转换为Html网页文档的步骤包括:
    加载转换组件;
    通过所述转换组件采用所述元数据生成Html网页文档。
  3. 根据权利要求2所述的方法,其特征在于,还包括:
    生成指定所述元数据的配置文件;
    将所述配置文件传入所述转换组件;
    所述通过所述转换组件采用所述元数据生成Html网页文档的步骤包括:
    通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成Html网页文档。
  4. 根据权利要求3所述的方法,其特征在于,所述在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用React Native组件代码在所述Html网页文档中展示预览效果的步骤包括:
    在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码;
    在所述Web端展示所述Html网页文档,并采用所述适配所述Web端的代码在所述Html网页文档中展示预览效果。
  5. 根据权利要求4所述的方法,其特征在于,在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码的步骤包括:
    在所述Web端基于所述兼容代码模拟的React Native运行环境下,通过所述转换组件将所述React Native组件代码转换为适配所述Web端的代码。
  6. 根据权利要求5所述的方法,其特征在于,所述解析所述Markdown文档中的元数据的步骤包括:
    加载解析组件;
    通过所述解析组件,解析所述Markdown文档中的元数据。
  7. 根据权利要求6所述的方法,其特征在于,所述生成指定所述元数据的配置文件的步骤包括:
    通过所述解析组件生成指定所述元数据的配置文件。
  8. 根据权利要求7所述的方法,其特征在于,还包括:
    建立多个所述Html网页文档的之间的链接关系。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述Markdown文档通过如下方式生成:
    加载组件库;所述组件库中包括多个React Native组件代码;
    生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
  10. 根据权利要求9所述的方法,其特征在于,所述生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档的步骤包括:
    加载文档生成组件;
    通过所述文档生成组件,生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
  11. 一种文档展示方法,其特征在于,包括:
    在Web端获取第一格式文档;所述第一格式文档包含有前端组件代码;
    在所述Web端将所述第一格式文档转换为第二格式文档;
    在所述Web端加载用于模拟前端运行环境的兼容代码;
    在所述Web端基于所述兼容代码模拟的前端运行环境下,展示所述第二格式文档,并采用所述前端组件代码在所述第二格式文档中展示预览效果。
  12. 根据权利要求11所述的方法,其特征在于,还包括:
    解析所述第一格式文档中的元数据;
    所述在所述Web端将所述第一格式文档转换为第二格式文档的步骤包括:
    加载转换组件;
    通过所述转换组件采用所述元数据生成第二格式文档。
  13. 根据权利要求12所述的方法,其特征在于,所述在所述Web端基于所述兼容代码模拟的前端运行环境下,展示所述第二格式文档,并采用所述前端组件代码在所述第二格式文档中展示预览效果的步骤包括:
    在所述Web端基于所述兼容代码模拟的前端运行环境下,将所述前端组件代码转换为适配所述Web端的代码;
    在所述Web端展示所述第二格式文档,并采用所述适配所述Web端的代码在所述第二格式文档中展示预览效果。
  14. 根据权利要求13所述的方法,其特征在于,在所述Web端基于所述兼容代码模拟的前端运行环境下,将所述前端组件代码转换为适配所述Web端的代码的步骤包括:
    在所述Web端基于所述兼容代码模拟的前端运行环境下,通过所述转换组件将所述前端组件代码转换为适配所述Web端的代码。
  15. 一种文档展示装置,其特征在于,包括:
    文档获取模块,用于在Web端获取Markdown文档;所述Markdown文档包含有React Native组件代码;
    文档转换模块,用于在所述Web端将所述Markdown文档转换为Html网页文档;
    兼容代码加载模块,用于在所述Web端加载用于模拟React Native运行环境的兼容代码;
    展示模块,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,展示所述Html网页文档,并采用所述React Native组件代码在所述Html网页文档中展示预览效果。
  16. 根据权利要求15所述的装置,其特征在于,还包括:
    解析模块,用于解析所述Markdown文档中的元数据;
    所述文档转换模块包括:
    转换组件加载子模块,用于加载转换组件;
    转换子模块,用于通过所述转换组件采用所述元数据生成Html网页文档。
  17. 根据权利要求16所述的装置,其特征在于,还包括:
    配置文件生成模块,用于生成指定所述元数据的配置文件;
    配置文件传入模块,用于将所述配置文件传入所述转换组件;
    所述通过所述转换组件采用所述元数据生成Html网页文档的步骤包括:
    页面文档生成单元,用于通过所述转换组件获取所述配置文件指定的元数据,并采用所述元数据生成Html网页文档。
  18. 根据权利要求17所述的装置,其特征在于,所述展示模块包括:
    代码转换子模块,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,将所述React Native组件代码转换为适配所述Web端的代码;
    展示子模块,用于在所述Web端展示所述Html网页文档,并采用所述适配所述Web端的代码在所述Html网页文档中展示预览效果。
  19. 根据权利要求18所述的装置,其特征在于,所述代码转换子模块包括:
    代码转换单元,用于在所述Web端基于所述兼容代码模拟的React Native运行环境下,通过所述转换组件将所述React Native组件代码转换为适配所述Web端的代码。
  20. 根据权利要求19所述的装置,其特征在于,所述解析模块包括:
    解析组件加载子模块,用于加载解析组件;
    解析子模块,用于通过所述解析组件,解析所述Markdown文档中的元数据。
  21. 根据权利要求20所述的装置,其特征在于,所述配置文件生成模块包括:
    配置文件生成子模块,用于通过所述解析组件生成指定所述元数据的配置文件。
  22. 根据权利要求21所述的装置,其特征在于,还包括:
    连接关系建立模块,用于建立多个所述Html网页文档的之间的链接关系。
  23. 根据权利要求15-22任一项所述的装置,其特征在于,所述Markdown文档通过如下模块生成:
    组件库加载模块,用于加载组件库;所述组件库中包括多个React Native组件代码;
    文档生成模块,用于生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
  24. 根据权利要求23所述的装置,其特征在于,所述文档生成模块包括:
    文档生成组件加载子模块,用于加载文档生成组件;
    文档生成子模块,用于通过所述文档生成组件,生成针对所述React Native组件代码的文档数据,并采用所述文档数据和所述React Native组件代码生成Markdown文档。
  25. 一种装置,其特征在于,包括:
    一个或多个处理器;和
    其上存储有指令的一个或多个机器可读介质,当由所述一个或多个处理器执行时,使得所述装置执行如权利要求1-10或者11-14所述的一个或多个的方法。
  26. 一个或多个机器可读介质,其特征在于,其上存储有指令,当由一个或多个处理器执行时,使得所述处理器执行如权利要求1-10或者11-14所述的一个或多个的方法。
PCT/CN2019/085466 2018-05-08 2019-05-05 一种文档展示方法和装置 Ceased WO2019214539A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810434160.5A CN110457656B (zh) 2018-05-08 2018-05-08 一种文档展示方法、装置和机器可读介质
CN201810434160.5 2018-05-08

Publications (1)

Publication Number Publication Date
WO2019214539A1 true WO2019214539A1 (zh) 2019-11-14

Family

ID=68466895

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/085466 Ceased WO2019214539A1 (zh) 2018-05-08 2019-05-05 一种文档展示方法和装置

Country Status (3)

Country Link
CN (1) CN110457656B (zh)
TW (1) TW201947424A (zh)
WO (1) WO2019214539A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111045668A (zh) * 2019-12-03 2020-04-21 安徽航天信息科技有限公司 一种跨平台的移动端系统开发方法及装置
CN111736812A (zh) * 2020-06-16 2020-10-02 北京三快在线科技有限公司 文档代码执行方法、装置、计算机设备及存储介质
CN112130819A (zh) * 2020-09-16 2020-12-25 北京值得买科技股份有限公司 页面处理方法、页面处理装置、电子设备和计算机可读介质
CN112434012A (zh) * 2020-11-30 2021-03-02 恩亿科(北京)数据科技有限公司 基于React的前端多级条件筛选方法、系统、设备及存储介质
CN113792531A (zh) * 2021-08-17 2021-12-14 罗普特科技集团股份有限公司 一种基于markdown语法扩展的文本编辑方法与系统
CN116561087A (zh) * 2023-05-11 2023-08-08 浪潮通用软件有限公司 一种在线文档自动生成的方法、装置、设备及介质
CN116795795A (zh) * 2023-07-05 2023-09-22 上海云轴信息科技有限公司 一种将目录下文件进行页面显示的方法及设备
CN118733799A (zh) * 2024-06-14 2024-10-01 北京中科睿途科技有限公司 大模型多模态输出展示方法及装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111290996A (zh) * 2020-01-16 2020-06-16 平安医疗健康管理股份有限公司 文档格式转换方法、装置、设备及可读存储介质
US11704474B2 (en) * 2020-02-25 2023-07-18 Transposit Corporation Markdown data content with action binding
CN111596948B (zh) * 2020-04-09 2021-07-16 北京五八信息技术有限公司 一种基于Flutter的文档处理方法和装置
CN114004195B (zh) * 2021-11-01 2024-08-20 盐城天眼察微科技有限公司 Pdf文件的生成方法、装置、电子设备及计算机存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824900A (zh) * 2016-03-14 2016-08-03 传线网络科技(上海)有限公司 一种基于react-native的页面展示系统
CN106095889A (zh) * 2016-06-07 2016-11-09 浪潮软件股份有限公司 一种基于Markdown的文档管理方法
CN106970946A (zh) * 2017-02-24 2017-07-21 阿里巴巴集团控股有限公司 一种页面显示方法及装置
CN107347179A (zh) * 2017-03-28 2017-11-14 吉林市东杰科技开发有限公司 一种基于ReactNative实现LBS的方法
US9852117B1 (en) * 2015-06-01 2017-12-26 Haydn Labs, Inc. Text-fragment based content editing and publishing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106371844B (zh) * 2016-08-31 2019-10-22 北京奇艺世纪科技有限公司 一种用原生用户界面组件展示网页的方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9852117B1 (en) * 2015-06-01 2017-12-26 Haydn Labs, Inc. Text-fragment based content editing and publishing
CN105824900A (zh) * 2016-03-14 2016-08-03 传线网络科技(上海)有限公司 一种基于react-native的页面展示系统
CN106095889A (zh) * 2016-06-07 2016-11-09 浪潮软件股份有限公司 一种基于Markdown的文档管理方法
CN106970946A (zh) * 2017-02-24 2017-07-21 阿里巴巴集团控股有限公司 一种页面显示方法及装置
CN107347179A (zh) * 2017-03-28 2017-11-14 吉林市东杰科技开发有限公司 一种基于ReactNative实现LBS的方法

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111045668A (zh) * 2019-12-03 2020-04-21 安徽航天信息科技有限公司 一种跨平台的移动端系统开发方法及装置
CN111045668B (zh) * 2019-12-03 2023-06-06 安徽航天信息科技有限公司 一种跨平台的移动端系统开发方法及装置
CN111736812A (zh) * 2020-06-16 2020-10-02 北京三快在线科技有限公司 文档代码执行方法、装置、计算机设备及存储介质
CN112130819A (zh) * 2020-09-16 2020-12-25 北京值得买科技股份有限公司 页面处理方法、页面处理装置、电子设备和计算机可读介质
CN112434012A (zh) * 2020-11-30 2021-03-02 恩亿科(北京)数据科技有限公司 基于React的前端多级条件筛选方法、系统、设备及存储介质
CN113792531A (zh) * 2021-08-17 2021-12-14 罗普特科技集团股份有限公司 一种基于markdown语法扩展的文本编辑方法与系统
CN113792531B (zh) * 2021-08-17 2024-02-27 罗普特科技集团股份有限公司 一种基于markdown语法扩展的文本编辑方法与系统
CN116561087A (zh) * 2023-05-11 2023-08-08 浪潮通用软件有限公司 一种在线文档自动生成的方法、装置、设备及介质
CN116795795A (zh) * 2023-07-05 2023-09-22 上海云轴信息科技有限公司 一种将目录下文件进行页面显示的方法及设备
CN118733799A (zh) * 2024-06-14 2024-10-01 北京中科睿途科技有限公司 大模型多模态输出展示方法及装置

Also Published As

Publication number Publication date
TW201947424A (zh) 2019-12-16
CN110457656A (zh) 2019-11-15
CN110457656B (zh) 2022-05-24

Similar Documents

Publication Publication Date Title
WO2019214539A1 (zh) 一种文档展示方法和装置
CN113031932B (zh) 项目开发方法、装置、电子设备及存储介质
CN110389755B (zh) 代码处理方法及装置、电子设备和计算机可读存储介质
CN103608802B (zh) 取回的文件和源文件之间的选择映射的方法和系统
CN100578496C (zh) 基于模板的网页动态生成方法和系统
US20030121000A1 (en) Method and apparatus for converting programs and source code files written in a programming language to equivalent markup language files
US20070061700A1 (en) Initial server-side content rendering for client-script web pages
US20080082965A1 (en) Providing globalization functionalities for javascript applications
CN102193953A (zh) 桌面应用迁移系统和方法
CN114153459A (zh) 接口文档生成方法及装置
KR100974146B1 (ko) Html 도큐먼트에 액세스 가능한 역할 및 상태 정보를 포함시키는 방법, 시스템 및 컴퓨터 판독가능 저장 매체
CN113778897B (zh) 接口的自动测试方法、装置、设备及存储介质
CN112632425B (zh) 一种离线资源文件的生成方法、装置、设备及存储介质
CN113094138A (zh) 界面显示方法、装置、电子设备及存储介质
CN110187886B (zh) 一种文档网站生成方法及终端
CN101859246A (zh) 依据不同浏览器转换相应脚本的系统及其方法
CN118245050A (zh) 前端框架组件自动转换方法、系统、电子设备及存储介质
CN113495730B (zh) 资源包的生成及解析方法和装置
KR20120122959A (ko) 웹 컨텐츠 수집방법 및 수집장치, 그 기록매체
JP5267342B2 (ja) マッシュアッププログラム、マッシュアップ装置及びマッシュアップ方法
CN114329288A (zh) 一种网页文档动态生成方法、系统及服务器
CN114780096A (zh) 文档转换方法及装置
CN105279032A (zh) 一种同步接口报文与javaBean的方法及装置
CN107239265A (zh) Java函数与C函数的绑定方法及装置
CN110908656A (zh) 一种Android用户界面生成方法及系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19799164

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19799164

Country of ref document: EP

Kind code of ref document: A1