Giter Club home page Giter Club logo

go-go-web's People

Contributors

kliu57 avatar rjwignar avatar wanggithub0 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

go-go-web's Issues

Add heading to output HTML file based on title

If the file is a markdown file:

  • look for the title in the front matter
  • if front matter title is present, use it as the title and heading
  • if not present, check if the first line in the content is following by 2 blank lines. If it is, use it as the title and heading.

If the file is a text file:

  • check if the first line in the content is following by 2 blank lines. If it is, use it as the title and heading.

If a title/heading has been identified:

  • In output HTML, use this to populate the <title>...</title> and add an <h1>...</h1> to the top of the <body>

update documentation for new front matter feature

  • in README under Features, add the new front matter markdown feature
  • in README under Installation, add pip install python-frontmatter
  • in README, add a new section to explain the front matter items that can be specified in markdown files (currently title, keywords, description, lang). Also show how to write front matter in an .md file.
  • update version of the app in _version.py

Create unit test for testing markdown_to_html function

Create a unit test for the following function src/convert.py def markdown_to_html(path, output_folder, css_url)

This function takes an input md file path and writes to a new .html file

Please create a temporary input file to test the following:

# Replace *italic* and _italic_ with <em>italic</em>
# Replace **bold** and __bold__ with <strong>bold</strong>
# Replace `text` with <code>text</code>
# Replace multi-line code blocks that are inside ```...``` with <pre>...</pre>

parameters of markdown_to_html:

path: the path to an input file (ex: "examples/test3.md")
(create a temporary file using: helpers.new_file(tmpdir, "your_file_name.md", pytest.your_global_var))

set pytest.your_global_var in conftest.py pytest_configure() to a long string which represents the markdown content of the input file (see other global variables in conftest.py to get an idea)

output_folder: the path for the output file (ex: til) (you can use a temporary directory, just put tmpdir)

css_url: no need to test this param, just use empty string


Create the unit test in tests/convert_test.py

To name the unit test, use def test_markdown_to_html(tmpdir, helpers):

How to compare the output of markdown_to_html after running the function:

    # Compare actual output file contents to expected
    output_path = tmpdir.join('your_file_name.html')
    assert helpers.file_contents(output_path) == pytest.your_html_global_var

you must set pytest.your_html_global_var in conftest.py pytest_configure() to a long string which represents the expected html content.

Please run pylint and autopep8 prior to submitting the pull request. (Instructions in contributing.md)

break convert_to_html down to sub functions

@WangGithub0 Hi Yumei can I ask you to implement this fix since you added the Markdown feature?

Feedback from professor:
I would probably break the md and html aspects of this function into two smaller functions, and name this convert_txt or something:

def convert_to_html(text, type):
If type == ‘markdown':
return markdown_to_html(text)
else
return text_to_html(text)

That’s just pseudo code, but you get the idea.

Find front matter parser

Find front matter parser:

  • in python
  • MIT license
  • able to parse Markdown file contents into two parts: front matter, and the rest of the Markdown file contents
  • front matter is stored in key-value pairs (for example if stored in a dictionary-like object)
  • read documentation to find out how to install and use

update README

Please add Installation, Usage, License, Features in the README

update the get_html_before_body() method to take metadata

Update the get_html_before_body() method which is used to generate html that appears before the body:

  • add an additional parameter called metadata which includes all the metadata gotten from parsing using python-frontmatter
  • instead of title param change it to filename
  • set html lang to value of metadata if exists or 'en' by default
  • set title to value of metadata if exists or filename by default
  • if metadata object has 'keywords', add html meta tag for keywords
  • if metadata object has 'description', add html meta tag for description

Update the calls of get_html_before_body() to reflect new params

  • in text files there is no metadata (front matter) so pass {} as the param

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.